private void Save() { if (CallStatusControlValidation()) { Business.Sales.CallStatus Obj = new Business.Sales.CallStatus(); Entity.Sales.CallStatus Model = new Entity.Sales.CallStatus { Id = CallStatusId, Name = txtName.Text, Description = txtDescription.Text, }; int rows = Obj.SaveCallStatus(Model); if (rows > 0) { ClearControls(); LoadCallStatusList(); CallStatusId = 0; Message.IsSuccess = true; Message.Text = "Saved Successfully"; } else { Message.IsSuccess = false; Message.Text = "Unable to save data."; } Message.Show = true; } }
private void GetCallStatusById() { Business.Sales.CallStatus Obj = new Business.Sales.CallStatus(); Entity.Sales.CallStatus callstatus = Obj.GetCallStatusById(CallStatusId); if (callstatus.Id != 0) { txtDescription.Text = callstatus.Description; txtName.Text = callstatus.Name; } }
protected void gvCallStatus_RowCommand(object sender, GridViewCommandEventArgs e) { try { if (e.CommandName == "Ed") { CallStatusId = Convert.ToInt32(e.CommandArgument.ToString()); GetCallStatusById(); Message.Show = false; btnSave.Text = "Update"; } else if (e.CommandName == "Del") { Business.Sales.CallStatus Obj = new Business.Sales.CallStatus(); int rows = Obj.DeleteCallStatus(Convert.ToInt32(e.CommandArgument.ToString())); if (rows > 0) { ClearControls(); LoadCallStatusList(); Message.IsSuccess = true; Message.Text = "Deleted Successfully"; } else { Message.IsSuccess = false; Message.Text = "Data Dependency Exists"; } Message.Show = true; } } catch (Exception ex) { ex.WriteException(); Message.IsSuccess = false; Message.Text = ex.Message; Message.Show = true; } }
private void LoadCallStatusList() { Business.Sales.CallStatus Obj = new Business.Sales.CallStatus(); gvCallStatus.DataSource = Obj.GetAllCallStatus(); gvCallStatus.DataBind(); }