public JsonResult SaveImagePathReportsHeader(KeystoneProject.Models.FinancialAccount.ChequeLayout model)
        {
            String Path1 = "";
            string path  = "";
            //PatientMRD_Model Model
            // PatientMRD_Model obj = new PatientMRD_Model();
            var file = model.ImageFile;

            if (file != null)
            {
                //var path = "";
                var filename  = Path.GetFileName(file.FileName);
                var extention = Path.GetExtension(file.FileName);
                var filenamethoutextenction = Path.GetFileNameWithoutExtension(file.FileName);
                //  file.SaveAs(Server.MapPath("~/MRDFiles/" + file.FileName));
                //  Session["Paper"] = "/MRDFiles/" + file.FileName;

                path = Server.MapPath("~/") + "MRDFiles/" + file.FileName;

                file.SaveAs(path);
                // Session["Paper"] = path;
                ViewData["ImagePath"] = "/MRDFiles/" + file.FileName;
                path = "/MRDFiles/" + file.FileName;
                path = Server.MapPath("~/") + "MRDFiles/" + file.FileName;
                //  IUFillData(path, obj);
                string Name = AutoGanrateferecnCode();
                Path1 = "" + PhotoPath + "" + Name + ".jpg";
                // file.SaveAs(@Path1);
                //return Path1;

                //  path = @"C:\Users\Kapsicumweb\Pictures\Koala.jpg";
            }
            return(new JsonResult {
                Data = path, JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
        private void IUFillData(string Path, KeystoneProject.Models.FinancialAccount.ChequeLayout obj)
        {
            obj.dsChequeLayout = new DataSet();
            obj.dsChequeLayout = (DataSet)Session["dsChequeLayout"];
            if ((DataSet)Session["dsChequeLayout"] == null)
            {
                obj.dsChequeLayout = objBL_ChequeLayout_R.GetChequeLayout(HospitalID, LocationID, 0);
                DataRow dr = obj.dsChequeLayout.Tables[0].NewRow();

                //if (ucChequeLayout1.chkHideBackGround.Checked == false)
                //{
                //System.Drawing.Image img = new System.Drawing.Bitmap(Path);
                //  string Name = AutoGanrateferecnCode();
                //  String Path1 = "MRDFiles/" + PhotoPath + "" + Name + ".jpg";
                //   img.Save(Path1);
                //  byte[] imgdata = System.IO.File.ReadAllBytes(Server.MapPath(Path));

                FileStream file3    = new FileStream(Path, FileMode.OpenOrCreate, FileAccess.Read);
                byte[]     stphoto3 = new byte[file3.Length];
                file3.Read(stphoto3, 0, System.Convert.ToInt32(file3.Length));
                file3.Close();


                dr["BackImage"] = stphoto3;

                //}
                //else { dr["BackImage"] = null; }

                dr["HospitalID"]     = HospitalID;
                dr["LocationID"]     = LocationID;
                dr["ChequeLayoutID"] = 0;
                dr["BankID"]         = obj.BankID;
                dr["ImageHieght"]    = obj.txtHieght;
                dr["IMageWidth"]     = obj.txtWidth;
                dr["Date_L"]         = obj.DateL;
                dr["Date_T"]         = obj.DateT;
                dr["Payee_L"]        = obj.PayeeL;
                dr["Payee_T"]        = obj.PayeeT;
                dr["AmtWord1_L"]     = obj.AmtInWord1L;
                dr["AmtWord1_T"]     = obj.AmtINWord1T;
                dr["AmtWord2_L"]     = obj.AmtINWord2L;
                dr["AmtWord2_T"]     = obj.AmtInWord2T;
                dr["Amt_L"]          = obj.AmountL;
                dr["Amt_T"]          = obj.AmountT;
                dr["CreationID"]     = UserID;
                dr["Mode"]           = this.Mode.ToString();
                obj.dsChequeLayout.Tables[0].Rows.Add(dr);
            }
            else
            {
                //["ChequeLayoutID"] = 0;
                obj.dsChequeLayout.Tables[0].Rows[0]["BankID"] = obj.BankID;
                //dr["BackImage"] = "Santosh Gupta";
                obj.dsChequeLayout.Tables[0].Rows[0]["ImageHieght"] = obj.txtHieght;
                obj.dsChequeLayout.Tables[0].Rows[0]["IMageWidth"]  = obj.txtWidth;
                obj.dsChequeLayout.Tables[0].Rows[0]["Date_L"]      = obj.DateL;
                obj.dsChequeLayout.Tables[0].Rows[0]["Date_T"]      = obj.DateT;
                obj.dsChequeLayout.Tables[0].Rows[0]["Payee_L"]     = obj.PayeeL;
                obj.dsChequeLayout.Tables[0].Rows[0]["Payee_T"]     = obj.PayeeT;
                obj.dsChequeLayout.Tables[0].Rows[0]["AmtWord1_L"]  = obj.AmtInWord1L;
                obj.dsChequeLayout.Tables[0].Rows[0]["AmtWord1_T"]  = obj.AmtINWord1T;
                obj.dsChequeLayout.Tables[0].Rows[0]["AmtWord2_L"]  = obj.AmtINWord2L;
                obj.dsChequeLayout.Tables[0].Rows[0]["AmtWord2_T"]  = obj.AmtInWord2T;
                obj.dsChequeLayout.Tables[0].Rows[0]["Amt_L"]       = obj.AmountL;
                obj.dsChequeLayout.Tables[0].Rows[0]["Amt_T"]       = obj.AmountT;
            }
            Session["dsChequeLayout"] = (DataSet)obj.dsChequeLayout;
        }