public int SaveContacts(Entity.Sales.Contacts Model) { ContactsDbModel DbModel = new ContactsDbModel(); Model.CopyPropertiesTo(DbModel); return(ContactsDataAccess.SaveContacts(DbModel)); }
private void GetContactById() { Business.Sales.Contacts Obj = new Business.Sales.Contacts(); Entity.Sales.Contacts Contacts = Obj.GetContactById(ContactId); if (Contacts.Id != 0) { ddlDesignation.SelectedValue = Contacts.DesignationId == null ? "0" : Contacts.DesignationId.ToString(); ddlAccount.SelectedValue = Contacts.AccountId == null ? "0" : Contacts.AccountId.ToString(); txtDescription.Text = Contacts.Description; txtEmailId.Text = Contacts.Email; txtMobile.Text = Contacts.Mobile; txtgstNo.Text = Contacts.GSTNo.ToString(); txtName.Text = Contacts.Name; txtOfficePhone.Text = Contacts.OfficePhone; } }
private void Save() { if (ContactControlValidation()) { Business.Sales.Contacts Obj = new Business.Sales.Contacts(); Entity.Sales.Contacts Model = new Entity.Sales.Contacts { Id = ContactId, DesignationId = ddlDesignation.SelectedValue == "0" ? (int?)null : Convert.ToInt32(ddlDesignation.SelectedValue), AccountId = ddlAccount.SelectedValue == "0" ? (int?)null : Convert.ToInt32(ddlAccount.SelectedValue), CreatedBy = Convert.ToInt32(HttpContext.Current.User.Identity.Name), Description = txtDescription.Text, Name = txtName.Text, Email = txtEmailId.Text, Mobile = txtMobile.Text, GSTNo = txtgstNo.Text, OfficePhone = txtOfficePhone.Text, IsActive = true }; int rows = Obj.SaveContacts(Model); if (rows > 0) { ClearControls(); LoadContactList(); ContactId = 0; Message.IsSuccess = true; Message.Text = "Saved Successfully"; } else { Message.IsSuccess = false; Message.Text = "Unable to save data."; } Message.Show = true; } }
public Entity.Sales.Contacts GetContactById(int Id) { Entity.Sales.Contacts Contact = new Entity.Sales.Contacts(); ContactsDataAccess.GetContactById(Id).CopyPropertiesTo(Contact); return(Contact); }