コード例 #1
0
        protected void dgMaintenanceRequestDetail_ItemCommand(object source, DataGridCommandEventArgs e)
        {
            if (e.CommandName == "AddNew")
            {
                try
                {
                    MaintenanceRequestDetail Detail         = new MaintenanceRequestDetail();
                    DropDownList             ddlFServiceTpe = e.Item.FindControl("ddlFServiceTpe") as DropDownList;
                    Detail.ServiceType = _presenter.GetServiceType(int.Parse(ddlFServiceTpe.SelectedValue));
                    DropDownList ddlFServiceTypeDetail = e.Item.FindControl("ddlServiceTypeDet") as DropDownList;
                    Detail.DriverServiceTypeDetail = _presenter.GetServiceTypeDetail(int.Parse(ddlFServiceTypeDetail.SelectedValue));
                    _presenter.CurrentMaintenanceRequest.MaintenanceRequestDetails.Add(Detail);
                    Master.ShowMessage(new AppMessage("Maintenance Request Detail added successfully.", RMessageType.Info));
                    dgMaintenanceRequestDetail.EditItemIndex = -1;

                    BindMaintenanceRequestDetails();
                }
                catch (Exception ex)
                {
                    Master.ShowMessage(new AppMessage("Error: Unable to Add Maintenance Request Detail. " + ex.Message, RMessageType.Error));
                    ExceptionUtility.LogException(ex, ex.Source);
                    ExceptionUtility.NotifySystemOps(ex, _presenter.CurrentUser().FullName);
                }
            }
        }
コード例 #2
0
        protected void dgMaintenanceRequestDetail_ItemCommand(object source, DataGridCommandEventArgs e)
        {
            if (e.CommandName == "AddNew")
            {
                try
                {
                    MaintenanceRequestDetail Detail         = new MaintenanceRequestDetail();
                    DropDownList             ddlFServiceTpe = e.Item.FindControl("ddlFServiceTpe") as DropDownList;

                    Detail.ServiceType = _presenter.GetServiceType(int.Parse(ddlFServiceTpe.SelectedValue));
                    DropDownList ddlFServiceTypeDetail = e.Item.FindControl("ddlMecServiceTypeDet") as DropDownList;
                    Detail.MechanicServiceTypeDetail = _presenter.GetServiceTypeDetail(int.Parse(ddlFServiceTypeDetail.SelectedValue));
                    //DropDownList ddlFMeServiceTypeDetail = e.Item.FindControl("ddlMeServiceTypeDet") as DropDownList;
                    //Detail.MechanicServiceType = _presenter.GetServiceTypeDetail(int.Parse(ddlFMeServiceTypeDetail.SelectedValue));
                    //TextBox txtFRemark = e.Item.FindControl("txtFRemark") as TextBox;
                    //Detail.TechnicianRemark = txtFRemark.Text;

                    // cprd.MaintenanceRequest = _presenter.CurrentMaintenanceRequest;
                    TextBox txtEdtTechRemark = e.Item.FindControl("txtFRemark") as TextBox;
                    Detail.TechnicianRemark = txtEdtTechRemark.Text;

                    _presenter.CurrentMaintenanceRequest.MaintenanceRequestDetails.Add(Detail);
                    _presenter.SaveOrUpdateMaintenanceRequest(_presenter.CurrentMaintenanceRequest);
                    Master.ShowMessage(new AppMessage("Maintenance Request Detail added successfully.", RMessageType.Info));
                    dgMaintenanceRequestDetail.EditItemIndex = -1;
                    dgMaintenanceRequestDetail.DataSource    = _presenter.CurrentMaintenanceRequest.MaintenanceRequestDetails;
                    dgMaintenanceRequestDetail.DataBind();
                    ScriptManager.RegisterStartupScript(this, GetType(), "showMechanicDetail", "showMechanicDetail();", true);
                }
                catch (Exception ex)
                {
                    Master.ShowMessage(new AppMessage("Error: Unable to  Add Car Maintenance Detail. " + ex.Message, RMessageType.Error));
                    ExceptionUtility.LogException(ex, ex.Source);
                    ExceptionUtility.NotifySystemOps(ex, _presenter.CurrentUser().FullName);
                }
            }
        }
コード例 #3
0
 public void DeleteMaintenanceRequestDetail(MaintenanceRequestDetail MaintenanceRequestDetail)
 {
     _controller.DeleteEntity(MaintenanceRequestDetail);
 }