Ejemplo n.º 1
0
 //  [ApiAuthorize(BKIC.SellingPont.DTO.Constants.Roles.SuperAdmin)]
 public RR.CategoryMasterResponse CategoryMasterOperation(RR.CategoryMaster request)
 {
     try
     {
         BLO.CategoryMaster         req    = _mapper.Map <RR.CategoryMaster, BLO.CategoryMaster>(request);
         BLO.CategoryMasterResponse result = _adminRepository.CategoryOperation(req);
         return(_mapper.Map <BLO.CategoryMasterResponse, RR.CategoryMasterResponse>(result));
     }
     catch (Exception ex)
     {
         return(new RR.CategoryMasterResponse
         {
             IsTransactionDone = false,
             TransactionErrorMessage = ex.Message
         });
     }
 }
        public void LoadCategoryData(OAuthTokenResponse userInfo, DataServiceManager service)
        {
            BKIC.SellingPoint.DTO.RequestResponseWrappers.CategoryMaster categoryReq = new BKIC.SellingPoint.DTO.RequestResponseWrappers.CategoryMaster();
            categoryReq.Type = "fetch";

            var response = service.PostData <BKIC.SellingPoint.DTO.RequestResponseWrappers.ApiResponseWrapper
                                             <BKIC.SellingPoint.DTO.RequestResponseWrappers.CategoryMasterResponse>,
                                             BKIC.SellingPoint.DTO.RequestResponseWrappers.CategoryMaster>
                               (BKIC.SellingPoint.DTO.Constants.AdminURI.CategoryMasterOperation, categoryReq);

            if (response.StatusCode == 200 && response.Result.IsTransactionDone)
            {
                //gvCategoryMaster.DataSource = response.Result.Categories;
                //gvCategoryMaster.DataBind();
            }
            else
            {
                master.ShowErrorPopup("Commission data loaded failed", "COMMISSION");
            }
        }
Ejemplo n.º 3
0
        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();

                    BKIC.SellingPoint.DTO.RequestResponseWrappers.CategoryMaster categoryReq = new BKIC.SellingPoint.DTO.RequestResponseWrappers.CategoryMaster();

                    int id = Convert.ToInt32(row.Cells[1].Text.Trim());
                    categoryReq.id   = id;
                    categoryReq.Type = "delete";

                    var categoryResponse = service.PostData <BKIC.SellingPoint.DTO.RequestResponseWrappers.ApiResponseWrapper
                                                             <BKIC.SellingPoint.DTO.RequestResponseWrappers.CategoryMasterResponse>,
                                                             BKIC.SellingPoint.DTO.RequestResponseWrappers.CategoryMaster>
                                               (BKIC.SellingPoint.DTO.Constants.AdminURI.CategoryMasterOperation, categoryReq);
                    if (categoryResponse.StatusCode == 200 && categoryResponse.Result.IsTransactionDone)
                    {
                        LoadCategoryData(userInfo, service);
                        ClearControl();
                        master.ShowErrorPopup("Commission data deleted successfully", "Commission");
                        btnSubmit.Text = "Save";
                    }
                }
            }
            catch (Exception ex)
            {
                ////throw ex;
            }
            finally
            {
                master.ShowLoading = false;
            }
        }
        protected void lnkbtnCategoryDelete_Click(object sender, EventArgs e)
        {
            try
            {
                using (GridViewRow row = (GridViewRow)((LinkButton)sender).Parent.Parent)
                {
                    master.IsSessionAvailable();
                    var userInfo = CommonMethods.GetUserDetails();
                    var service  = CommonMethods.GetLogedInService();

                    int id = Convert.ToInt32(HttpUtility.HtmlDecode(row.Cells[1].Text.Trim()));

                    var details = new BKIC.SellingPoint.DTO.RequestResponseWrappers.CategoryMaster();
                    details.id   = id;
                    details.Type = "delete";

                    var categoryResult = service.PostData <BKIC.SellingPoint.DTO.RequestResponseWrappers
                                                           .ApiResponseWrapper <BKIC.SellingPoint.DTO.RequestResponseWrappers.CategoryMasterResponse>,
                                                           BKIC.SellingPoint.DTO.RequestResponseWrappers.CategoryMaster>
                                             (BKIC.SellingPoint.DTO.Constants.AdminURI.CategoryMasterOperation, details);

                    if (categoryResult.StatusCode == 200 && categoryResult.Result.IsTransactionDone)
                    {
                        LoadCategoryData(userInfo, service);
                    }
                }
            }
            catch (Exception ex)
            {
                ////throw ex;
            }
            finally
            {
                master.ShowLoading = false;
            }
        }
Ejemplo n.º 5
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.CategoryMaster();

                    details.Agency    = txtAgency.Text.Trim();
                    details.AgentCode = txtAgentCode.Text.Trim();
                    details.Category  = txtCategory.Text.Trim();
                    details.Code      = txtCode.Text.Trim();
                    details.MainClass = txtMainclass.Text.Trim();
                    details.SubClass  = txtSubClass.Text.Trim();
                    details.ValueType = txtValueType.Text.Trim();
                    details.Value     = Convert.ToDecimal(txtValue.Text);
                    details.Status    = true;

                    opertaion = (sender as Button).Text;

                    if (opertaion == "Update")
                    {
                        details.id   = Convert.ToInt32(ViewState["CategoryId"].ToString());
                        details.Type = "edit";
                    }
                    else
                    {
                        details.Type = "insert";
                    }

                    var results = service.PostData <BKIC.SellingPoint.DTO.RequestResponseWrappers.ApiResponseWrapper
                                                    <BKIC.SellingPoint.DTO.RequestResponseWrappers.CategoryMasterResponse>,
                                                    BKIC.SellingPoint.DTO.RequestResponseWrappers.CategoryMaster>
                                      (BKIC.SellingPoint.DTO.Constants.AdminURI.CategoryMasterOperation, details);

                    if (results.StatusCode == 200 && results.Result.IsTransactionDone)
                    {
                        LoadCategoryData(userInfo, service);
                        ClearControl();
                        if (details.Type == "insert")
                        {
                            master.ShowErrorPopup("Commission details saved sucessfully", "Commission");
                        }
                        else
                        {
                            master.ShowErrorPopup("Commission details updated sucessfully", "Commission");
                        }

                        btnSubmit.Text = "Save";
                    }
                }
            }
            catch (Exception ex)
            {
                ////throw ex;
            }
            finally
            {
                master.ShowLoading = false;
            }
        }