コード例 #1
0
        public ActionResult Edit(DEPOSIT deposit)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    OCCUSER user = (OCCUSER)Session["User"];
                    deposit.CREATEDBY = user.ID;
                    deposit.ISACTIVE = true;
                    deposit.ISDELETE = false;

                    db.Entry(deposit).State = EntityState.Modified;
                    //db.DEPOSIT.AddOrUpdate(x=>x.ID==deposit.ID);
                    db.SaveChanges();
                    var msg = "Successfully Updated";
                    return Json(msg, JsonRequestBehavior.AllowGet);

                }
                List<string> currencyList = new List<string>() { "USD", "BDT" };

                ViewBag.BRANCH = new SelectList(db.BRANCHINFO.ToList(), "ID", "BRANCHNAME", db.DEPOSIT.Select(x => x.BRANCH));
                ViewBag.CURRENCY = new SelectList(currencyList, null, null, db.DEPOSIT.Select(x => x.CURRENCY));
                return View(deposit);
            }
            catch (Exception)
            {

                return RedirectToAction("Error", "Home", new { Area = "" });
            }
        }
コード例 #2
0
ファイル: HomeController.cs プロジェクト: bonyRocker/CCM
        public ActionResult Form(DEPOSIT deposit)
        {
            try
            {
                OCCUSER user = (OCCUSER)Session["User"];
                int adminFlag = 0;
                if (deposit.ID == 0)
                {
                    deposit.CREATEDBY = user.ID;
                    deposit.ISACTIVE = true;
                    deposit.ISDELETE = false;
                    deposit.ISDOWNLOAD = false;
                    var refNo = DateTime.Now.ToString("ddMMyyHHmmssfff");
                    //refNo += deposit.CARDNUMBER.Substring(deposit.CARDNUMBER.Length - 4);
                    deposit.REFERENCENUMBER = refNo;
                    db.DEPOSIT.Add(deposit);
                    db.SaveChanges();
                    //  Session["DepositSaveMsg"] = "Data saved successfully.\nReferance Number is: "+deposit.REFERENCENUMBER;
                    var msg = @"Data saved successfully.<br/>Referance Number is: " + deposit.REFERENCENUMBER;
                    if (user.TYPE == 1)
                    {
                        adminFlag = 1;
                    }
                    // return RedirectToAction("Index", "List");
                    return Json(new { msg, adminFlag }, JsonRequestBehavior.AllowGet);
                }
                else
                {
                    if (ModelState.IsValid)
                    {
                        deposit.CREATEDBY = user.ID;
                        deposit.ISACTIVE = true;
                        deposit.ISDELETE = false;
                        deposit.ISDOWNLOAD = false;

                        db.Entry(deposit).State = EntityState.Modified;
                        if (user.TYPE == 1)
                        {
                            adminFlag = 1;
                        }
                        //db.DEPOSIT.AddOrUpdate(x=>x.ID==deposit.ID);
                        db.SaveChanges();
                        var msg = "Successfully Updated";
                        return Json(new { msg, adminFlag }, JsonRequestBehavior.AllowGet);

                    }
                    List<string> currencyList = new List<string>() { "USD", "BDT" };

                    ViewBag.BRANCH = new SelectList(db.BRANCHINFO.ToList(), "ID", "BRANCHNAME", db.DEPOSIT.Select(x => x.BRANCH));
                    ViewBag.CURRENCY = new SelectList(currencyList, null, null, db.DEPOSIT.Select(x => x.CURRENCY));
                    return View(deposit);
                }

            }
            catch (Exception exception)
            {
                return RedirectToAction("Error", "Home", new { Area = "" });
            }
        }
コード例 #3
0
        public ActionResult Index(DEPOSIT deposit)
        {
            OCCUSER user = (OCCUSER)Session["User"];
            int adminFlag = 0;
            if (ModelState.IsValid)
            {
                try
                {

                    deposit.CREATEDBY = user.ID;
                    deposit.ISACTIVE = true;
                    deposit.ISDELETE = false;
                    //var userId = user.EMPLOYEEID;
                    //var length = userId.Length;
                    //char first = userId[0];
                    //char last = userId[userId.Length - 1];
                    //char middle = userId[(userId.Length - 1) / 2];
                    //var refNo = (first + middle + last).ToString(CultureInfo.InvariantCulture);
                    //refNo += length;
                    var refNo= DateTime.Now.ToString("ddMMyyHHmmssfff");
                    //refNo += deposit.CARDNUMBER.Substring(deposit.CARDNUMBER.Length - 4);
                    deposit.REFERENCENUMBER = refNo;
                    db.DEPOSIT.Add(deposit);
                    db.SaveChanges();
                  //  Session["DepositSaveMsg"] = "Data saved successfully.\nReferance Number is: "+deposit.REFERENCENUMBER;
                    var msg=@"Data saved successfully.<br/>Referance Number is: "+deposit.REFERENCENUMBER;
                    if (user.TYPE == 1)
                    {
                        adminFlag = 1;
                    }
                   // return RedirectToAction("Index", "List");
                    return Json(new{msg,adminFlag},JsonRequestBehavior.AllowGet);
                }
                catch (Exception exception)
                {
                    return Json("Error", JsonRequestBehavior.DenyGet);
                    //  return RedirectToAction("Error", "Home", new { Area = "" });
                }

            }
            List<string> currencyList = new List<string>() {"BDT" };
            ViewBag.BRANCH = new SelectList(db.BRANCHINFO.ToList(), "ID", "BRANCHNAME");
            ViewBag.CURRENCY = new SelectList(currencyList);
            Session["DepositSaveMsg"] = "Data not saved";
            return View(deposit);
        }
コード例 #4
0
ファイル: PaymentController.cs プロジェクト: bonyRocker/CCM
        public ActionResult Details(DEPOSIT deposit, string btnName)
        {
            try
            {
                OCCUSER user = (OCCUSER)Session["User"];
                if (String.Equals(btnName, "update"))
                {
                    DEPOSIT deposits = db.DEPOSIT.Find(deposit.ID);

                    deposit.CREATEDBY = deposits.CREATEDBY;
                    deposit.CREATEDON = deposits.CREATEDON;
                    deposit.MODIFIEDBY = user.ID;
                    deposit.MODIFIEDON = DateTime.Now;
                    deposit.ISACTIVE = true;
                    deposit.ISDELETE = false;
                    //db.Entry(deposit).State = EntityState.Modified;
                    db.DEPOSIT.AddOrUpdate(deposit);
                    db.SaveChanges();
                    var msg = "Successfully Updated";
                    return Json(msg, JsonRequestBehavior.AllowGet);
                }
                if (String.Equals(btnName, "delete"))
                {

                    DEPOSIT depostis = db.DEPOSIT.Find(deposit.ID);
                    depostis.ISDELETE = true;
                    db.Entry(depostis).State = EntityState.Modified;
                    db.SaveChanges();
                    var msg = "Successfully Removed";
                    return Json(msg, JsonRequestBehavior.AllowGet);
                }
                return RedirectToAction("Error", "Home", new { Area = "" });
            }
            catch (Exception exception)
            {
                var msg = exception.Message;
                return Json(msg, JsonRequestBehavior.AllowGet);
            }
        }