Search Results

Search found 9 results on 1 pages for 'jaimal chohan'.

Page 1/1 | 1 

  • Should I forward the a call to .Equals onto .Equals<T>?

    - by Jaimal Chohan
    So, I've got you bog standard c# object, overriding Equalsand implementing IEquatable public override int GetHashCode() { return _name.GetHashCode(); } public override bool Equals(object obj) { return Equals(obj as Tag) } #region IEquatable<Tag> Members public bool Equals(Tag other) { if (other == null) return false; else return _name == other._name; } #endregion Now, for some reason, I used to think that forwarding the calls from Equals into Equals was bad, no idea why, perhaps I read it a long time ago, anyway I'd write separate (but logically same) code for each method. Now I think forwarding Equals to Equals is okay, for obvious reasons, but for the life me I can't remember why I thought it wasn't before. Any thoughts?

    Read the article

  • using System.Net.Mail To send smtp mail via google gets me a time out exception.

    - by Anicho
    Hey guys, I guess I got another asp.net question I am trying to send email using smtp authentication through google but I am constantly getting a timed out error and no idea what it might be from the following code its not my firewall or my isp blocking smtp ports so its most probably the code: MailMessage msg = new MailMessage(); String BodyMsg; BodyMsg = "Hey " + TxtBoxUsername.Text + "@" + "Welcome to Tiamo your username and password are:@Username: " + TxtBoxUsername.Text + "@Password: " + PasswordString + "@You have succesffully registered, you can now login." + "@Thank You@Tiamo Team"; BodyMsg = BodyMsg.Replace("@", System.Environment.NewLine); msg.To.Add(new MailAddress(TxtBoxEmail.Text)); msg.From = new MailAddress("[email protected]"); msg.Subject = "Re: Welcome to Tiamo"; msg.Body = BodyMsg; SmtpClient client = new SmtpClient() ; client.EnableSsl = true; client.Send(msg); and this is my web.config email smtp settings: <system.net> <mailSettings> <smtp from="[email protected]"> <network host="smtp.gmail.com" port="465" userName="[email protected]" password="MyLovelyPassword" defaultCredentials="true"/> </smtp> </mailSettings> Im completely exhausted so I thought the best thing is to pop up a question, hope you can help it will all be much appreciated... thanks anicho.

    Read the article

  • Fluent NHibernate Map Enum as Lookup Table

    - by Jaimal Chohan
    I have the following (simplified) public enum Level { Bronze, Silver, Gold } public class Member { public virtual Level MembershipLevel { get; set; } } public class MemberMap : ClassMap<Member> { Map(x => x.MembershipLevel); } This creates a table with a column called MembershipLevel with the value as the Enum string value. What I want is for the entire Enum to be created as a lookup table, with the Membe table referencing this with the integer value as the FK. Also, I want to do this without bas***izing my model. Any ideas? [And I want time machine] [With 2 cup holders]

    Read the article

  • Asp.net MVC Label For

    - by Jaimal Chohan
    I have the following <label for="Forename">Forename</label> <%= Html.TextBoxFor(m => m.Customer.Name.Forename) %> the problem with this is that this is rendered as <label for="AddressLine1">Address Line 1</label> <input type="text" value="" name="Customer.Address.Thoroughfare" id="Customer_Address_Thoroughfare"> not what I want ofc. I would like an extension to render the label correctly (i.e. with the for="" attribute having the value of the input id), is there anything in MVC 2 that does this nativly before I go writing my own extension?

    Read the article

  • MVC UI with Mock Controllers?

    - by Jaimal Chohan
    I'm working with Aspnet MVC 2 (R2) and at the same time playing about with the whole alt.net stack. One of this things I would like to be able todo is basically write my Views, and be able to interact with them without having to write the controller logic. E.g. I have a view that displays a list of orders and I can click on an order which redirects to another view where I can edit it, but I don't want to get into the nitty gritty of writing the code to actually get a list of orders, or update an existing ordes. I want to do so I can write UI tests in WaitN/AOT/Selenium without having to worry about whats happening underneath, and also It would help drive my controller logic on a need basis as opposed to guess work based of of the supplied screenshots How do you guys accomplish this atm? Can you provide links ot useful blog posts/tools/framework/articles with information on how to accomplish this p.s. I primarly use Rhino Mocks & NUnit but can happliy change to other tools if they support the above better.

    Read the article

  • ModelState always valid

    - by Jaimal Chohan
    I've got something seemingly very simple not working. I have got a model public class Name: Entity { [StringLength(10), Required] public virtual string Title { get; set; } } public class Customer: Entity { public virtual Name Name { get; set; } } a view model public class CustomerViweModel { public Customer Customer { get; set; } } a view <% using(Html.BeginForm()) { %> <%= Html.LabelFor(m => m.Customer.Name.Title)%> <button type="submit">Submit</button> <% } %> and a controller [HttpPost] public ActionResult Index([Bind(Prefix = "Customer")] Customer customer) { if(ModelState.IsValid) Save else return View(); } No matter what I enter as the title (null, or a string 10 chars), ModelState.IsValid is always true. The Title field in the Customer object has a value, so the data is being passed around, but not being validated? Any clues?

    Read the article

  • [N]Hibernate Sessions

    - by Jaimal Chohan
    A silly question, perhaps, but at this time of night, StackOverFlow is my only friend. I'm playing with NHibernate and wanted to factualize these 2 statements regarding Sessions in web applications. 1) You should only ever have 1 ISessionFactory per database for the lifecycle of an application. 2) You should only have 1 ISession per HttpRequest or batch of HttpRequests (i.e. conversation) [I don't want tool or framework recommendation, just want to confirm the above]

    Read the article

  • Extension Methods - IsNull and IsNotNull, good or bad use?

    - by Jaimal Chohan
    I like readability. So, I came up with an extension mothod a few minutes ago for the (x =! null) type syntax, called IsNotNull. Inversly, I also created a IsNull extension method, thus if(x == null) becomes if(x.IsNull()) and if(x != null) becomes if(x.IsNotNull()) However, I'm worried I might be abusing extension methods. Do you think that this is bad use of Extenion methods?

    Read the article

1