示例#1
0
        private void BindGrid()
        {
            // ClaimData data = new ClaimData();
            DataSet ds = DataAccessFactory.CreateClaimData().GetClaimRecords(SessionHelper.Dastgah.DastgahCode, 0);

            if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                GridViewGharamtList.DataSource = ds;
                GridViewGharamtList.DataBind();
                GridViewGharamtList.UseAccessibleHeader    = true;
                GridViewGharamtList.HeaderRow.TableSection = TableRowSection.TableHeader;
            }
        }
 private void DoGharamtShow()
 {
     if (txtNationalCode.Text.Trim().Length > 0 && txtHadeseDate.Text.Trim().Length > 0)
     {
         // ClaimData data = new ClaimData();
         CLaimBenefitModel model = new CLaimBenefitModel
         {
             NationalCode = Convert.ToInt64(txtNationalCode.Text),
             Unitcode     = SessionHelper.Dastgah.DastgahCode,
             Year         = Convert.ToInt32(txtHadeseDate.Text.Substring(0, 4)),
             Death_Date   = Convert.ToString(txtHadeseDate.Text)
         };
         DataSet ds = DataAccessFactory.CreateClaimData().GetBaseBenefit(model);
         if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
         {
             int Reason = Convert.ToInt16(RdbChangeReason.SelectedItem.Value);
             if (Reason == 1)
             {
                 var P = Convert.ToInt32(ds.Tables[0].Rows[0]["MABLAGH"]);
                 lblShowMablagh.Text     = P.ToString("C");
                 Session["FinalMablagh"] = Convert.ToInt32(ds.Tables[0].Rows[0]["MABLAGH"]);
             }
             else
             {
                 int MSum = 0;
                 foreach (ListItem item in ListNaghsType.Items)
                 {
                     if (item.Selected)
                     {
                         MSum = Convert.ToInt32(item.Text.Substring(item.Text.IndexOf("%"), item.Text.IndexOf(")") - item.Text.IndexOf("%")).Replace(")", "").Replace("%", "")) + MSum;
                     }
                 }
                 if (MSum > 100)
                 {
                     MSum = 100;
                 }
                 var P1 = Convert.ToInt64(ds.Tables[0].Rows[0]["MABLAGH"]);
                 var p2 = (P1 * MSum) / 100;
                 Session["FinalMablagh"] = (int)p2;
                 lblShowMablagh.Text     = ((int)(p2)).ToString("C");
                 //"#,##0"
             }
             lblKhataShow.Text          = Convert.ToString(ds.Tables[0].Rows[0]["khata"]);
             Session["OriginalMablagh"] = Convert.ToInt32(ds.Tables[0].Rows[0]["MABLAGH"]);
             Session["Formid"]          = Convert.ToInt32(ds.Tables[0].Rows[0]["FormId"]);
         }
     }
 }
        private string SaveGharamat()
        {
            string SaveResault       = "";
            int    Death_Reason_Id   = 0;
            string DeathReson        = "";
            string DisableReason     = "";
            int    Disable_Reason_Id = 0;
            int    naqsozvitems      = 0;
            Int16  GharamatType;

            SessionHelper.NationalCode = Convert.ToInt64(txtNationalCode.Text);
            if (hidImage.Value.Trim() == "" || !hidImage.Value.StartsWith("data:image/"))
            {
                return("The pricture of Identity cart  has problem");
            }
            if (hidImage2.Value.Trim() == "" || !hidImage2.Value.StartsWith("data:image/"))
            {
                return("The picture of medical evidence  has problem");
            }
            if (Session["FinalMablagh"] == null || Session["OriginalMablagh"] == null)
            {
                if (Session["FormId"] == null)
                {
                    return("There is a problem in your contract");
                }
            }
            DataTable dt = new DataTable();

            dt.Columns.AddRange(new DataColumn[3] {
                new DataColumn("nationalcode", typeof(long)),
                new DataColumn("serial", typeof(Byte)),
                new DataColumn("DisableType_Code", typeof(int))
            });
            int Reason = Convert.ToInt16(RdbChangeReason.SelectedItem.Value);

            if (Reason == 1)
            {
                Death_Reason_Id   = Convert.ToInt32(DrdHadeseReason.SelectedItem.Value);;
                DeathReson        = Convert.ToString(DrdHadeseReason.SelectedItem.Text.Trim());
                DisableReason     = "";
                Disable_Reason_Id = 0;
                naqsozvitems      = 0;
                GharamatType      = 1;
            }
            else
            {
                Death_Reason_Id   = 0;
                DeathReson        = "";
                DisableReason     = Convert.ToString(DrdNaghType.SelectedItem.Text.Trim());
                Disable_Reason_Id = DrdNaghType.SelectedItem.Text.Trim() == "Desease" ? 1 : 2;

                int MSum = 0;
                foreach (ListItem item in ListNaghsType.Items)
                {
                    if (item.Selected)
                    {
                        MSum++;
                    }
                }
                naqsozvitems = MSum;
                GharamatType = 2;
                GetSelectedDisItems(dt);
            }
            try
            {
                var bytes  = Convert.FromBase64String(hidImage.Value.Substring(hidImage.Value.IndexOf(",") + 1));
                var bytes2 = Convert.FromBase64String(hidImage2.Value.Substring(hidImage2.Value.IndexOf(",") + 1));
                if (Convert.ToInt32(Session["FinalMablagh"]) > 0 && Convert.ToInt32(Session["OriginalMablagh"]) > 0)
                {
                    DataMangerClassLibrary.Models.ClaimModel model = new DataMangerClassLibrary.Models.ClaimModel
                    {
                        NationalCode          = SessionHelper.NationalCode,
                        UnitCode              = SessionHelper.Dastgah.DastgahCode,
                        AccsidentDate         = Convert.ToString(txtHadeseDate.Text.Replace("/", "").Trim()),
                        Death_Reason_Id       = Death_Reason_Id,
                        Elatefot              = DeathReson,
                        Elatenaqseozv         = DisableReason,
                        Disable_Reason_Id     = Disable_Reason_Id,
                        NaqsozvItems          = naqsozvitems,
                        GharamatValue         = Convert.ToInt32(Session["FinalMablagh"]),
                        OriginalGharamatValue = Convert.ToInt32(Session["OriginalMablagh"]),
                        AccountNo             = SessionHelper.Dastgah.AccountNumber,
                        BankName              = SessionHelper.Dastgah.BankName,
                        BankCode              = SessionHelper.Dastgah.Branch_Code,
                        RegUserId             = SessionHelper.Dastgah.DastgahCode,
                        FormId         = Convert.ToInt32(Session["FormId"]),
                        KartemeliImage = bytes,
                        GavahifotImage = bytes2,
                        GharamatType   = GharamatType,
                        DisableTable   = dt,
                        Mobiles        = Convert.ToString(txtMobile.Text)
                    };
                    // ClaimData savedata = new ClaimData();
                    SaveResault = DataAccessFactory.CreateClaimData().SubmitClaim(model);
                }
                else
                {
                    SaveResault = "There is a problem in benefit calculation";
                }
            }
            catch (Exception SaveError)
            {
                _logger.LogException(SaveError, txtNationalCode.Text, "1");
                SaveResault = "There is a problem in submiting";
                if (Trace.IsEnabled)
                {
                    Trace.Warn(SaveError.Message);
                }
            }
            return(SaveResault);
        }