public ActionResult Form(int?id)
        {
            if (Session["UserID"] == null)
            {
                return(RedirectToAction("Login", "Profile"));
            }

            HighlightNews HighlightNews;
            string        action = "New Data";

            if (id == null)
            {
                HighlightNews            = new HighlightNews();
                HighlightNews.CREATED_AT = ClassFunction.GetServerTime();
            }
            else
            {
                action        = "Update Data";
                HighlightNews = db.HighlightNews.Find(id);
            }

            if (HighlightNews == null)
            {
                return(HttpNotFound());
            }


            ViewBag.action = action;
            return(View(HighlightNews));
        }
Esempio n. 2
0
        // GET: Currency/Create
        public ActionResult Form(int?id)
        {
            if (Session["UserID"] == null)
            {
                return(RedirectToAction("Login", "Profile"));
            }
            //if (ClassFunction.checkPagePermission(this.ControllerContext.RouteData.Values["controller"].ToString(), (List<RoleDetail>)Session["Role"]))
            //    return RedirectToAction("NotAuthorize", "Profile");

            Promo  Promo;
            string action = "New Data";

            if (id == null)
            {
                Promo            = new Promo();
                Promo.CREATED_AT = ClassFunction.GetServerTime();
                //Promo.createtime = ClassFunction.GetServerTime();
            }
            else
            {
                action = "Update Data";
                Promo  = db.Promoes.Find(id);
            }

            if (Promo == null)
            {
                return(HttpNotFound());
            }


            ViewBag.action = action;
            return(View(Promo));
        }
Esempio n. 3
0
        public ActionResult Form(int?id)
        {
            if (Session["UserID"] == null)
            {
                return(RedirectToAction("Login", "Profile"));
            }

            Media  media;
            string action = "New Data";

            if (id == null)
            {
                media            = new Media();
                media.CREATED_AT = ClassFunction.GetServerTime();
            }
            else
            {
                action = "Update Data";
                media  = db.Media.Find(id);
            }

            if (media == null)
            {
                return(HttpNotFound());
            }


            ViewBag.action = action;
            return(View(media));
        }
Esempio n. 4
0
        public ActionResult Form(int?id)
        {
            if (Session["UserID"] == null)
            {
                return(RedirectToAction("Login", "Profile"));
            }
            FAQ    FAQ;
            string action = "New Data";

            if (id == null)
            {
                FAQ            = new FAQ();
                FAQ.CREATED_AT = ClassFunction.GetServerTime();
            }
            else
            {
                action = "Update Data";
                FAQ    = db.FAQ.Find(id);
            }

            if (FAQ == null)
            {
                return(HttpNotFound());
            }


            ViewBag.action = action;
            return(View(FAQ));
        }
Esempio n. 5
0
        public ActionResult Form(int?id)
        {
            if (Session["UserID"] == null)
            {
                return(RedirectToAction("Login", "Profile"));
            }

            Store  Store;
            string action = "New Data";

            if (id == null)
            {
                Store            = new Store();
                Store.CREATED_AT = ClassFunction.GetServerTime();
            }
            else
            {
                action = "Update Data";
                Store  = db.Stores.Find(id);
            }

            if (Store == null)
            {
                return(HttpNotFound());
            }


            ViewBag.action = action;
            return(View(Store));
        }
Esempio n. 6
0
        public ActionResult Form(int?id)
        {
            if (Session["UserID"] == null)
            {
                return(RedirectToAction("Login", "Profile"));
            }

            Katalogue Katalogues;
            string    action = "New Data";

            if (id == null)
            {
                Katalogues            = new Katalogue();
                Katalogues.CREATED_AT = ClassFunction.GetServerTime();
            }
            else
            {
                action     = "Update Data";
                Katalogues = db.Katalogues.Find(id);
            }

            if (Katalogues == null)
            {
                return(HttpNotFound());
            }


            ViewBag.action = action;
            return(View(Katalogues));
        }
        public ActionResult GetDataDashboardShipment()
        {
            var startperiod = ClassFunction.GetServerTime().ToString("01/01/yyyy") + " 00:00:00";
            var endperiod   = ClassFunction.GetServerTime().ToString("MM/dd/yyyy") + " 23:59:59";

            sSql  = "SELECT divname, SUM(totalshipment) totalshipment FROM (";
            sSql += "SELECT arm.cmpcode, (SELECT divname FROM QL_mstdivision div WHERE div.cmpcode=arm.cmpcode) divname, (SELECT groupcode + ' - ' + groupdesc FROM QL_mstdeptgroup dgm WHERE dgm.cmpcode=arm.cmpcode AND dgm.groupoid=som.groupoid) groupdesc, (SELECT currcode FROM QL_mstcurr c WHERE c.curroid=arm.curroid) currcode, SUM(aritemdtlnetto) totalshipment FROM QL_trnaritemmst arm INNER JOIN QL_trnaritemdtl ard ON ard.cmpcode=arm.cmpcode AND ard.aritemmstoid=arm.aritemmstoid INNER JOIN QL_trnshipmentitemdtl shd ON shd.cmpcode=ard.cmpcode AND shd.shipmentitemdtloid=ard.shipmentitemdtloid INNER JOIN QL_trndoitemdtl dod ON dod.cmpcode=shd.cmpcode AND dod.doitemdtloid=shd.doitemdtloid INNER JOIN QL_trnsoitemmst som ON som.cmpcode=dod.cmpcode AND som.soitemmstoid=dod.soitemmstoid WHERE aritemmststatus IN ('Approved', 'Closed') AND aritemdate <= CAST('" + endperiod + "' AS DATETIME) GROUP BY arm.cmpcode, som.groupoid, arm.curroid";
            sSql += ") QL_totalshipment GROUP BY divname ORDER BY divname";

            List <dbshipmentmodel> dataDtl = db.Database.SqlQuery <dbshipmentmodel>(sSql).ToList();

            return(Json(dataDtl, JsonRequestBehavior.AllowGet));
        }
Esempio n. 8
0
        public ActionResult Form(HighlightPromotion HighlightPromotion, string action)
        {
            if (Session["UserID"] == null)
            {
                return(RedirectToAction("Login", "Profile"));
            }
            HighlightPromotion.CREATED_AT = ClassFunction.GetServerTime();
            sSql = "select top 1 max(ID) + 1 from HighlightPromotion";
            var mstoid = db.Database.SqlQuery <Decimal>(sSql).FirstOrDefault();

            if (ModelState.IsValid)
            {
                using (var objTrans = db.Database.BeginTransaction())
                {
                    try
                    {
                        if (action == "New Data")
                        {
                            if (db.HighlightPromotion.Find(HighlightPromotion.ID) != null)
                            {
                                HighlightPromotion.ID = mstoid;
                            }
                            sSql = "INSERT INTO HighlightPromotion (TITLE, SUBTITLE, CREATED_AT, UPDATED_AT, CONTEN) VALUES('" + HighlightPromotion.TITLE + "', '" + HighlightPromotion.SUBTITLE + "', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, '" + HighlightPromotion.CONTEN + "')";
                            db.Database.ExecuteSqlCommand(sSql);
                            db.SaveChanges();
                        }
                        else
                        {
                            sSql = "UPDATE HighlightPromotion SET TITLE='" + HighlightPromotion.TITLE + "', SUBTITLE='" + HighlightPromotion.SUBTITLE + "', CREATED_AT=CURRENT_TIMESTAMP, UPDATED_AT=CURRENT_TIMESTAMP, CONTEN='" + HighlightPromotion.CONTEN + "' WHERE ID=" + HighlightPromotion.ID + "";
                            db.Database.ExecuteSqlCommand(sSql);

                            db.SaveChanges();
                        }

                        objTrans.Commit();
                        return(RedirectToAction("Index"));
                    }
                    catch (Exception ex)
                    {
                        objTrans.Rollback();
                        ModelState.AddModelError("", ex.ToString());
                    }
                }
            }
            ViewBag.action = action;
            return(View(HighlightPromotion));
        }
        public ActionResult DeleteConfirmed(int id)
        {
            if (Session["UserID"] == null)
            {
                return(RedirectToAction("Login", "Profile"));
            }
            HighlightKatalogues list = db.HighlightKatalogues.Find(id);
            var servertime           = ClassFunction.GetServerTime();

            string result = "success";
            string msg    = "";

            if (list == null)
            {
                result = "failed";
                msg    = "Data can't be found!";
            }

            if (result == "success")
            {
                using (var objTrans = db.Database.BeginTransaction())
                {
                    try
                    {
                        if (list != null)
                        {
                            if (System.IO.File.Exists(Server.MapPath(list.IMAGE_COVER)))
                            {
                                System.IO.File.Delete(Server.MapPath(list.IMAGE_COVER));
                            }
                        }
                        sSql = "DELETE FROM HighlightKatalogues WHERE ID=" + list.ID;
                        db.Database.ExecuteSqlCommand(sSql);
                        db.SaveChanges();

                        objTrans.Commit();
                    }
                    catch (Exception ex)
                    {
                        objTrans.Rollback();
                        result = "failed";
                        msg    = ex.ToString();
                    }
                }
            }
            return(Json(new { result, msg }, JsonRequestBehavior.AllowGet));
        }
Esempio n. 10
0
        public ActionResult Form(Media media, string action)
        {
            if (Session["UserID"] == null)
            {
                return(RedirectToAction("Login", "Profile"));
            }
            media.CREATED_AT = ClassFunction.GetServerTime();
            sSql             = "select top 1 max(ID) + 1 from Media";
            var mstoid = db.Database.SqlQuery <Decimal>(sSql).FirstOrDefault();

            if (ModelState.IsValid)
            {
                using (var objTrans = db.Database.BeginTransaction())
                {
                    try
                    {
                        if (action == "New Data")
                        {
                            sSql = "INSERT INTO media (MEDIA_ID, DATA_TYPE, CREATED_AT, UPDATED_AT) VALUES('" + media.MEDIA_ID + "', '" + media.DATA_TYPE + "', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP)";
                            db.Database.ExecuteSqlCommand(sSql);
                            db.SaveChanges();
                        }
                        else
                        {
                            sSql = "UPDATE Media SET TITLE='" + media.MEDIA_ID + "', SUBTITLE='" + media.DATA_TYPE + "', CREATED_AT=CURRENT_TIMESTAMP, UPDATED_AT=CURRENT_TIMESTAMP WHERE ID=" + media.ID + "";
                            db.Database.ExecuteSqlCommand(sSql);

                            db.SaveChanges();
                        }

                        objTrans.Commit();
                        return(RedirectToAction("Index"));
                    }
                    catch (Exception ex)
                    {
                        objTrans.Rollback();
                        ModelState.AddModelError("", ex.ToString());
                    }
                }
            }
            ViewBag.action = action;
            return(View(media));
        }
Esempio n. 11
0
        public ActionResult Form(Store Store, string action)
        {
            if (Session["UserID"] == null)
            {
                return(RedirectToAction("Login", "Profile"));
            }
            Store.CREATED_AT = ClassFunction.GetServerTime();
            sSql             = "select top 1 max(ID) + 1 from Store";
            var mstoid = db.Database.SqlQuery <Decimal>(sSql).FirstOrDefault();

            if (ModelState.IsValid)
            {
                using (var objTrans = db.Database.BeginTransaction())
                {
                    try
                    {
                        if (action == "New Data")
                        {
                            sSql = "INSERT INTO Store (TITLE, SUBTITLE, CREATED_AT, UPDATED_AT) VALUES('" + Store.NAME + "', '" + Store.PHONE + "', '" + Store.WHATSAPP + "', '" + Store.WORK_HOUR + "', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP)";
                            db.Database.ExecuteSqlCommand(sSql);
                            db.SaveChanges();
                        }
                        else
                        {
                            sSql = "UPDATE Store SET NAME='" + Store.NAME + "', PHONE='" + Store.PHONE + "',  WHATSAPP='" + Store.WHATSAPP + "',  WORK HOUR='" + Store.WORK_HOUR + "',CREATED_AT=CURRENT_TIMESTAMP, UPDATED_AT=CURRENT_TIMESTAMP WHERE ID=" + Store.ID + "";
                            db.Database.ExecuteSqlCommand(sSql);

                            db.SaveChanges();
                        }

                        objTrans.Commit();
                        return(RedirectToAction("Index"));
                    }
                    catch (Exception ex)
                    {
                        objTrans.Rollback();
                        ModelState.AddModelError("", ex.ToString());
                    }
                }
            }
            ViewBag.action = action;
            return(View(Store));
        }
        public ActionResult Index()
        {
            if (Session["UserID"] == null)
            {
                return(RedirectToAction("Login", "Profile"));
            }

            ViewBag.StartPeriod = ClassFunction.GetServerTime().ToString("MM/01/yyyy");
            ViewBag.EndPeriod   = ClassFunction.GetServerTime().ToString("MM/dd/yyyy");
            List <SelectListItem> DDLYear = new List <SelectListItem>();
            int start = DateTime.Today.Year;
            int end   = 2013;

            for (int i = start; i >= end; i--)
            {
                var item = new SelectListItem();
                item.Text  = i.ToString().ToUpper();
                item.Value = i.ToString();
                DDLYear.Add(item);
            }
            ViewBag.FilterYearAvgInventRM = DDLYear;
            ViewBag.FilterYearAvgInventKY = DDLYear;
            return(View());
        }
Esempio n. 13
0
        public ActionResult Form(Promo Promo, string action)
        {
            if (Session["UserID"] == null)
            {
                return(RedirectToAction("Login", "Profile"));
            }
            //if (ClassFunction.checkPagePermission(this.ControllerContext.RouteData.Values["controller"].ToString(), (List<RoleDetail>)Session["Role"]))
            //    return RedirectToAction("NotAuthorize", "Profile");
            //qL_mstcurr.upduser = Session["UserID"].ToString();
            Promo.CREATED_AT = ClassFunction.GetServerTime();
            //if (qL_mstcurr.currencycode.Length > 10)
            //{
            //    ModelState.AddModelError("currencycode", "Currency Code can't be longer than 10 characters");
            //}
            //if (qL_mstcurr.currencydesc.Length > 100)
            //{
            //    ModelState.AddModelError("currencydesc", "Description can't be longer than 100 character");
            //}
            //if (!string.IsNullOrEmpty(qL_mstcurr.currencynote)) {
            //    if (qL_mstcurr.currencynote.Length > 100)
            //    {
            //        ModelState.AddModelError("currencynote", "Currency Note can't be longer than 100 character");
            //    }
            //}
            //int mstoid = db.QL_mstcurr.Any() ? db.QL_mstcurr.Max(o => o.currencyoid) + 1 : 1;
            sSql = "select top 1 max(ID) + 1 from Promo";
            var mstoid = db.Database.SqlQuery <Decimal>(sSql).FirstOrDefault();

            if (ModelState.IsValid)
            {
                using (var objTrans = db.Database.BeginTransaction())
                {
                    try
                    {
                        if (action == "New Data")
                        {
                            //qL_mstcurr.cmpcode = Session["CompnyCode"].ToString();
                            //qL_mstcurr.currencyoid = mstoid;
                            if (db.Promoes.Find(Promo.ID) != null)
                            {
                                Promo.ID = mstoid;
                            }
                            //qL_mstcurr.createuser = Session["UserID"].ToString();
                            //Promo.CREATED_AT = ClassFunction.GetServerTime();
                            //Promo.UPDATED_AT = Promo.CREATED_AT;
                            //db.QL_mstcurr.Add(qL_mstcurr);
                            sSql = "INSERT INTO Promo (TITLE, SUBTITLE, CREATED_AT, UPDATED_AT, CONTEN) VALUES('" + Promo.TITLE + "', '" + Promo.SUBTITLE + "', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, '" + Promo.CONTEN + "')";
                            db.Database.ExecuteSqlCommand(sSql);

                            //sSql = "UPDATE QL_mstoid SET lastoid=" + qL_mstcurr.currencyoid + " WHERE tablename='QL_MSTCURR' AND cmpcode='" + CompnyCode + "'";
                            //db.Database.ExecuteSqlCommand(sSql);
                            db.SaveChanges();
                        }
                        else
                        {
                            //db.Entry(qL_mstcurr).State = EntityState.Modified;
                            sSql = "UPDATE Promo SET TITLE='" + Promo.TITLE + "', SUBTITLE='" + Promo.SUBTITLE + "', CREATED_AT=CURRENT_TIMESTAMP, UPDATED_AT=CURRENT_TIMESTAMP, CONTEN='" + Promo.CONTEN + "' WHERE ID=" + Promo.ID + "";
                            db.Database.ExecuteSqlCommand(sSql);

                            db.SaveChanges();
                        }
                        objTrans.Commit();
                        return(RedirectToAction("Index"));
                    }
                    catch (Exception ex)
                    {
                        objTrans.Rollback();
                        ModelState.AddModelError("", ex.ToString());
                    }
                }
            }
            ViewBag.action = action;
            return(View(Promo));
        }
        public ActionResult Form(HighlightKatalogues HighlightKatalogues, string action)
        {
            if (Session["UserID"] == null)
            {
                return(RedirectToAction("Login", "Profile"));
            }
            HighlightKatalogues.CREATED_AT = ClassFunction.GetServerTime();
            sSql = "select top 1 max(ID) + 1 from HighlightKatalogues";
            var mstoid = db.Database.SqlQuery <Decimal>(sSql).FirstOrDefault();

            if (ModelState.IsValid)
            {
                using (var objTrans = db.Database.BeginTransaction())
                {
                    try
                    {
                        if (System.IO.File.Exists(Server.MapPath(HighlightKatalogues.IMAGE_COVER)))
                        {
                            var sExt      = Path.GetExtension(HighlightKatalogues.IMAGE_COVER);
                            var sdir      = Server.MapPath(locimgpath);
                            var sfilename = HighlightKatalogues.ID + sExt;
                            if (!Directory.Exists(sdir))
                            {
                                DirectorySecurity securityRules = new DirectorySecurity();
                                securityRules.AddAccessRule(new FileSystemAccessRule("Everyone", FileSystemRights.FullControl, InheritanceFlags.ContainerInherit | InheritanceFlags.ObjectInherit, PropagationFlags.None, AccessControlType.Allow));
                                Directory.CreateDirectory(sdir, securityRules);
                            }
                            if (HighlightKatalogues.IMAGE_COVER.ToLower() != (locimgpath + "/" + sfilename).ToLower())
                            {
                                System.IO.File.Delete(sdir + "/" + sfilename);
                                System.IO.File.Move(Server.MapPath(HighlightKatalogues.IMAGE_COVER), sdir + "/" + sfilename);
                            }
                            HighlightKatalogues.IMAGE_COVER = locimgpath + "/" + sfilename;
                        }

                        if (action == "New Data")
                        {
                            sSql = "INSERT INTO HighlightKatalogues (TITLE, SUBTITLE,IMAGE_COVER, CREATED_AT, UPDATED_AT) VALUES('" + HighlightKatalogues.TITLE + "', '" + HighlightKatalogues.SUBTITLE + "', '" + Request.Url.Scheme + "://" + Request.Url.Host + ":90" + System.Web.VirtualPathUtility.ToAbsolute(HighlightKatalogues.IMAGE_COVER) + "', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP)";
                            db.Database.ExecuteSqlCommand(sSql);
                            db.SaveChanges();
                        }
                        else
                        {
                            sSql = "UPDATE HighlightKatalogues SET TITLE='" + HighlightKatalogues.TITLE + "', SUBTITLE='" + HighlightKatalogues.SUBTITLE + "', IMAGE_COVER='" + Request.Url.Scheme + "://" + Request.Url.Host + ":90" + System.Web.VirtualPathUtility.ToAbsolute(HighlightKatalogues.IMAGE_COVER) + "' , CREATED_AT=CURRENT_TIMESTAMP, UPDATED_AT=CURRENT_TIMESTAMP WHERE ID=" + HighlightKatalogues.ID + "";
                            db.Database.ExecuteSqlCommand(sSql);

                            db.SaveChanges();
                        }

                        objTrans.Commit();
                        return(RedirectToAction("Index"));
                    }
                    catch (Exception ex)
                    {
                        objTrans.Rollback();
                        ModelState.AddModelError("", ex.ToString());
                    }
                }
            }
            ViewBag.action = action;
            return(View(HighlightKatalogues));
        }