Example #1
0
 //[ApiAuthorize(BKIC.SellingPont.DTO.Constants.Roles.SuperAdmin, BKIC.SellingPont.DTO.Constants.Roles.BranchAdmin)]
 //[ApiAuthorize(BKIC.SellingPont.DTO.Constants.Roles.SuperAdmin)]
 public RR.AgentMasterResponse AgentOperation(RR.AgentMaster request)
 {
     try
     {
         BLO.AgentMaster         req    = _mapper.Map <RR.AgentMaster, BLO.AgentMaster>(request);
         BLO.AgentMasterResponse result = _adminRepository.AgentOperation(req);
         return(_mapper.Map <BLO.AgentMasterResponse, RR.AgentMasterResponse>(result));
     }
     catch (Exception ex)
     {
         return(new RR.AgentMasterResponse
         {
             IsTransactionDone = false,
             TransactionErrorMessage = ex.Message
         });
     }
 }
        protected void lnkbtnDelete_Click(object sender, EventArgs e)
        {
            try
            {
                using (GridViewRow row = (GridViewRow)((LinkButton)sender).Parent.Parent)
                {
                    master.IsSessionAvailable();
                    var userInfo = CommonMethods.GetUserDetails();
                    var service  = CommonMethods.GetLogedInService();

                    var details = new BKIC.SellingPoint.DTO.RequestResponseWrappers.AgentMaster();
                    int id      = Convert.ToInt32(HttpUtility.HtmlDecode(row.Cells[1].Text.Trim()));

                    details.Id   = id;
                    details.Type = "delete";

                    var agentResult = service.PostData <BKIC.SellingPoint.DTO.RequestResponseWrappers.ApiResponseWrapper
                                                        <BKIC.SellingPoint.DTO.RequestResponseWrappers.AgentMasterResponse>,
                                                        BKIC.SellingPoint.DTO.RequestResponseWrappers.AgentMaster>
                                          (BKIC.SellingPoint.DTO.Constants.AdminURI.AgentOperation, details);
                    if (agentResult.StatusCode == 200 && agentResult.Result.IsTransactionDone)
                    {
                        LoadAgentData(userInfo, service);
                        ClearControl();
                        master.ShowErrorPopup("Agent data deleted successfully", "Agent");
                        btnSubmit.Text = "Save";
                    }
                }
            }
            catch (Exception ex)
            {
                ////throw ex;
            }
            finally
            {
                master.ShowLoading = false;
            }
        }