Ejemplo n.º 1
0
        // GET: Dropdown
        public ActionResult Index()
        {
            TapalsEntities te = new TapalsEntities();

            ViewBag.department = new SelectList(te.Departments, "Id", "Dept");
            return(View());
        }
Ejemplo n.º 2
0
 public JsonResult UpdateInwardDetail(string name, string chequeIssuedList)
 {
     using (var entities = new TapalsEntities())
     {
         if (!string.IsNullOrEmpty(chequeIssuedList))
         {
             var chequeIdList = chequeIssuedList.Split(',');
             foreach (var cheque in chequeIdList)
             {
                 long inwardId = Convert.ToInt64(cheque);
                 if (inwardId > 0)
                 {
                     var dbData = (from hc in entities.Inwards
                                   where hc.Id == inwardId
                                   select hc).SingleOrDefault();
                     if (dbData != null)
                     {
                         dbData.IssueName = name;
                         dbData.Issue     = true;
                         entities.SaveChanges();
                     }
                 }
             }
             return(Json(true, JsonRequestBehavior.AllowGet));
         }
         return(Json(false, JsonRequestBehavior.AllowGet));
     }
 }
Ejemplo n.º 3
0
 public ActionResult Login(Login login)
 {
     if (ModelState.IsValid)
     {
         TapalsEntities db   = new TapalsEntities();
         var            user = (from Inward_Tapal in db.Registrations
                                where Inward_Tapal.Username == login.UserName && Inward_Tapal.Password == login.Password
                                select new
         {
             // Inward_Tapal.UserID,
             Inward_Tapal.Username
         }).ToList();
         if (user.FirstOrDefault() != null)
         {
             //   Session["UserName"] = user.FirstOrDefault().Username;
             Session["UserName"] = user.FirstOrDefault().Username.ToString();
             //Session["UserID"]=user.FirstOrDefault().UserID;
             string test = Session["UserName"].ToString();
             return(Redirect("/Inward/Create"));
         }
         else
         {
             ModelState.AddModelError("", "Invalid login credentials.");
         }
     }
     return(View(login));
 }
Ejemplo n.º 4
0
        public ActionResult Officegrid()
        {
            DateTime startDateTime = DateTime.Today;                         //Today at 00:00:00
            DateTime endDateTime   = DateTime.Today.AddDays(1).AddTicks(-1); //Today at 23:59:59
            int      count         = user.Inwards.Where(c => c.Date_in >= startDateTime && c.Date_in < endDateTime && c.T_Dept == "Office").Count();

            using (var db = new TapalsEntities())
            {
                List <TapalsEntities> str = new List <TapalsEntities>();
                var query = (from pro in db.Inwards
                             where pro.T_Section == "Office" && pro.Date_in >= startDateTime && pro.Date_in < endDateTime
                             select new sample_User()
                {
                    Id = pro.Id,
                    Date_in = pro.Date_in,
                    T_Sno = pro.T_Sno,
                    T_From = pro.T_From,
                    T_Dept = pro.T_Dept,
                    T_Subject = pro.T_Subject,
                    T_Section = pro.T_Section,
                    T_Passout = pro.T_Passout,
                    TPLNO = pro.TPLNO,
                    T_Cheque = pro.T_Cheque,
                    T_User = pro.T_User,
                    wfcpno = pro.wfcpno
                }).ToList();
                return(View(query));
            }
        }
Ejemplo n.º 5
0
 public ActionResult _ShowDetails()
 {
     using (var database = new TapalsEntities())
     {
         DateTime startDateTime  = DateTime.Today;                         //Today at 00:00:00
         DateTime endDateTime    = DateTime.Today.AddDays(1).AddTicks(-1); //Today at 23:59:59
         var      dbSameUserList = (from hc in database.Inwards
                                    where hc.Date_in >= startDateTime && hc.Date_in < endDateTime && hc.Issue == false
                                    select new sample_User
         {
             Id = hc.Id,
             Date_in = hc.Date_in,
             T_Sno = hc.T_Sno,
             T_From = hc.T_From,
             T_Dept = hc.T_Dept,
             T_Subject = hc.T_Subject,
             T_Section = hc.T_Section,
             T_Passout = hc.T_Passout,
             TPLNO = hc.TPLNO,
             T_Cheque = hc.T_Cheque,
             T_User = hc.T_User,
             wfcpno = hc.wfcpno,
         }).ToList();
         return(PartialView(dbSameUserList != null ? dbSameUserList : new List <sample_User>()));
     }
 }
Ejemplo n.º 6
0
        public JsonResult AutocompleteSuggestions(string searchstring)
        {
            TapalsEntities db = new TapalsEntities();

            var suggestions = from s in db.Subjects
                              select s.Subject_Name;
            var namelist = suggestions.Where(n => n.Contains(searchstring)).ToList().Take(7);

            return(Json(namelist, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 7
0
 public JsonResult GetDropDownValue(string department)
 {
     using (var database = new TapalsEntities())
     {
         var dbList = (from hc in database.Departments
                       where hc.DeptOrCentre == department
                       select new
         {
             Text = hc.Dept,
             value = hc.Id
         }).ToList();
         return(Json(dbList, JsonRequestBehavior.AllowGet));
     }
 }
        // GET: User_Registration
        public ActionResult Index(User_Registration reg)
        {
            using (var db = new TapalsEntities())
            {
                db.Registrations.Add(new Registration
                {
                    // Emp_ID=reg.EmpId,
                    Username    = reg.Username,
                    Password    = reg.Password,
                    Section     = reg.Section,
                    Designation = reg.Designation
                });
                db.SaveChanges();
            }

            return(View());
        }
Ejemplo n.º 9
0
        public ActionResult delete(int?id)
        {
            using (var dbobj = new TapalsEntities())
            {
                //from a in database.Inwards
                //where a.Id == id
                // var dbtab = dbobj.Inwards.SingleOrDefault(hc => (hc.Id = id));
                var dbtab = dbobj.Inwards.SingleOrDefault(hc => (hc.Id == id));

                if (dbtab != null)
                {
                    dbobj.Inwards.Remove(dbtab);
                    dbobj.SaveChanges();
                }
            }
            TempData["student"] = "ÿgffy";

            return(RedirectToAction("edit", "New_Entry"));
        }
Ejemplo n.º 10
0
 public ActionResult _ShowDetails()
 {
     using (var database = new TapalsEntities())
     {
         var dbSameUserList = (from hc in database.Inwards
                               select new sample_User
         {
             Date_in = hc.Date_in,
             T_Sno = hc.T_Sno,
             T_From = hc.T_From,
             T_Dept = hc.T_Dept,
             T_Subject = hc.T_Subject,
             T_Section = hc.T_Section,
             T_Passout = hc.T_Passout,
             TPLNO = hc.TPLNO,
             T_Cheque = hc.T_Cheque,
             T_User = hc.T_User,
             wfcpno = hc.wfcpno
         }).ToList();
         return(PartialView(dbSameUserList != null ? dbSameUserList : new List <sample_User>()));
     }
 }
Ejemplo n.º 11
0
        public ActionResult edit(string currentFilter, string searchString, int?page)
        {
            if (searchString != null)
            {
                page = 1;
            }
            else
            {
                searchString = currentFilter;
            }

            ViewBag.CurrentFilter = searchString;

            using (var db = new TapalsEntities())
            {
                List <TapalsEntities> str = new List <TapalsEntities>();
                var query = (from pro in db.Inwards
                             select new sample_User()
                {
                    Date_in = pro.Date_in,
                    T_Sno = pro.T_Sno,
                    T_From = pro.T_From,
                    T_Dept = pro.T_Dept,
                    T_Subject = pro.T_Subject,
                    T_Section = pro.T_Section,
                    T_Passout = pro.T_Passout,
                    TPLNO = pro.TPLNO,
                    T_Cheque = pro.T_Cheque,
                    T_User = pro.T_User,
                    wfcpno = pro.wfcpno
                }).ToList();
                int pageSize   = 3;
                int pageNumber = (page ?? 1);
                return(View(query.ToPagedList(pageNumber, pageSize)));
            }

            //  return View(students.ToPagedList(pageNumber, pageSize));
            // return View()
        }
Ejemplo n.º 12
0
        public ActionResult Index(int?id)
        {
            //  string I;
            ViewBag.department = new SelectList(user.Departments, "Dept", "Dept");

            using (var database = new TapalsEntities())
            {
                //var count = database.Inwards.Select(hc => hc.TPLNO).Count() + 1;
                // ViewBag.count1 ="I"+ count;
                // ViewBag.tplno = database.Inwards.Max(hc => hc.TPLNO) + 1;
                //DateTime tpl = DateTime.Parse(database.Inwards
                //              .OrderByDescending(p => p.TPLNO)
                //              .Select(r => r.Date_in)
                //              .First().ToString());
                //if (tpl != DateTime.Now.Date)
                //{
                //    ViewBag.count1 = "I" + 01;
                //}
                //else
                //{
                //    var tpl2 = DateTime.Parse(database.Inwards
                //             .OrderByDescending(p => p.TPLNO)
                //             .Select(r => r.Date_in)
                //             .First().ToString());
                //    ViewBag.count1 = "I" + tpl2;
                //}
                //int TPLNO = id ?? 0;
                if (id > 0)
                {
                    var tapalDetail = (from a in database.Inwards
                                       select new sample_User
                    {
                    }).SingleOrDefault();
                    return(View(tapalDetail));
                }
            }
            return(View(new sample_User()));
        }
Ejemplo n.º 13
0
 public ActionResult edit()
 {
     using (var db = new TapalsEntities())
     {
         List <TapalsEntities> str = new List <TapalsEntities>();
         var query = (from pro in db.Inwards
                      select new sample_User()
         {
             Date_in = pro.Date_in,
             T_Sno = pro.T_Sno,
             T_From = pro.T_From,
             T_Dept = pro.T_Dept,
             T_Subject = pro.T_Subject,
             T_Section = pro.T_Section,
             T_Passout = pro.T_Passout,
             TPLNO = pro.TPLNO,
             T_Cheque = pro.T_Cheque,
             T_User = pro.T_User,
             wfcpno = pro.wfcpno
         }).ToList();
         return(View(query));
     }
 }
Ejemplo n.º 14
0
        public ActionResult Index(int?id)
        {
            using (var database = new TapalsEntities())
            {
                if (id > 0)
                {
                    var tapalDetail = (from a in database.Inwards
                                       where a.Id == id
                                       select new sample_User
                    {
                        Id = a.Id,
                        Date_in = a.Date_in,
                        T_Sno = a.T_Sno,
                        T_From = a.T_From,
                        T_Dept = a.T_Dept,
                        T_Subject = a.T_Subject,
                        T_Section = a.T_Section,
                        T_Passout = a.T_Passout,
                        TPLNO = a.TPLNO,
                        T_Cheque = a.T_Cheque,
                        T_User = a.T_User,
                        wfcpno = a.wfcpno
                    }).SingleOrDefault();

                    ViewData["Department"] = database.Departments.FirstOrDefault(de => de.Dept == tapalDetail.T_Dept).DeptOrCentre;
                    ViewBag.department     = new SelectList(user.Departments, "Dept", "Dept", tapalDetail.T_Dept);
                    //ViewBag.department = user.Departments.Select(m => new SelectListItem()
                    //{
                    //    Text = m.Dept,
                    //    Value = m.Id.ToString()
                    //}).ToList();
                    //ViewBag.subject = new SelectList(user.Subjects, "Subject_Name", "Subject_Name");
                    return(View(tapalDetail));
                }
            }
            return(View(new sample_User()));
        }
Ejemplo n.º 15
0
        public ActionResult updatedetails(sample_User samp, FormCollection frm)
        {
            using (var database = new TapalsEntities())
            {
                // var tplno = database.Inwards.Max(hc => hc.TPLNO) + 1;
                var chequeList = new List <in_Cheque>();

                foreach (var key in frm.AllKeys.Where(hc => hc.Contains("MyKey")).ToList())
                {
                    var       myKey = key.Replace("MyKey", "");
                    in_Cheque check = new in_Cheque()
                    {
                        AMOUNT = frm["AMOUNT" + myKey],
                        BANK   = frm["BANK" + myKey],
                        CQDATE = (Convert.ToDateTime(frm["CQDATE" + myKey])),
                        CQNO   = Convert.ToInt64(frm["CQNO" + myKey]),
                        //TPLNO = Convert.ToInt32(tplno + myKey)
                        // TPLNO = tplno + myKey
                    };
                    chequeList.Add(check);
                }

                if (chequeList != null && chequeList.Any())
                {
                    using (var dbobj = new TapalsEntities())
                    {
                        foreach (var cheque in chequeList)
                        {
                            bool isrecordexist = false;
                            var  dbtable       = dbobj.Cheques.SingleOrDefault(hc => hc.CQNO == cheque.CQNO);
                            if (dbtable != null)
                            {
                                isrecordexist = true;
                            }
                            else
                            {
                                dbtable = new Cheque();
                            }

                            dbtable.AMOUNT = cheque.AMOUNT;
                            dbtable.BANK   = cheque.BANK;
                            dbtable.CQDATE = cheque.CQDATE;
                            dbtable.CQNO   = Convert.ToInt32(cheque.CQNO);
                            //dbtable.TPLNO = tplno1;
                            if (!isrecordexist)
                            {
                                dbobj.Cheques.Add(dbtable);
                            }
                            dbobj.SaveChanges();
                        }
                    }
                }

                using (var dbobj = new TapalsEntities())
                {
                    bool isrecordexist = false;
                    var  dbtable       = dbobj.Inwards.SingleOrDefault(hc => hc.TPLNO == samp.TPLNO);
                    if (dbtable != null)
                    {
                    }
                    else
                    {
                        string dep = frm["Department"];
                        dbtable           = new Inward();
                        dbtable.Date_in   = DateTime.Now;
                        dbtable.T_Sno     = samp.T_Sno;
                        dbtable.T_From    = samp.T_From;
                        dbtable.T_Dept    = frm["Department"];
                        dbtable.T_Subject = samp.T_Subject;
                        dbtable.T_Section = samp.T_Section;
                        dbtable.T_Passout = samp.T_Passout;
                        dbtable.TPLNO     = "I1526";
                        dbtable.T_Cheque  = "Y";
                        //  dbtable.T_User = Session["UserName"].ToString();
                        dbtable.T_User = "******";
                        dbtable.wfcpno = samp.wfcpno;
                    }
                    if (!isrecordexist)
                    {
                        dbobj.Inwards.Add(dbtable);
                    }

                    dbobj.SaveChanges();
                }
                return(RedirectToAction("Index", "New_Entry"));
            }
        }
Ejemplo n.º 16
0
        public ActionResult Create(sample_User samp, FormCollection frm)
        {
            using (var database = new TapalsEntities())
            {
                var chequeList = new List <in_Cheque>();
                if (frm.AllKeys.Any() && frm.AllKeys.Count() > 0)
                {
                    foreach (var key in frm.AllKeys.Where(hc => hc.Contains("MyKey")).ToList())
                    {
                        var       myKey = key.Replace("MyKey", "");
                        in_Cheque check = new in_Cheque()
                        {
                            AMOUNT = frm["AMOUNT" + myKey],
                            BANK   = frm["BANK" + myKey],
                            CQDATE = Convert.ToDateTime(frm["CQDATE" + myKey]),
                            CQNO   = Convert.ToInt64(frm["CQNO" + myKey]),
                        };
                        chequeList.Add(check);
                    }
                }

                if (chequeList != null && chequeList.Any())
                {
                    foreach (var cheque in chequeList)
                    {
                        bool isCheckexist   = false;
                        var  dbCheckDetails = database.Cheques.SingleOrDefault(hc => hc.CQNO == cheque.CQNO);
                        if (dbCheckDetails != null)
                        {
                            isCheckexist = true;
                        }
                        else
                        {
                            dbCheckDetails = new Cheque();
                        }
                        dbCheckDetails.CQNO   = Convert.ToInt32(cheque.CQNO);
                        dbCheckDetails.TPLNO  = (String.Format("{0:ddMMyyyy}", DateTime.Now.Date).Replace(" ", String.Empty)) + (samp.T_Sno);
                        dbCheckDetails.CQDATE = cheque.CQDATE;
                        dbCheckDetails.BANK   = cheque.BANK;
                        dbCheckDetails.AMOUNT = cheque.AMOUNT;
                        if (!isCheckexist)
                        {
                            database.Cheques.Add(dbCheckDetails);
                        }
                        database.SaveChanges();
                    }
                }
                bool   isrecordexist  = false;
                string TapalNo        = string.Empty;
                var    dbInWardDetail = database.Inwards.SingleOrDefault(hc => hc.TPLNO == samp.TPLNO);
                if (dbInWardDetail != null)
                {
                    isrecordexist = true;
                }
                else
                {
                    dbInWardDetail          = new Inward();
                    TapalNo                 = (String.Format("{0:ddMMyyyy}", DateTime.Now.Date).Replace(" ", String.Empty)) + (samp.T_Sno);
                    dbInWardDetail.TPLNO    = TapalNo;
                    dbInWardDetail.T_Sno    = samp.T_Sno;
                    dbInWardDetail.T_Cheque = frm["Check1"] != null ? "Y" : "N";
                    dbInWardDetail.Date_in  = DateTime.Now.Date;
                }
                dbInWardDetail.T_From          = samp.T_From;
                dbInWardDetail.T_Dept          = frm["hdndepartmentDropDown"];
                dbInWardDetail.T_Subject       = samp.T_Subject;
                dbInWardDetail.T_Subject_Value = samp.T_Subject_Value;
                dbInWardDetail.T_Section       = frm["hdnsectionDropdownId"];
                dbInWardDetail.T_User          = "******";
                dbInWardDetail.T_Passout       = samp.T_Passout;
                dbInWardDetail.wfcpno          = samp.wfcpno;
                dbInWardDetail.Issue           = false;
                if (!isrecordexist)
                {
                    database.Inwards.Add(dbInWardDetail);
                }
                database.SaveChanges();
                if (!string.IsNullOrEmpty(TapalNo))
                {
                    TempData["TapalNo"] = TapalNo;
                }
                return(RedirectToAction("Create", "Inward"));
            }
        }