Пример #1
0
        protected void btn_submit_Click(object sender, EventArgs e)
        {
            try
            {
                using (var db = new THFinanceEntities())
                {
                    tbl_PaymentType tbl = new tbl_PaymentType();

                    var q = (from s in db.tbl_PaymentType
                             select s).ToList();
                    tbl.paymentBorrowerId = Convert.ToInt32(ddl_paymentborrwer.SelectedValue);
                    tbl.PaymentDate       = Convert.ToDateTime(txt_startdate.Value);
                    tbl.PaymentType       = txt_PaymentType.Value;
                    tbl.PaymentAmount     = Convert.ToInt32(txt_PaymentAmount.Text);
                    tbl.givenamount       = txt_givenAmount.Text;
                    tbl.paymentmethod     = Convert.ToInt32(ddl_chitti.SelectedValue);
                    tbl.monthlyInterest   = txt_monthlypayment.Text;

                    if (q.Count == 0)
                    {
                        db.tbl_PaymentType.Add(tbl);
                        db.SaveChanges();
                        Response.Write("<script>alert('Sucessfully saved')</script>");
                        loadgrid();
                        clearfields();
                        return;
                    }
                    else
                    {
                        for (int i = 0; i < q.Count; i++)
                        {
                            var present = tbl.paymentBorrowerId;
                            var prev    = q[i].paymentBorrowerId;
                            if (present == prev)
                            {
                                Response.Write("<script>alert('Borrower already exist')</script>");
                                return;
                            }
                        }
                    }

                    db.tbl_PaymentType.Add(tbl);
                    db.SaveChanges();
                    Response.Write("<script>alert('Sucessfully saved')</script>");
                    clearfields();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #2
0
        protected void btn_signup_Click(object sender, EventArgs e)
        {
            entity = new THFinanceEntities();
            THF_User obj = new THF_User();
            //string filePath = txt_uploadimage.PostedFile.FileName;

            //string filename = Path.GetFileName(filePath);


            //string strname = txt_uploadimage.Value.ToString();

            Stream fs = txt_uploadimage.PostedFile.InputStream;

            BinaryReader br = new BinaryReader(fs);

            Byte[] bytes = br.ReadBytes((Int32)fs.Length);


            //txt_uploadimage.PostedFile.SaveAs(Server.MapPath("~/Uploads/") + strname);
            obj.UserName         = txt_UserName.Value;
            obj.UserEmail        = txt_UserEmail.Value;
            obj.UserPassword     = txt_UserPassword.Value;
            obj.UserProfessional = txt_UserProfessional.Value;
            obj.imagesave        = bytes;
            entity.THF_User.Add(obj);
            entity.SaveChanges();
            Response.Write("<script type=\"text/javascript\">alert('Sucessfully Created');</script>");
        }
Пример #3
0
 protected void btn_submit_Click(object sender, EventArgs e)
 {
     try
     {
         using (var db = new THFinanceEntities())
         {
             tble_Vehicle tbl = new tble_Vehicle();
             tbl.VehicleBHP       = txt_vehiclebhp.Text;
             tbl.VehicleBorroerId = Convert.ToInt32(ddl_vehicelborrwer.SelectedValue);
             tbl.VehicleChasisNo  = txt_vehiclechasis.Text;
             tbl.VehicleColor     = txt_vehiclecolour.Text;
             tbl.VehicleEngineNo  = txt_enginenumber.Text;
             tbl.VehicleInsurance = txt_vehicleinsurance.Value;
             tbl.VehicleKeyNo     = txt_vehiclekey.Value;
             tbl.Vehiclemodel     = txt_vehiclemodel.Text;
             tbl.VehicleType      = txt_VehicleType.Value;
             if (tbl != null)
             {
                 db.tble_Vehicle.Add(tbl);
                 db.SaveChanges();
                 clearfields();
             }
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Пример #4
0
        protected void btn_update_Click(object sender, EventArgs e)
        {
            try
            {
                using (var db = new THFinanceEntities())
                {
                    int           id  = Convert.ToInt32(lbl_id.Text);
                    tbl_Guarantor tbl = (from s in db.tbl_Guarantor
                                         where s.GuarantorId.Equals(id)
                                         select s).SingleOrDefault();
                    tbl.GuarantorAddress     = txt_guaranteeaddresseee.Text;
                    tbl.GuarantorborrowerId  = Convert.ToInt32(ddl_borrwer.SelectedValue);
                    tbl.GuarantorDesignation = txt_guaranteedesignation.Text;
                    tbl.GuarantorFatherName  = txt_guaranteefathername.Text;
                    tbl.GuarantorName        = txt_guaranteename.Text;
                    tbl.GuarantorPhone       = txt_guaranteephone.Text;
                    Stream fs  = txt_guaranteeprooffile.PostedFile.InputStream;
                    Stream fs2 = txt_guaranteephoto.PostedFile.InputStream;

                    BinaryReader br     = new BinaryReader(fs);
                    BinaryReader br2    = new BinaryReader(fs2);
                    Byte[]       bytes  = br.ReadBytes((Int32)fs.Length);
                    Byte[]       bytes2 = br2.ReadBytes((Int32)fs.Length);
                    tbl.Guarantorphoto     = bytes2;
                    tbl.GuarantorProof     = bytes;
                    tbl.GuarantorProoftype = txt_guaranteeproof.Value;
                    db.SaveChanges();
                    clearfields();
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #5
0
        protected void btn_update_Click(object sender, EventArgs e)
        {
            int id = Convert.ToInt32(lbl_id.Text);

            try
            {
                using (var db = new THFinanceEntities())
                {
                    var q = (from s in db.tble_Vehicle where s.VehicleBorroerId.Equals(id)
                             select s).Single();
                    tble_Vehicle tbl = new tble_Vehicle();
                    tbl.VehicleBHP       = txt_vehiclebhp.Text;
                    tbl.VehicleBorroerId = Convert.ToInt32(ddl_vehicelborrwer.SelectedValue);
                    tbl.VehicleChasisNo  = txt_vehiclechasis.Text;
                    tbl.VehicleColor     = txt_vehiclecolour.Text;
                    tbl.VehicleEngineNo  = txt_enginenumber.Text;
                    tbl.VehicleInsurance = txt_vehicleinsurance.Value;
                    tbl.VehicleKeyNo     = txt_vehiclekey.Value;
                    tbl.Vehiclemodel     = txt_vehiclemodel.Text;
                    tbl.VehicleType      = txt_VehicleType.Value;
                    db.SaveChanges();
                    clearfields();
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #6
0
        protected void btn_payment_Click(object sender, EventArgs e)
        {
            db = new THFinanceEntities();
            tbl_chitti tbl = new tbl_chitti();

            tbl.CHITTI_NAME = txt_payment.Text;
            db.tbl_chitti.Add(tbl);
            db.SaveChanges();
            loadgrid();
        }
Пример #7
0
        protected void btn_managers_Click(object sender, EventArgs e)
        {
            db = new THFinanceEntities();
            tbl_managers tbl = new tbl_managers();

            tbl.mgbrnch_id   = Convert.ToInt32(ddl_branch.SelectedValue);
            tbl.manager_name = txt_manager.Text;
            db.tbl_managers.Add(tbl);
            db.SaveChanges();
        }
Пример #8
0
        protected void btn_brnach_Click(object sender, EventArgs e)
        {
            db = new THFinanceEntities();
            tbl_branches tbl = new tbl_branches();

            tbl.branchName = txt_branch.Text;
            var qry = (from s in db.tbl_branches
                       select s);

            if (qry.Count() > 0)
            {
                for (int i = 0; i < qry.Count(); i++)
                {
                    var    query   = qry.ToList();
                    string prev    = query[i].branchName;
                    var    present = txt_branch.Text;

                    if (prev == present)
                    {
                        Response.Write("<script>alert('Branch Name already Exist');</script>");
                        return;
                    }
                    else
                    {
                        db.tbl_branches.Add(tbl);
                        db.SaveChanges();
                        loadgrid();
                        return;
                    }
                }
            }

            db.tbl_branches.Add(tbl);
            db.SaveChanges();
            loadgrid();
        }
Пример #9
0
        protected void btn_payee_Click(object sender, EventArgs e)
        {
            db = new THFinanceEntities();
            tbl_payment tbl  = new tbl_payment();
            tbl_payee   tbl2 = new tbl_payee();



            tbl.managerId       = Convert.ToInt32(ddl_manager.SelectedValue);
            tbl.branchId        = Convert.ToInt32(ddl_branch.SelectedValue);
            tbl.paymentmethod   = Convert.ToInt32(ddl_chitti.SelectedValue);
            tbl.prepayDate      = Convert.ToDateTime(txt_startdate.Text);
            tbl.presentDate     = Convert.ToDateTime(txt_enddate.Value);
            tbl.paidAmount      = Convert.ToInt32(txt_paidAmount.Text);
            tbl.remainingAmount = Convert.ToInt32(txt_remainingAmount.Text);
            tbl.name            = Convert.ToInt32(ddl_payeename.SelectedValue);
            tbl.totalPayment    = Convert.ToInt32(txt_amount.Value);
            var ts = (from t in db.tbl_payee
                      where t.ID.Equals(tbl.name)
                      select t).ToList();

            // TimeSpan ts = tbl.presentDate - tbl.prepayDate;
            if (tbl.prepayDate.ToShortDateString() == tbl.presentDate.ToShortDateString())
            {
                Response.Write("<script>alert('please select diffrent date')</script>");
                return;
            }
            int count = (tbl.presentDate - tbl.prepayDate).Days;

            tbl.remainingdays = (100 - (tbl.presentDate - ts[0].startdate).Days) + "/100 days";
            if (count >= 3)
            {
                for (int i = 0; i < count / 3; i++)
                {
                    tbl.remainingAmount = tbl.remainingAmount + 100;
                }
            }
            db.tbl_payment.Add(tbl);
            db.SaveChanges();
        }
Пример #10
0
        protected void btn_login_Click(object sender, EventArgs e)
        {
            try
            {
                using (THFinanceEntities context = new THFinanceEntities())
                {
                    tbl_Guarantor tbl = new tbl_Guarantor();

                    tbl.GuarantorName       = txt_guaranteename.Text;
                    tbl.GuarantorFatherName = txt_guaranteefathername.Text;
                    tbl.GuarantorborrowerId = Convert.ToInt32(ddl_borrwer.SelectedValue);
                    Stream fs  = txt_guaranteeprooffile.PostedFile.InputStream;
                    Stream fs2 = txt_guaranteephoto.PostedFile.InputStream;

                    BinaryReader br     = new BinaryReader(fs);
                    BinaryReader br2    = new BinaryReader(fs2);
                    Byte[]       bytes  = br.ReadBytes((Int32)fs.Length);
                    Byte[]       bytes2 = br2.ReadBytes((Int32)fs.Length);
                    tbl.GuarantorAddress = txt_guaranteeaddresseee.Text;
                    tbl.GuarantorPhone   = txt_guaranteephone.Text;
                    tbl.GuarantorProof   = bytes;
                    //txt_guaranteeprooffile.PostedFile.SaveAs(Server.MapPath("~/Uploads") + tbl.GuarantorProof);
                    tbl.GuarantorProoftype = txt_guaranteeproof.Value;
                    tbl.G_createdBy        = Convert.ToInt32(Session["UserID"]);
                    tbl.G_createdDate      = DateTime.Now;
                    tbl.Guarantorphoto     = bytes2;
                    txt_guaranteephoto.PostedFile.SaveAs(Server.MapPath("~/Uploads") + tbl.Guarantorphoto);
                    // tbl.G_modifiedBy = 1;
                    // tbl.G_modifiedDate = null;
                    context.tbl_Guarantor.Add(tbl);
                    context.SaveChanges();
                    Response.Write("<script>alert('Sucessfully Saved')</script>");
                    clearfields();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #11
0
        protected void btn_update_Click(object sender, EventArgs e)
        {
            using (var context = new THFinanceEntities())
            {
                int             id  = Convert.ToInt32(lbl_id.Text);
                tbl_PaymentType tbl = (from s in context.tbl_PaymentType
                                       where s.paymentId.Equals(id)
                                       select s).Single();


                tbl.paymentBorrowerId = Convert.ToInt32(ddl_paymentborrwer.SelectedValue);
                tbl.PaymentDate       = Convert.ToDateTime(txt_startdate.Value);
                tbl.PaymentType       = txt_PaymentType.Value;
                tbl.givenamount       = txt_givenAmount.Text;
                tbl.PaymentAmount     = Convert.ToInt32(txt_PaymentAmount.Text);

                context.SaveChanges();
                Response.Write("<script>alert('Sucessfully saved')</script>");
                loadgrid();
                clearfields();
            }
        }
        protected void btn_update_Click(object sender, EventArgs e)
        {
            db = new THFinanceEntities();
            int id = Convert.ToInt32(lbl_id.Text);


            tbl_borrower tbl = (from c in db.tbl_borrower
                                where c.borrowerId.Equals(id)
                                select c).Single();

            tbl.borrowerId          = Convert.ToInt32(lbl_id.Text);
            tbl.borrowerName        = txt_barrowername.Text;
            tbl.borrowerFatherName  = txt_barrowerfathername.Text;
            tbl.BorrowerDesignation = txt_barrowerdesignation.Text;
            tbl.borrowerAddress     = txt_barroweraddresseee.Text;
            tbl.borrowerPhone       = txt_barrowerphone.Text;
            Stream fs  = txt_prooffile.PostedFile.InputStream;
            Stream fs2 = txt_photo.PostedFile.InputStream;

            BinaryReader br  = new BinaryReader(fs);
            BinaryReader br2 = new BinaryReader(fs2);

            Byte[] bytes  = br.ReadBytes((Int32)fs.Length);
            Byte[] bytes2 = br2.ReadBytes((Int32)fs.Length);
            tbl.borrowerproof = bytes;

            // txt_prooffile.PostedFile.SaveAs(Server.MapPath("~/Uploads") + tbl.borrowerproof);
            tbl.borrowerproofType = txt_proof.Value;
            tbl.createdby         = Convert.ToInt32(Session["UserID"]);
            tbl.createdDate       = DateTime.Now;
            tbl.borrowerPhoto     = bytes2;
            // txt_photo.PostedFile.SaveAs(Server.MapPath("~/Uploads") + tbl.borrowerPhoto);
            if (tbl != null)
            {
                //  db.tbl_borrower.Add(q);
                db.SaveChanges();
                loadgrid();
            }
        }
Пример #13
0
        protected void btn_newpayee_Click(object sender, EventArgs e)
        {
            db = new THFinanceEntities();
            tbl_payee tbl = new tbl_payee();

            tbl.branchId      = Convert.ToInt32(ddl_branch.SelectedValue);
            tbl.managerId     = Convert.ToInt32(ddl_manager.SelectedValue);
            tbl.paymentmethod = Convert.ToInt32(ddl_chitti.SelectedValue);
            tbl.payeeProof    = txt_payeeproof.Value.ToString();
            txt_payeeproof.PostedFile.SaveAs(Server.MapPath("~/Uploads") + tbl.payeeProof);
            tbl.amount = Convert.ToInt32(txt_amount.Text);

            tbl.NomineeProof = txt_nomineeproof.Value.ToString();
            txt_nomineeproof.PostedFile.SaveAs(Server.MapPath("~/Uploads") + tbl.NomineeProof);
            tbl.name        = txt_name.Text;
            tbl.NomineeName = txt_Nominee.Text;
            tbl.startdate   = Convert.ToDateTime(txt_startdate.Value);
            tbl.enddate     = Convert.ToDateTime(txt_enddate.Value);
            tbl.givenamount = Convert.ToInt32(txt_givenamount.Value);
            db.tbl_payee.Add(tbl);
            db.SaveChanges();
            Response.Write("<script>alert('Sucessfully Saved')</script>");
            clearfields();
        }
Пример #14
0
 protected void btn_update_Click(object sender, EventArgs e)
 {
     try
     {
         using (var db = new THFinanceEntities())
         {
             int id = Convert.ToInt32(lbl_id.Text);
             var q  = (from s in db.tbl_borrowerPaymentmethod
                       where s.borrowerPayid.Equals(id)
                       select s).SingleOrDefault();
             tbl_borrowerPaymentmethod tbl = new tbl_borrowerPaymentmethod();
             tbl.borrowerBranchid        = Convert.ToInt32(ddl_branch.SelectedValue);
             tbl.borrowerLoanid          = Convert.ToInt32(ddl_chitti.SelectedValue);
             tbl.borrowermanager         = Convert.ToInt32(ddl_manager.SelectedValue);
             tbl.borrowerName            = Convert.ToInt32(ddl_Borroerpayeename.SelectedValue);
             tbl.borrowerPayamount       = txt_paidAmount.Text;
             tbl.borrowerPaymentdate     = Convert.ToDateTime(txt_startdate.Text);
             tbl.totalpayment            = txt_amount.Value;
             tbl.borrowerReaminingamount = txt_remainingAmount.Text;
             tbl.borrowerPenalitydays    = Convert.ToInt32(txt_penalitydays.Value);
             tbl.modified     = Convert.ToInt32(Session["UserID"]);
             tbl.modifieddate = DateTime.Now;
             if (tbl != null)
             {
                 //  db.tbl_borrower.Add(q);
                 db.SaveChanges();
                 clearfields();
                 loadgrid();
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #15
0
        protected void btn_submit_Click(object sender, EventArgs e)
        {
            try
            {
                using (var db = new THFinanceEntities())
                {
                    tbl_borrowerPaymentmethod tbl = new tbl_borrowerPaymentmethod();
                    int id   = Convert.ToInt32(ddl_Borroerpayeename.SelectedValue);
                    int days = Convert.ToInt32(txt_penalitydays.Value);
                    var q    = (from s in db.tbl_PaymentType
                                where s.paymentBorrowerId.Equals(id)
                                select s).ToList();
                    // txt_penalitydays.Value = "0";
                    if (ddl_chitti.SelectedValue == "1")
                    {
                        //txt_penalitydays.Value = Convert.ToString(dayscount);
                    }
                    else
                    {
                    }

                    DateTime fromdate = DateTime.Parse(Convert.ToDateTime(txt_startdate.Text).ToShortDateString());
                    DateTime todate   = DateTime.Parse(Convert.ToDateTime(txt_enddate.Value).ToShortDateString());
                    if (fromdate > todate)
                    {
                        Response.Write("<script>alert('please select today date')</script>");
                        return;
                    }
                    else
                    {
                        tbl.borrowerBranchid        = Convert.ToInt32(ddl_branch.SelectedValue);
                        tbl.borrowerLoanid          = Convert.ToInt32(ddl_chitti.SelectedValue);
                        tbl.borrowerName            = Convert.ToInt32(ddl_Borroerpayeename.SelectedValue);
                        tbl.borrowermanager         = Convert.ToInt32(ddl_manager.SelectedValue);
                        tbl.borrowerPayamount       = txt_paidAmount.Text;
                        tbl.borrowerReaminingamount = txt_remainingAmount.Text;
                        tbl.borrowerPaymentdate     = todate;
                        tbl.borrowerPenalitydays    = Convert.ToInt32(txt_penalitydays.Value);
                        tbl.borrowerStartdate       = Convert.ToDateTime(txt_startdate.Text);
                        tbl.totalpayment            = txt_amount.Value;
                        tbl.createdby   = Convert.ToInt32(Session["UserID"]);
                        tbl.createddate = DateTime.Now;

                        if (ddl_chitti.SelectedValue == "1")
                        {
                            if (Convert.ToDateTime(q[0].PaymentDate) >= tbl.borrowerStartdate.AddDays(100))
                            {
                                if (tbl.borrowerReaminingamount == "0")
                                {
                                    tbl.status = 1;
                                    db.tbl_borrowerPaymentmethod.Add(tbl);
                                    db.SaveChanges();
                                    Response.Write("<script>alert('Payment sucessfully completed ')</script>");
                                    clearfields();
                                    return;
                                }
                                else
                                {
                                    tbl.status = 2;
                                    db.tbl_borrowerPaymentmethod.Add(tbl);
                                    db.SaveChanges();
                                    Response.Write("<script>alert('Payment pending')</script>");
                                    clearfields();
                                    return;
                                }
                            }
                            else
                            {
                                if (ddl_chitti.SelectedValue == "1")
                                {
                                    tbl.borrowerReaminingamount = Convert.ToString(Convert.ToInt32(txt_remainingAmount.Text) + days * 100);
                                    tbl.borrowerStartdate       = todate.AddDays(1);
                                }
                                else
                                {
                                    txt_remainingAmount.Text = Convert.ToString(Convert.ToInt32(txt_remainingAmount.Text) + days * 10);
                                    tbl.borrowerStartdate    = todate.AddMonths(1);
                                }
                                tbl.status = 0;
                                db.tbl_borrowerPaymentmethod.Add(tbl);
                                db.SaveChanges();
                                Response.Write("<script>alert('Sucessfully Saved')</script>");
                                clearfields();
                                return;
                            }
                        }

                        else
                        {
                            if (tbl.borrowerPaymentdate >= tbl.borrowerStartdate.AddMonths(12))
                            {
                                if (tbl.borrowerReaminingamount == "0")
                                {
                                    tbl.status = 1;
                                    db.tbl_borrowerPaymentmethod.Add(tbl);
                                    db.SaveChanges();
                                    Response.Write("<script>alert('Payment sucessfully completed ')</script>");
                                    clearfields();
                                    return;
                                }
                                else
                                {
                                    tbl.status = 2;
                                    db.tbl_borrowerPaymentmethod.Add(tbl);
                                    db.SaveChanges();
                                    Response.Write("<script>alert('Payment pending')</script>");
                                    clearfields();
                                    return;
                                }
                            }
                            else
                            {
                                if (ddl_chitti.SelectedValue == "1")
                                {
                                    txt_remainingAmount.Text = Convert.ToString(Convert.ToInt32(txt_remainingAmount.Text) + days * 100);
                                    tbl.borrowerStartdate    = todate.AddDays(1);
                                }
                                else
                                {
                                    txt_remainingAmount.Text = Convert.ToString(Convert.ToInt32(txt_remainingAmount.Text) + days * 10);
                                    tbl.borrowerStartdate    = todate.AddMonths(1);
                                }
                                tbl.status = 0;
                                db.tbl_borrowerPaymentmethod.Add(tbl);
                                db.SaveChanges();
                                Response.Write("<script>alert('Sucessfully Saved')</script>");
                                clearfields();
                                return;
                            }
                        }
                        //if(tbl.borrowerStartdate == tbl.borrowerStartdate.AddMonths(12))
                        //{
                        //    if (tbl.borrowerReaminingamount == "0")
                        //    {

                        //        status = 1;
                        //        Response.Write("<script>alert('Payment sucessfully completed ')</script>");
                        //        return;

                        //    }
                        //    else
                        //    {
                        //        status = 2;

                        //    }

                        //}
                        //    if (tbl.borrowerReaminingamount=="0")
                        //{

                        //    status = 1;
                        //    Response.Write("<script>alert('Payment sucessfully completed ')</script>");
                        //    return;

                        //}
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        protected void btn_login_Click(object sender, EventArgs e)
        {
            try
            {
                if (Page.IsValid)
                {
                    using (THFinanceEntities db = new THFinanceEntities())
                    {
                        var q = (from s in db.tbl_borrower
                                 select s).ToList();
                        tbl_borrower tbl = new tbl_borrower();
                        tbl.borrowerName        = txt_barrowername.Text;
                        tbl.borrowerFatherName  = txt_barrowerfathername.Text;
                        tbl.BorrowerDesignation = txt_barrowerdesignation.Text;
                        tbl.borrowerAddress     = txt_barroweraddresseee.Text;
                        tbl.borrowerPhone       = txt_barrowerphone.Text;
                        Stream fs  = txt_prooffile.PostedFile.InputStream;
                        Stream fs2 = txt_photo.PostedFile.InputStream;
                        //int fileSize = (txt_prooffile.PostedFile.ContentLength / 1024);
                        //Stream ipStream = txt_prooffile.PostedFile.InputStream;
                        //using (var image = System.Drawing.Image.FromStream(ipStream))
                        //{
                        //    float w = image.PhysicalDimension.Width;
                        //    float h = image.PhysicalDimension.Height;
                        //}
                        //if (fileSize<(2 * 1024))
                        //{
                        //   // PanelError.Visible = true;
                        //    lblError.Text = "Filesize of image is too large. Maximum file size permitted is " + 5 + "MB";
                        //    lblError.Visible = true;
                        //    return;
                        //}

                        BinaryReader br     = new BinaryReader(fs);
                        BinaryReader br2    = new BinaryReader(fs2);
                        Byte[]       bytes  = br.ReadBytes((Int32)fs.Length);
                        Byte[]       bytes2 = br2.ReadBytes((Int32)fs.Length);
                        tbl.borrowerproof = bytes;
                        // txt_prooffile.PostedFile.SaveAs(Server.MapPath("~/Uploads") + tbl.borrowerproof);
                        tbl.borrowerproofType = txt_proof.Value;
                        tbl.createdby         = Convert.ToInt32(Session["UserID"]);
                        tbl.createdDate       = DateTime.Now;
                        tbl.borrowerPhoto     = bytes2;
                        if (q.Count == 0)
                        {
                            db.tbl_borrower.Add(tbl);
                            db.SaveChanges();
                            Response.Write("<script>alert('Sucessfully Saved')</script>");
                            clearfields();
                            return;
                        }
                        else
                        {
                            for (int i = 0; i <= q.Count; i++)
                            {
                                string prev          = q[i].borrowerName;
                                string present       = txt_barrowername.Text;
                                string mobileprev    = q[i].borrowerPhone;
                                string mobilepresent = txt_barrowerphone.Text;
                                if (present == prev || mobileprev == mobilepresent)
                                {
                                    Response.Write("<script>alert('please check mobile or  valid borrower Name')</script>");
                                    return;
                                }

                                //else
                                //{
                                //    db.tbl_borrower.Add(tbl);
                                //    db.SaveChanges();
                                //    Response.Write("<script>alert('Sucessfully Saved')</script>");
                                //    clearfields();
                                //    return;
                                //}
                            }
                        }

                        //txt_photo.PostedFile.SaveAs(Server.MapPath("~/Uploads") + tbl.borrowerPhoto);
                        db.tbl_borrower.Add(tbl);
                        db.SaveChanges();
                        Response.Write("<script>alert('Sucessfully Saved')</script>");
                        clearfields();
                    }
                }
            }
            catch (Exception ex)
            {
                Response.Write("<script>alert('Sucessfully not Saved')</script>");
                throw ex;
            }
        }