Пример #1
0
        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)
            {
                ClearControl();
                int id      = Convert.ToInt32(row.Cells[1].Text.Trim());
                var details = new BKIC.SellingPoint.DTO.RequestResponseWrappers.MotorProductCover
                {
                    CoverId = id,
                    Type    = "delete"
                };

                var branchResult = service.PostData <BKIC.SellingPoint.DTO.RequestResponseWrappers.ApiResponseWrapper
                                                     <BKIC.SellingPoint.DTO.RequestResponseWrappers.MotorProductCoverResponse>,
                                                     BKIC.SellingPoint.DTO.RequestResponseWrappers.MotorProductCover>
                                       (BKIC.SellingPoint.DTO.Constants.AdminURI.MotorProductCoverOperation, details);

                if (branchResult.StatusCode == 200 && branchResult.Result.IsTransactionDone)
                {
                    LoadProductCover();
                    master.ShowErrorPopup("Motor cover deleted successfully", "Motor Cover");
                }
            }
        }
Пример #2
0
        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.MotorProductCover
                    {
                        CoverCode        = txtCoverCode.Text.Trim(),
                        CoverDescription = txtCoverDescription.Text.Trim(),
                        CoverAmount      = string.IsNullOrEmpty(txtCoverAmount.Text) ? decimal.Zero :
                                           Convert.ToDecimal(txtCoverAmount.Text),
                        Agency          = userInfo.Agency,
                        AgencyCode      = userInfo.AgentCode,
                        Mainclass       = MainClass,
                        SubClass        = ddlCover.SelectedItem.Value.Trim(),
                        IsOptionalCover = chkIsOptionalCover.Checked,
                        CoverType       = "Cover"
                    };

                    opertaion = (sender as Button).Text;
                    if (opertaion == "Update")
                    {
                        details.CoverId   = Convert.ToInt32(ViewState["CoverId"].ToString());
                        details.Type      = "edit";
                        details.UpdatedBy = "Admin";
                    }
                    else
                    {
                        details.Type      = "insert";
                        details.UpdatedBy = "";
                    }

                    var results = service.PostData <BKIC.SellingPoint.DTO.RequestResponseWrappers.ApiResponseWrapper
                                                    <BKIC.SellingPoint.DTO.RequestResponseWrappers.MotorProductCoverResponse>,
                                                    BKIC.SellingPoint.DTO.RequestResponseWrappers.MotorProductCover>
                                      (BKIC.SellingPoint.DTO.Constants.AdminURI.MotorProductCoverOperation, details);

                    if (results.StatusCode == 200 && results.Result.IsTransactionDone)
                    {
                        LoadProductCover();
                        ClearControl();
                        btnSubmit.Text = "Save";
                        if (details.Type == "insert")
                        {
                            master.ShowErrorPopup("Motor cover added successfully", "Motor Cover");
                        }
                        if (details.Type == "edit")
                        {
                            master.ShowErrorPopup("Motor cover updated successfully", "Motor Cover");
                        }
                    }
                    else
                    {
                        master.ShowErrorPopup(results.ErrorMessage, "Request Failed!");
                    }
                }
            }
            catch (Exception ex)
            {
                //throw ex;
            }
            finally
            {
                master.ShowLoading = false;
            }
        }
Пример #3
0
 //[ApiAuthorize(BKIC.SellingPont.DTO.Constants.Roles.SuperAdmin)]
 public RR.MotorProductCoverResponse MotorProductCoverOperation(RR.MotorProductCover request)
 {
     BLO.MotorProductCover         req    = _mapper.Map <RR.MotorProductCover, BLO.MotorProductCover>(request);
     BLO.MotorProductCoverResponse result = _adminRepository.MotorProductCoverOperation(req);
     return(_mapper.Map <BLO.MotorProductCoverResponse, RR.MotorProductCoverResponse>(result));
 }