Exemple #1
0
        public ActionResult Create([Bind(Include = "Add_id,Oda_no,Sabik_gabisa,Sabik_Oda,Tole,senior_id")] table_address table_address)
        {
            if (ModelState.IsValid)
            {
                if (!db.table_address.Any(u => u.senior_id == table_address.senior_id))
                {
                    //db.table_address.Any(ag => ag.senior_id == c)
                    db.table_address.Add(table_address);
                    db.SaveChanges();
                    //db.pdffiles.Add(new pdffile
                    // {
                    //   status = true

                    //});
                    // db.SaveChanges();

//for status value change from
                    var result = db.pdffiles // this explicit query is here
                                 .Where(stats => stats.status == false)
                                 .Take(1);

                    foreach (var item in result)
                    {
                        ViewBag.file = item.File;
                        pdffile pdff = new pdffile();
                        using (var con = new woda_testEntities())
                        {
                            pdff        = con.pdffiles.First(x => x.File == item.File);
                            pdff.status = true;

                            con.pdffiles.Attach(pdff);
                            var entry = con.Entry(pdff);
                            entry.Property(e => e.status).IsModified = true;
                            con.SaveChanges();
                        }
                    }


                    //to here



                    return(RedirectToAction("Index"));
                }
                else
                {
                    ViewBag.error = "This Home Number already added";
                }
            }


            ViewBag.senior_id = new SelectList(db.table_house_senior_details, "senior_id", "Home_no", table_address.senior_id);
            return(View(table_address));
        }
Exemple #2
0
        public ActionResult Create([Bind(Include = "PBM_ID,Name,nata,gender,birth_place,education,age,age_group,PB_ID")] pariwar_bekti_bibarand_many pariwar_bekti_bibarand_many)
        {
            if (ModelState.IsValid)
            {
                db.pariwar_bekti_bibarand_many.Add(pariwar_bekti_bibarand_many);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.PB_ID = new SelectList(db.pariwar_bekti_bibarand, "PB_ID", "PB_ID", pariwar_bekti_bibarand_many.PB_ID);
            return(View(pariwar_bekti_bibarand_many));
        }
Exemple #3
0
        public ActionResult Create([Bind(Include = "sewaID,khop,mahila_posand,upachar,senior_id")] swosta_sewa swosta_sewa)
        {
            if (ModelState.IsValid)
            {
                db.swosta_sewa.Add(swosta_sewa);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.senior_id = new SelectList(db.table_house_senior_details, "senior_id", "Home_no", swosta_sewa.senior_id);
            return(View(swosta_sewa));
        }
Exemple #4
0
        public ActionResult Create([Bind(Include = "apangaID,apangata1,apanga_type,senior_id")] apangata apangata)
        {
            if (ModelState.IsValid)
            {
                db.apangatas.Add(apangata);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.senior_id = new SelectList(db.table_house_senior_details, "senior_id", "Home_no", apangata.senior_id);
            return(View(apangata));
        }
Exemple #5
0
        public ActionResult Create([Bind(Include = "ABM_ID,Name,Gender,Total,went_place,gone_reason,AB_ID")] anupasthit_bekti_many anupasthit_bekti_many)
        {
            if (ModelState.IsValid)
            {
                db.anupasthit_bekti_many.Add(anupasthit_bekti_many);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.AB_ID = new SelectList(db.anupasthit_bekti, "AB_ID", "senior_id", anupasthit_bekti_many.AB_ID);
            return(View(anupasthit_bekti_many));
        }
Exemple #6
0
        public ActionResult Create([Bind(Include = "AB_ID,senior_id")] anupasthit_bekti anupasthit_bekti)
        {
            if (ModelState.IsValid)
            {
                db.anupasthit_bekti.Add(anupasthit_bekti);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.senior_id = new SelectList(db.table_house_senior_details, "senior_id", "Home_no", anupasthit_bekti.senior_id);
            return(View(anupasthit_bekti));
        }
        public ActionResult Create([Bind(Include = "PB_ID,senior_id")] pariwar_bekti_bibarand pariwar_bekti_bibarand)
        {
            if (ModelState.IsValid)
            {
                db.pariwar_bekti_bibarand.Add(pariwar_bekti_bibarand);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.senior_id = new SelectList(db.table_house_senior_details, "senior_id", "Home_no", pariwar_bekti_bibarand.senior_id);
            return(View(pariwar_bekti_bibarand));
        }
Exemple #8
0
        public ActionResult Create([Bind(Include = "F_id,House_type,House_area,House_total_area,roof_type,on_rent,cooking_type,entertainment,annual_income,sampannata_sthar,drinking_water,drinking_water_TYPE,fohormaila_bewasthapan,irrigation,irrigation_type,sadak_pugeko,sadak_type,bhukampa_jokhim,house_used_for,Ghar_naksha,storey,electricity,electricity_type,senior_id")] table_home_facility table_home_facility)
        {
            if (ModelState.IsValid)
            {
                if (!db.table_home_facility.Any(u => u.senior_id == table_home_facility.senior_id))
                {
                    db.table_home_facility.Add(table_home_facility);
                    db.SaveChanges();


                    //update status value
                    var result = db.pdffiles // this explicit query is here
                                 .Where(stats => stats.home_status == false)
                                 .Take(1);

                    foreach (var item in result)
                    {
                        ViewBag.file = item.File;
                        pdffile pdff = new pdffile();
                        using (var con = new woda_testEntities())
                        {
                            pdff             = con.pdffiles.First(x => x.File == item.File);
                            pdff.home_status = true;

                            con.pdffiles.Attach(pdff);
                            var entry = con.Entry(pdff);
                            entry.Property(e => e.home_status).IsModified = true;
                            con.SaveChanges();
                        }
                    }
                    return(RedirectToAction("Index"));
                }
                else
                {
                    ViewBag.error = "This Home Number already added";
                }
            }



            ViewBag.senior_id = new SelectList(db.table_house_senior_details, "senior_id", "Home_no", table_home_facility.senior_id);
            return(View(table_home_facility));
        }
        public ActionResult UploadFiles(HttpPostedFileBase[] files, pdffile pdffile)
        {
            //Ensure model state is valid
            if (ModelState.IsValid)
            {   //iterating through multiple file collection
                foreach (HttpPostedFileBase file in files)
                {
                    //Checking file is available to save.
                    if (file != null)
                    {
                        var InputFileName  = Path.GetFileName(file.FileName);
                        var ServerSavePath = Path.Combine(Server.MapPath("~/ViewerJS/pdfs/") + InputFileName);
                        var tosave         = "ViewerJS/pdfs/" + InputFileName;
                        //Save file to server folder
                        file.SaveAs(ServerSavePath);
                        ViewBag.UploadStatus = files.Count().ToString() + " files uploaded successfully.";
                        {
                            db.pdffiles.Add(new pdffile
                            {
                                status = false,
                                File   = tosave
                            });
                            db.SaveChanges();
                            ViewBag.UploadStatus = files.Count().ToString() + " files uploaded successfully.";
                        }



                        //db.pdffiles.Add(new pdffile
                        //{
                        //  status = false,
                        //File = ServerSavePath


                        //});
                        //db.SaveChanges();

                        //assigning file uploaded status to ViewBag for showing message to user.
                    }
                }
            }
            return(View());
        }
Exemple #10
0
        public ActionResult Create([Bind(Include = "D_id,Total_person,Male_count,Female_count,caste,religion,senior_id")] table_demographic table_demographic)
        {
            if (ModelState.IsValid)
            {
                if (!db.table_demographic.Any(u => u.senior_id == table_demographic.senior_id))
                {
                    db.table_demographic.Add(table_demographic);
                    db.SaveChanges();
                    //update status value
                    var result = db.pdffiles // this explicit query is here
                                 .Where(stats => stats.demo_status == false)
                                 .Take(1);

                    foreach (var item in result)
                    {
                        ViewBag.file = item.File;
                        pdffile pdff = new pdffile();
                        using (var con = new woda_testEntities())
                        {
                            pdff             = con.pdffiles.First(x => x.File == item.File);
                            pdff.demo_status = true;

                            con.pdffiles.Attach(pdff);
                            var entry = con.Entry(pdff);
                            entry.Property(e => e.demo_status).IsModified = true;
                            con.SaveChanges();
                        }
                    }
                    return(RedirectToAction("Index"));
                }
                else
                {
                    ViewBag.error = "This Home Number already added";
                }
            }

            ViewBag.senior_id = new SelectList(db.table_house_senior_details, "senior_id", "Home_no", table_demographic.senior_id);
            return(View(table_demographic));
        }
        public ActionResult Create([Bind(Include = "senior_id,Home_no,Education,Occupation,Contact_no,DOB,BirthPlace,CitizenShip_no,CitizenshipIssue_district,citizenissue_date,Name")] table_house_senior_details table_house_senior_details)
        {
            if (ModelState.IsValid)
            {
                if (!db.table_house_senior_details.Any(u => u.Home_no == table_house_senior_details.Home_no))
                {
                    db.table_house_senior_details.Add(table_house_senior_details);
                    db.SaveChanges();

                    var result = db.pdffiles // this explicit query is here
                                 .Where(stats => stats.senior_status == false)
                                 .Take(1);

                    foreach (var item in result)
                    {
                        ViewBag.file = item.File;
                        pdffile pdff = new pdffile();
                        using (var con = new woda_testEntities())
                        {
                            pdff = con.pdffiles.First(x => x.File == item.File);
                            pdff.senior_status = true;

                            con.pdffiles.Attach(pdff);
                            var entry = con.Entry(pdff);
                            entry.Property(e => e.senior_status).IsModified = true;
                            con.SaveChanges();
                        }
                    }
                    return(RedirectToAction("Index"));
                }
                else
                {
                    ViewBag.error = "This Home Number already added";
                }
            }

            return(View(table_house_senior_details));
        }