public static string WMSaveRequestHead(object objAdr, string State) { string result = ""; CustomProfile profile = CustomProfile.GetProfile(); iUCCommonFilterClient UCCommonFilter = new iUCCommonFilterClient(); tAddress Adrs = new tAddress(); try { Dictionary <string, object> dictionary = new Dictionary <string, object>(); dictionary = (Dictionary <string, object>)objAdr; Adrs.AddressLine1 = dictionary["AddressLine1"].ToString(); Adrs.City = dictionary["City"].ToString(); Adrs.County = "Qatar"; Adrs.State = dictionary["State"].ToString(); if (State == "Edit") { Adrs.ID = Convert.ToInt64(HttpContext.Current.Session["ConID"].ToString()); Adrs.LastModifiedBy = profile.Personal.UserID.ToString(); Adrs.LastModifiedDate = DateTime.Now; UCCommonFilter.EditAddress(Adrs, profile.DBConnection._constr); } else { long DID = Convert.ToInt64(HttpContext.Current.Session["DeptID"].ToString()); long CompanyID = UCCommonFilter.GetCompanyIDFromSiteID(DID, profile.DBConnection._constr); Adrs.ObjectName = "Account"; Adrs.ReferenceID = DID; Adrs.RouteID = CompanyID; Adrs.CompanyID = CompanyID; Adrs.Sequence = 1; Adrs.AddressType = "none"; Adrs.IsDefault = "N"; Adrs.Active = "Y";//Set Active Y N Adrs.CreatedBy = profile.Personal.UserID.ToString(); Adrs.CreationDate = DateTime.Now; UCCommonFilter.AddIntotAddress(Adrs, profile.DBConnection._constr); } result = "Address saved successfully"; } catch { result = "Some error occurred"; } finally { UCCommonFilter.Close(); } return(result); }