private void LoadVehicle(OAuthTokenResponse userInfo, DataServiceManager service)
        {
            var request = new BKIC.SellingPoint.DTO.RequestResponseWrappers.MotorYearMaster
            {
                Type = "fetch"
            };
            var results = service.PostData <BKIC.SellingPoint.DTO.RequestResponseWrappers.ApiResponseWrapper
                                            <BKIC.SellingPoint.DTO.RequestResponseWrappers.MotorYearMasterResponse>,
                                            BKIC.SellingPoint.DTO.RequestResponseWrappers.MotorYearMaster>
                              (BKIC.SellingPoint.DTO.Constants.AdminURI.MotorYearOperation, request);

            if (results.StatusCode == 200 && results.Result.IsTransactionDone)
            {
                gvMotorYear.DataSource = results.Result.MotorYears;
                gvMotorYear.DataBind();
            }
        }
示例#2
0
 public RR.MotorYearMasterResponse MotorYearOperation(RR.MotorYearMaster request)
 {
     try
     {
         BLO.MotorYearMaster         req    = _mapper.Map <RR.MotorYearMaster, BLO.MotorYearMaster>(request);
         BLO.MotorYearMasterResponse result = _adminRepository.MotorYearMasterOperation(req);
         return(_mapper.Map <BLO.MotorYearMasterResponse, RR.MotorYearMasterResponse>(result));
     }
     catch (Exception ex)
     {
         return(new RR.MotorYearMasterResponse
         {
             IsTransactionDone = false,
             TransactionErrorMessage = ex.Message
         });
     }
 }
        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.MotorYearMaster
                    {
                        Year = Convert.ToInt32(txtManufacturarYear.Text.Trim())
                    };
                    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.MotorYearMasterResponse>,
                                                    BKIC.SellingPoint.DTO.RequestResponseWrappers.MotorYearMaster>
                                      (BKIC.SellingPoint.DTO.Constants.AdminURI.MotorYearOperation, details);

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