Beispiel #1
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));
     }
 }
        // 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());
        }
        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"));
        }
        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"));
            }
        }
Beispiel #5
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"));
            }
        }