wcf - Running several update stored procedures in C# code -


i have rest wcf service depend on pass update method going update column. example can update addresses, phone numbers, emails,...

each of these updates run own stored procedure update. not sure if code ok problem happened when 2 users try update email address @ exact same time, updates second user email address 1st user.

public model.returnresponse updatecustomerprofile(model.customer customerdata)     {   model.customer customer = getcustomerinfo.instance.returncustomerinfo();         model.returnresponse rs = new model.returnresponse();               dal.datamanager dal = new dal.datamanager();                   foreach (var pr in customerdata.gettype().getproperties())                 {                      string name = pr.name;                     object temp = pr.getvalue(customerdata, null);                       if (temp int)                     {                         int value = (int)temp;                         if (value != 0)                         {                             string prname = pr.name;                             break;                          }                      }                      if (temp string)                     {                         if (temp != null)                         {                             string prname = pr.name;                             if (prname == "workphone")                             {                                 dal.update_customerphone(customer.customer_id, temp.tostring(), "work");                             }                             if (prname =="homephone")                             {                                 dal.update_customerphone(customer.customer_id, temp.tostring(), "home");                             }                             if (prname =="mobilephone")                             {                                 dal.update_customerphone(customer.customer_id, temp.tostring(), "mobile");                             }                             if (prname == "faxphone")                             {                                 dal.update_customerphone(customer.customer_id, temp.tostring(), "fax");                             }                              if (prname == "primaryemail")                             {                                     dal.update_customer_email(customer.customer_id, temp.tostring(), "primary");                                 }                             }                              if (prname == "secondaryemail")                             {                                                                         dal.update_customer_email(customer.customer_id, temp.tostring(), "secondary");                                 }                             }                              //mailing adress                             if (prname == "mailingaddressaddress_1")                             {                                 dal.update_customeraddress(customer.customer_id, temp.tostring(), null, null, "str_cp_mailing");                             }                              if (prname == "mailingaddressaddress_2")                             {                                 dal.update_customeraddress(customer.customer_id, null, temp.tostring(), null, null, null,"str_cp_mailing");                             }                              if (prname == "str_cp_mailingaddresscity")                             {                                 dal.update_customeraddress(customer.customer_id, null, null, temp.tostring(), null, null, "cp_mailing");                             }                            }                     }                     if (temp bool)                      {                            string prname = pr.name;                              if (prname == "onlineagreement")                            {                                bool online_agreement = dal.get_online_agreement_bycustomerid(customer.customer_id);                                 if (online_agreement != convert.toboolean(temp))                                {                                     dal.update_customer_online_agreement(customer.customer_id, convert.toboolean(temp));                                }                            }                    }               }       } 

your code ever updates customer_id obtained getcustomerinfo.instance.returncustomerinfo(), opposed using customer_id passed customerdata in parameter. how "getcustomerinfo.instance.returncustomerinfo()" know customer matches passed? looks code update same user, regardless of user information passed routine.


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -