protected void lnkbtnDelete_Click(object sender, EventArgs e)
        {
            master.IsSessionAvailable();
            var userInfo = CommonMethods.GetUserDetails();
            var service  = CommonMethods.GetLogedInService();

            using (GridViewRow row = (GridViewRow)((LinkButton)sender).Parent.Parent)
            {
                int id      = Convert.ToInt32(row.Cells[1].Text.Trim());
                var details = new BKIC.SellingPoint.DTO.RequestResponseWrappers.MotorEngineCCMaster
                {
                    ID   = id,
                    Type = "delete"
                };

                var vehicleResult = service.PostData <BKIC.SellingPoint.DTO.RequestResponseWrappers.ApiResponseWrapper
                                                      <BKIC.SellingPoint.DTO.RequestResponseWrappers.MotorEngineCCResponse>,
                                                      BKIC.SellingPoint.DTO.RequestResponseWrappers.MotorEngineCCMaster>
                                        (BKIC.SellingPoint.DTO.Constants.AdminURI.MotorEngineCCOperation, details);

                if (vehicleResult.StatusCode == 200 && vehicleResult.Result.IsTransactionDone)
                {
                    LoadVehicle(userInfo, service);
                    master.ShowErrorPopup("Motor vehicle deleted successfully", "Motor Vehicle");
                }
            }
        }
Пример #2
0
 public RR.MotorEngineCCResponse MotorProductMasterOperation(RR.MotorEngineCCMaster request)
 {
     try
     {
         BLO.MotorEngineCCMaster   req    = _mapper.Map <RR.MotorEngineCCMaster, BLO.MotorEngineCCMaster>(request);
         BLO.MotorEngineCCResponse result = _adminRepository.MotorEngineCCOperation(req);
         return(_mapper.Map <BLO.MotorEngineCCResponse, RR.MotorEngineCCResponse>(result));
     }
     catch (Exception ex)
     {
         return(new RR.MotorEngineCCResponse
         {
             IsTransactionDone = false,
             TransactionErrorMessage = ex.Message
         });
     }
 }
        private void LoadVehicle(OAuthTokenResponse userInfo, DataServiceManager service)
        {
            var request = new BKIC.SellingPoint.DTO.RequestResponseWrappers.MotorEngineCCMaster
            {
                Type = "fetch"
            };
            var results = service.PostData <BKIC.SellingPoint.DTO.RequestResponseWrappers.ApiResponseWrapper
                                            <BKIC.SellingPoint.DTO.RequestResponseWrappers.MotorEngineCCResponse>,
                                            BKIC.SellingPoint.DTO.RequestResponseWrappers.MotorEngineCCMaster>
                              (BKIC.SellingPoint.DTO.Constants.AdminURI.MotorEngineCCOperation, request);

            if (results.StatusCode == 200 && results.Result.IsTransactionDone)
            {
                gvMotorEngineCC.DataSource = results.Result.MotorEngineCC;
                gvMotorEngineCC.DataBind();
            }
        }
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                if (Page.IsValid)
                {
                    string opertaion = string.Empty;

                    master.IsSessionAvailable();
                    var userInfo = CommonMethods.GetUserDetails();
                    var service  = CommonMethods.GetLogedInService();

                    var details = new BKIC.SellingPoint.DTO.RequestResponseWrappers.MotorEngineCCMaster
                    {
                        Tonnage  = Convert.ToInt32(txtEngineCC.Text.Trim()),
                        Capacity = txtEngineCC.Text.Trim() + "CC"
                    };

                    opertaion = (sender as Button).Text;

                    if (opertaion == "Update")
                    {
                        details.ID   = Convert.ToInt32(ViewState["Id"].ToString());
                        details.Type = "update";
                    }
                    else
                    {
                        details.Type = "insert";
                    }

                    var results = service.PostData <BKIC.SellingPoint.DTO.RequestResponseWrappers.ApiResponseWrapper
                                                    <BKIC.SellingPoint.DTO.RequestResponseWrappers.MotorEngineCCResponse>,
                                                    BKIC.SellingPoint.DTO.RequestResponseWrappers.MotorEngineCCMaster>
                                      (BKIC.SellingPoint.DTO.Constants.AdminURI.MotorEngineCCOperation, details);

                    if (results.StatusCode == 200 && results.Result.IsTransactionDone)
                    {
                        btnSubmit.Text = "Save";
                        if (details.Type == "insert")
                        {
                            master.ShowErrorPopup("Motor Engine CC added successfully", "Motor EngineCC");
                        }
                        if (details.Type == "Update")
                        {
                            master.ShowErrorPopup("Motor Engine CC updated successfully", "Motor EngineCC");
                        }
                        LoadVehicle(userInfo, service);
                    }
                    else
                    {
                        master.ShowErrorPopup(results.ErrorMessage, "Request Failed!");
                    }
                }
            }
            catch (Exception ex)
            {
                //throw ex;
            }
            finally
            {
                master.ShowLoading = false;
            }
        }