public int AddUpdateClientAddresses(ClientAddresses model) { try { int i = 0; SqlParameter[] param = new SqlParameter[16]; param[0] = new SqlParameter("@CurrentID", model.Current_ID); param[1] = new SqlParameter("@ClientID", model.ClientID); param[2] = new SqlParameter("@CurrentAddressLine1", model.Current_AddressLine1); param[3] = new SqlParameter("@CurrentAddressLine2", model.Current_AddressLine2); param[4] = new SqlParameter("@CurrentCountryID", model.Current_CountryID); param[5] = new SqlParameter("@CurrentStateID", model.Current_StateID); param[6] = new SqlParameter("@CurrentCityID", model.Current_CityID); param[7] = new SqlParameter("@CurrentPinCode", model.Current_PinCode); param[8] = new SqlParameter("@CoresspondingID", model.Coressponding_ID); param[9] = new SqlParameter("@CoresspondingAddressLine1", model.Coressponding_AddressLine1); param[10] = new SqlParameter("@CoresspondingAddressLine2", model.Coressponding_AddressLine2); param[11] = new SqlParameter("@CoresspondingCountryID", model.Coressponding_CountryID); param[12] = new SqlParameter("@CoresspondingStateID", model.Coressponding_StateID); param[13] = new SqlParameter("@CoresspondingCityID", model.Coressponding_CityID); param[14] = new SqlParameter("@CoresspondingPinCode", model.Coressponding_PinCode); param[15] = new SqlParameter("@UserID", GetUserID()); //param[15] = new SqlParameter("@UserID", Convert.ToInt32(GetUserID("RoleID"))); i = new ADODataFunction().ExecuteNonQuery(Constants.Procedures.AddUpdateClientAddresses, param, CommandType.StoredProcedure); return(i); } catch (Exception ex) { return(0); } }
private static int GetShippersId(Guid cid, string name, string city, string state, string zip) { using (ClientsDataClassesDataContext clientdb = new ClientsDataClassesDataContext()) { int id = (from a in clientdb.ClientAddresses where a.Name == name select a.ClientAddressesId).FirstOrDefault(); if (id != 0) { return(id); } else if (name != null) { //create the address and return the id ClientAddresses address = new ClientAddresses { ClientsId = cid, Name = name, City = city, State = state, ZipCode = zip, Active = true, Type = "Shipper" }; clientdb.ClientAddresses.InsertOnSubmit(address); clientdb.SubmitChanges(); return(address.ClientAddressesId); } } return(0); }
public static ClientAddresses GetClientsAddresses(int clientId) { ClientAddresses clientAddresses = null; Dictionary <string, string> param = new Dictionary <string, string>(); param.Add(RequestFields.ACTION, Actions.GET); param.Add(RequestFields.CLIENT, clientId.ToString()); SendGetRequest <ClientAddresses>(UriPostfix.CLIENTS_ADDRESSES, param, out clientAddresses); return(clientAddresses); }
public ClientMainViewModel() { ClientDetails = new ClientMain(); AddressDetails = new ClientAddresses(); BankDetails = new ClientBankDetails(); DepositryDetails = new ClientDepositoryDetails(); EquityBrokerDetails = new ClientEquityBrokerDetails(); PersonalDetails = new ClientPersonal(); SecondaryContactDetails = new ClientSecondaryContact(); MappingDetails = new ClientMapping(); }
public ClientAddresses GetAddressData(long ID) { try { DataSet data = new DataSet(); SqlParameter[] param = new SqlParameter[1]; param[0] = new SqlParameter("@ID", ID); data = new ADODataFunction().ExecuteDataset("Admin_GetClientAddressesByID", param, CommandType.StoredProcedure); ClientAddresses addresses = data.Tables[0].AsEnumerable().Select(a => new ClientAddresses { Current_AddressLine1 = a.Field <string>("CurrentAddressLine1") , Current_AddressLine2 = a.Field <string>("CurrentAddressLine2") , Current_CountryID = a.Field <long>("CurrentCountryID") , Current_StateID = a.Field <long>("CurrentStateID") , Current_CityID = a.Field <long>("CurrentCityID") , Current_PinCode = a.Field <long>("CurrentPinCode") , Current_ID = a.Field <long>("CurrentID") , Coressponding_AddressLine1 = a.Field <string>("CorrespondingAddressLine1") , Coressponding_AddressLine2 = a.Field <string>("CorrespondingAddressLine2") , Coressponding_CountryID = a.Field <long>("CorrespondingCountryID") , Coressponding_StateID = a.Field <long>("CorrespondingStateID") , Coressponding_CityID = a.Field <long>("CorrespondingCityID") , Coressponding_PinCode = a.Field <long>("CorrespondingPinCode") , Coressponding_ID = a.Field <long>("CorrespondingID") , ClientID = a.Field <long>("ClientID") }).FirstOrDefault(); return(addresses); } catch (Exception ex) { return(null); } }