protected void dgServiceTypeDetail_ItemCommand(object source, DataGridCommandEventArgs e)
        {
            if (e.CommandName == "AddNew")
            {
                try
                {
                    ServiceTypeDetail stDetail = new ServiceTypeDetail();
                    TextBox           txtFDesc = e.Item.FindControl("txtFDesc") as TextBox;
                    stDetail.Description = txtFDesc.Text;
                    CheckBox ckFStatus = e.Item.FindControl("ckFStatus") as CheckBox;
                    stDetail.Status      = ckFStatus.Checked;
                    stDetail.ServiceType = _serviceType;

                    _serviceType.ServiceTypeDetails.Add(stDetail);
                    _presenter.SaveOrUpdateServiceType(_serviceType);
                    Master.ShowMessage(new AppMessage("Service Type Detail Added Successfully.", RMessageType.Info));
                    dgServiceTypeDetail.EditItemIndex = -1;
                    BindServiceTypeDetails();
                    ScriptManager.RegisterStartupScript(this, GetType(), "showDetailModal", "showDetailModal();", true);
                }
                catch (Exception ex)
                {
                    Master.ShowMessage(new AppMessage("Error: Unable to Add Service Type Detail. " + ex.Message, RMessageType.Error));
                    ExceptionUtility.LogException(ex, ex.Source);
                    ExceptionUtility.NotifySystemOps(ex, _presenter.CurrentUser().FullName);
                }
            }
        }
        protected void dgServiceTypeDetail_UpdateCommand(object source, DataGridCommandEventArgs e)
        {
            int id = (int)dgServiceTypeDetail.DataKeys[e.Item.ItemIndex];
            ServiceTypeDetail stDetail = _serviceType.GetServiceTypeDetail(id);

            try
            {
                TextBox txtEdtDesc = e.Item.FindControl("txtEdtDesc") as TextBox;
                stDetail.Description = txtEdtDesc.Text;
                CheckBox ckEdtStatus = e.Item.FindControl("ckEdtStatus") as CheckBox;
                stDetail.Status = ckEdtStatus.Checked;

                _presenter.SaveOrUpdateServiceType(_serviceType);
                Master.ShowMessage(new AppMessage("Service Type Detail Updated Successfully.", RMessageType.Info));
                dgServiceTypeDetail.EditItemIndex = -1;
                BindServiceTypeDetails();
                ScriptManager.RegisterStartupScript(this, GetType(), "showDetailModal", "showDetailModal();", true);
            }
            catch (Exception ex)
            {
                Master.ShowMessage(new AppMessage("Error: Unable to Update Service Type Detail . " + ex.Message, RMessageType.Error));
                ExceptionUtility.LogException(ex, ex.Source);
                ExceptionUtility.NotifySystemOps(ex, _presenter.CurrentUser().FullName);
            }
        }
Example #3
0
 public void DeleteServiceTypeDetail(ServiceTypeDetail serviceTypeDetail)
 {
     _controller.DeleteEntity(serviceTypeDetail);
 }