public ActionResult EditItemClass(ItemclassViewModel model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    DbfunctionUtility dbfunction = new DbfunctionUtility(_appSettings);
                    var     query = "select * from tov.itemclass where class = '" + model.Class + "' and class !='" + model.ClassId + "' ";
                    DataSet ds    = dbfunction.GetDataset(query);
                    if (ds.Tables[0].Rows.Count == 0)
                    {
                        query = " update tov.itemclass set   Class = '" + model.Class + "',`Desc`= '" + model.Desc + "',Dept = '" + model.Dept + "',Market = '" + model.Market + "',Deptnum = '" + model.Deptnum + "',Buyer = '" + model.Buyer + "'          where class = " + model.ClassId + " ;";
                        ds    = dbfunction.GetDataset(query);
                        query = "update HEANDB.itemclass set   Class = '" + model.Class + "',`Desc`= '" + model.Desc + "',Dept = '" + model.Dept + "',Market = '" + model.Market + "',Deptnum = '" + model.Deptnum + "',Buyer = '" + model.Buyer + "'          where class = " + model.ClassId + " ;";
                        ds    = dbfunction.GetDataset(query);
                        ViewBag.SuccessMessage = "Class updated successfully";
                    }
                    else
                    {
                        ViewBag.ErrorMessage = "Class name is already exists";
                    }
                }
            }
            catch (Exception ex)
            {
            }

            return(View(model));
        }
        public ActionResult EditDeptProjection(DeptProjectionViewModel model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    DbfunctionUtility dbfunction = new DbfunctionUtility(_appSettings);
                    var     query = "select * from tov.DeptProjection where DeptName = '" + model.DeptName + "' and mm =" + model.mm + " and   DeptName != '" + model.DeptNameId + "' and mm !=" + model.mmId + " ";
                    DataSet ds    = dbfunction.GetDataset(query);
                    if (ds.Tables[0].Rows.Count == 0)
                    {
                        query = " update tov.DeptProjection set   DeptName = '" + model.DeptName + "',mm = " + model.mm + ",Projection = " + model.Projection + "   where  DeptName = '" + model.DeptNameId + "' and mm =" + model.mmId + " ;";
                        ds    = dbfunction.GetDataset(query);
                        ViewBag.SuccessMessage = "Department projection detail updated successfully";
                    }
                    else
                    {
                        ViewBag.ErrorMessage = "Department projection detail is already exists";
                    }
                }
            }
            catch (Exception ex)
            {
            }

            return(View(model));
        }
        public ActionResult EditDeptAmount(DeptAmountViewModel model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    DbfunctionUtility dbfunction = new DbfunctionUtility(_appSettings);
                    var     query = "select * from deptamount where Dept = '" + model.Dept + "'  and   deptamount_id != '" + model.deptamount_id + "'  ";
                    DataSet ds    = dbfunction.GetDataset(query);
                    if (ds.Tables[0].Rows.Count == 0)
                    {
                        query = " update deptamount set   Dept = '" + model.Dept + "', Amount = " + model.Amount + "   where  deptamount_id = '" + model.deptamount_id + "';";
                        ds    = dbfunction.GetDataset(query);
                        ViewBag.SuccessMessage = "Department amount detail updated successfully";
                    }
                    else
                    {
                        ViewBag.ErrorMessage = "Department amount detail is already exists";
                    }
                }
            }
            catch (Exception ex)
            {
            }

            return(View(model));
        }
        public ActionResult AddItemClass(ItemclassViewModel model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    DbfunctionUtility dbfunction = new DbfunctionUtility(_appSettings);
                    var     query = "select * from tov.itemclass where class = '" + model.Class + "'";
                    DataSet ds    = dbfunction.GetDataset(query);
                    if (ds.Tables[0].Rows.Count == 0)
                    {
                        query = "insert into tov.itemclass (Class,`Desc`,Dept,Market,Deptnum,Buyer) values ('" + model.Class + "', '" + model.Desc + "', '" + model.Dept + "', '" + model.Market + "', '" + model.Deptnum + "', '" + model.Buyer + "');insert into HEANDB.itemclass (Class,`Desc`,Dept,Market,Deptnum,Buyer) values ('" + model.Class + "', '" + model.Desc + "', '" + model.Dept + "', '" + model.Market + "', '" + model.Deptnum + "', '" + model.Buyer + "')";
                        ds    = dbfunction.GetDataset(query);
                        ViewBag.SuccessMessage = "Class added successfully";
                    }
                    else
                    {
                        ViewBag.ErrorMessage = "Class name is already exists";
                    }
                }
            }
            catch (Exception ex)
            {
            }

            return(View(model));
        }
예제 #5
0
        public JsonResult Delete(string id)
        {
            ResponseModel response = new ResponseModel();

            try
            {
                int iId = Convert.ToInt32(id);
                QuestionViewModel model      = new QuestionViewModel();
                DbfunctionUtility dbfunction = new DbfunctionUtility(_appSettings);
                var checkTest = _dbContext.tbl_UserTests.Where(w => w.TestId == iId).Count();
                if (checkTest == 0)
                {
                    var     query = " update tests set IsActive = 0   where Id ='" + id + "' ;";
                    DataSet ds    = dbfunction.GetDataset(query);
                    response.Status  = "1";
                    response.Message = "Test deleted successfully";
                }
                else
                {
                    response.Status  = "0";
                    response.Message = "Test has been given by CareGiver for this test";
                }
            }
            catch (Exception ex)
            {
            }

            return(Json(response));
        }
        public JsonResult GetOrderNotes(string ordernum, DateTime orderDate)
        {
            ResponseModel response = new ResponseModel();

            try
            {
                var year = orderDate.Year.ToString().Substring(2, 2);
                ItemclassViewModel model      = new ItemclassViewModel();
                DbfunctionUtility  dbfunction = new DbfunctionUtility(_appSettings);
                var     query = "select * from ordernotes where (SUBSTRING(('" + ordernum + " '),1,6)=  Ordernum AND  SUBSTRING(('" + ordernum + "'),8,2)= Year)  ";
                DataSet ds    = dbfunction.GetDataset(query);
                if (ds.Tables.Count > 0)
                {
                    var notes = (from row in ds.Tables[0].AsEnumerable()
                                 select new OrderNoteViewModel
                    {
                        Line = Convert.ToString(row["Line"]) == "" ? 0 : Convert.ToInt32(row["Line"]),
                        Year = Convert.ToString(row["Year"]),
                        Ordernum = Convert.ToString(row["Ordernum"]),
                        Note = Convert.ToString(row["Note"]),
                    }).ToList();

                    return(Json(notes));
                }
                return(Json(response));
            }
            catch (Exception ex)
            {
            }

            return(Json(response));
        }
        public ActionResult Detail(string id)
        {
            List <Order_DetailViewModel> order_DetailList = new List <Order_DetailViewModel>();

            try
            {
                if (String.IsNullOrEmpty(id))
                {
                    return(RedirectToAction("List"));
                }

                ViewBag.OrderNo = id;
                DbfunctionUtility dbfunction = new DbfunctionUtility(_appSettings);
                DataSet           ds         = dbfunction.GetDataset("select * from orderlines where Ordernum ='" + id + "' order by Itemnum");
                order_DetailList = (from row in ds.Tables[0].AsEnumerable()
                                    select new Order_DetailViewModel
                {
                    Ordernum = Convert.ToString(row["Ordernum"]),
                    Itemnum = Convert.ToString(row["Itemnum"]),
                    Qtyordered = Convert.ToInt32(row["Qtyordered"]),
                    Qtyinvoiced = Convert.ToInt32(row["Qtyinvoiced"]),
                    Saleprice = Convert.ToDecimal(row["Saleprice"]),
                    Listprice = Convert.ToDecimal(row["Listprice"]),
                    Commission = Convert.ToDecimal(row["Commission"]),
                }).ToList();
            }
            catch (Exception ex)
            {
                return(RedirectToAction("List"));
            }

            return(View(order_DetailList));
        }
예제 #8
0
        public JsonResult GetOrderNotes(string bol1_no)
        {
            ResponseModel response = new ResponseModel();

            try
            {
                ItemclassViewModel model      = new ItemclassViewModel();
                DbfunctionUtility  dbfunction = new DbfunctionUtility(_appSettings);
                var     query = "select * from ordernotes where ordernum in (select bol2_order_no from bol_2 where bol2_no='" + bol1_no + "' )";
                DataSet ds    = dbfunction.GetDataset(query);
                if (ds.Tables.Count > 0)
                {
                    var notes = (from row in ds.Tables[0].AsEnumerable()
                                 select new OrderNoteViewModel
                    {
                        Line = Convert.ToString(row["Line"]) == "" ? 0 : Convert.ToInt32(row["Line"]),
                        Year = Convert.ToString(row["Year"]),
                        Ordernum = Convert.ToString(row["Ordernum"]),
                        Note = Convert.ToString(row["Note"]),
                    }).ToList();

                    return(Json(notes));
                }
                return(Json(response));
            }
            catch (Exception ex)
            {
            }

            return(Json(response));
        }
예제 #9
0
        public ActionResult BOLDetail(string id)
        {
            List <Bol_2_ViewModel> bol_2_List = new List <Bol_2_ViewModel>();

            try
            {
                if (String.IsNullOrEmpty(id))
                {
                    return(RedirectToAction("Index"));
                }
                ViewBag.OrderNo = id;
                DbfunctionUtility dbfunction = new DbfunctionUtility(_appSettings);
                DataSet           ds         = dbfunction.GetDataset("select * from bol_2  join orders on orders.ordernum = bol_2.bol2_order_no  where bol2_No =" + id);

                bol_2_List = (from row in ds.Tables[0].AsEnumerable()
                              select new Bol_2_ViewModel
                {
                    bol2_order_no = Convert.ToString(row["bol2_order_no"]) == "" ? (int?)null : Convert.ToInt32(row["bol2_order_no"]),
                    bol2_PO_No = Convert.ToString(row["bol2_PO"]),
                    bol2_pkgs = Convert.ToString(row["bol2_pkgs"]) == "" ? (int?)null : Convert.ToInt32(row["bol2_pkgs"]),
                    bol2_weight = Convert.ToString(row["bol2_weight"]) == "" ? (Decimal?)null : Convert.ToDecimal(row["bol2_weight"]),
                    bol2_value = Convert.ToString(row["bol2_value"]) == "" ? (Decimal?)null : Convert.ToDecimal(row["bol2_value"]),
                    bol2_custnum = Convert.ToString(row["bol2_custnum"]),
                    bol2_sname = Convert.ToString(row["shipname"]),
                }).ToList();
            }
            catch (Exception ex)
            {
                return(RedirectToAction("Index"));
            }

            return(View(bol_2_List));
        }
        public ActionResult Import(IFormFile file)
        {
            try
            {
                if (file == null || file.Length == 0)
                {
                    return(Content("file not selected"));
                }


                var attendantList = new List <Import_attendant>();
                using (var sreader = new StreamReader(file.OpenReadStream()))
                {
                    //First line is header. If header is not passed in csv then we can neglect the below line.
                    string[] headers = sreader.ReadLine().Split(',');
                    //Loop through the records
                    while (!sreader.EndOfStream)
                    {
                        string[] rows       = sreader.ReadLine().Split(',');
                        string   FirstName  = "";
                        string   MiddleName = "";
                        string   LastName   = "";
                        string   Email      = "";
                        string   EmployeeNo = "";
                        string   HrGroup    = "";


                        FirstName  = Convert.ToString(rows[0]);
                        MiddleName = (Convert.ToString(rows[1]));
                        LastName   = Convert.ToString(rows[2]);
                        Email      = (Convert.ToString(rows[3]));
                        EmployeeNo = (Convert.ToString(rows[4]));
                        HrGroup    = (Convert.ToString(rows[5]));


                        attendantList.Add(new Import_attendant
                        {
                            FirstName  = FirstName,
                            MiddleName = MiddleName,
                            LastName   = LastName,
                            Email      = Email,
                            EmployeeNo = EmployeeNo,
                            HrGroup    = HrGroup
                        });
                    }
                }

                _dbContext.tbl_Import_attendants.AddRange(attendantList);
                _dbContext.SaveChanges();

                DbfunctionUtility dbfunction = new DbfunctionUtility(_appSettings);
                DataSet           ds         = dbfunction.GetDataset("call import_employees();");
                ViewBag.imported = 1;
            }
            catch (Exception ex)
            {
                ViewBag.imported = 0;
            }
            return(View());
        }
        public ActionResult EditDeptProjection(string DeptName, string mm)
        {
            DeptProjectionViewModel model = new DeptProjectionViewModel();

            try
            {
                if (ModelState.IsValid)
                {
                    DbfunctionUtility dbfunction = new DbfunctionUtility(_appSettings);
                    DataSet           ds         = dbfunction.GetDataset("select * from tov.DeptProjection where DeptName= '" + DeptName + "' and  mm= " + mm + ";");

                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        model.DeptName   = Convert.ToString(ds.Tables[0].Rows[0]["DeptName"]);
                        model.DeptNameId = Convert.ToString(ds.Tables[0].Rows[0]["DeptName"]);
                        model.mm         = Convert.ToInt32(ds.Tables[0].Rows[0]["mm"]);
                        model.mmId       = Convert.ToInt32(ds.Tables[0].Rows[0]["mm"]);
                        model.Projection = Convert.ToDecimal(ds.Tables[0].Rows[0]["Projection"]);
                    }
                    else
                    {
                        return(RedirectToAction("DeptProjectionList", "DataEntry"));
                    }
                }
            }
            catch (Exception ex)
            {
            }

            return(View(model));
        }
        public ActionResult Login(LoginViewModel model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    DbfunctionUtility dbfunction = new DbfunctionUtility(_appSettings);
                    DataSet           ds         = dbfunction.GetDataset("select * from users  where username ='******' and Password ='******'");

                    if (ds.Tables[0].Rows.Count == 0)
                    {
                        ViewBag.ErrorMessage = "Incorrect username or password";
                    }
                    else
                    {
                        CommanUtility commanUtility = new CommanUtility(_appSettings);
                        var           userMenus     = commanUtility.GetUserMenus(Convert.ToString(ds.Tables[0].Rows[0]["RoleId"]));
                        HttpContext.Session.SetString("UserMenus", JsonConvert.SerializeObject(userMenus));
                        HttpContext.Session.SetString("UserId", Convert.ToString(ds.Tables[0].Rows[0]["Userid"]));
                        HttpContext.Session.SetString("RoleId", Convert.ToString(ds.Tables[0].Rows[0]["RoleId"]));
                        HttpContext.Session.SetString("Username", model.Username);
                        return(RedirectToAction("Dashboard", "Home"));
                    }
                }
            }
            catch (Exception ex)
            {
            }

            return(View(model));
        }
        public ActionResult ItemClassList()
        {
            List <ItemclassViewModel> itemClassList = new List <ItemclassViewModel>();

            try
            {
                DbfunctionUtility dbfunction = new DbfunctionUtility(_appSettings);
                DataSet           ds         = dbfunction.GetDataset("Select * from tov.itemclass");

                itemClassList = (from row in ds.Tables[0].AsEnumerable()
                                 select new ItemclassViewModel
                {
                    Class = Convert.ToString(row["Class"]),
                    Desc = Convert.ToString(row["Desc"]),
                    Dept = Convert.ToString(row["Dept"]),
                    Market = Convert.ToString(row["Market"]),
                    Deptnum = Convert.ToInt32(row["Deptnum"]),
                    Buyer = Convert.ToString(row["Buyer"])
                }).ToList();
            }
            catch (Exception Ex)
            {
            }
            return(View(itemClassList));
        }
        public ActionResult EditItemClass(string id)
        {
            ItemclassViewModel model = new ItemclassViewModel();

            try
            {
                if (ModelState.IsValid)
                {
                    DbfunctionUtility dbfunction = new DbfunctionUtility(_appSettings);
                    DataSet           ds         = dbfunction.GetDataset("select * from tov.itemclass where class= '" + id + "'");

                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        model.ClassId = Convert.ToString(ds.Tables[0].Rows[0]["Class"]);
                        model.Class   = Convert.ToString(ds.Tables[0].Rows[0]["Class"]);
                        model.Desc    = Convert.ToString(ds.Tables[0].Rows[0]["Desc"]);
                        model.Dept    = Convert.ToString(ds.Tables[0].Rows[0]["Dept"]);
                        model.Market  = Convert.ToString(ds.Tables[0].Rows[0]["Market"]);
                        model.Deptnum = Convert.ToInt32(ds.Tables[0].Rows[0]["Deptnum"]);
                        model.Buyer   = Convert.ToString(ds.Tables[0].Rows[0]["Buyer"]);
                    }
                    else
                    {
                        return(RedirectToAction("ItemClassList", "Inventory"));
                    }
                }
            }
            catch (Exception ex)
            {
            }

            return(View(model));

            return(View());
        }
        public ActionResult Detail(string id)
        {
            List <InvoicelineViewModel> invoice_DetailList = new List <InvoicelineViewModel>();

            try
            {
                if (String.IsNullOrEmpty(id))
                {
                    return(RedirectToAction("List"));
                }

                ViewBag.Invoicenum = id;
                DbfunctionUtility dbfunction = new DbfunctionUtility(_appSettings);
                DataSet           ds         = dbfunction.GetDataset("select * from v_Invoicelines where invoicenum ='" + id + "' order by Itemnum");
                invoice_DetailList = (from row in ds.Tables[0].AsEnumerable()
                                      select new InvoicelineViewModel
                {
                    Invoicenum = Convert.ToString(row["Invoicenum"]),
                    Itemnum = Convert.ToString(row["Itemnum"]),
                    Qtyordered = Convert.ToString(row["Qtyordered"]) == "" ? (Int32?)null : Convert.ToInt32(row["Qtyordered"]),
                    Qtyshipped = Convert.ToString(row["Qtyshipped"]) == "" ? (Int32?)null : Convert.ToInt32(row["Qtyshipped"]),
                    Saleprice = Convert.ToString(row["Saleprice"]) == "" ? (Decimal?)null : Convert.ToDecimal(row["Saleprice"]),
                    Listprice = Convert.ToString(row["Listprice"]) == "" ? (Decimal?)null : Convert.ToDecimal(row["Listprice"]),
                    Listlanded = Convert.ToString(row["Listlanded"]) == "" ? (Decimal?)null : Convert.ToDecimal(row["Listlanded"]),
                    Commission = Convert.ToString(row["Commission"]) == "" ? (Decimal?)null : Convert.ToDecimal(row["Commission"]),
                    Discount = Convert.ToString(row["Discount"]) == "" ? (Decimal?)null : Convert.ToDecimal(row["Discount"])
                }).ToList();
            }
            catch (Exception ex)
            {
                return(RedirectToAction("List"));
            }

            return(View(invoice_DetailList));
        }
        public ActionResult EditDeptAmount(string id)
        {
            DeptAmountViewModel model = new DeptAmountViewModel();

            try
            {
                if (ModelState.IsValid)
                {
                    DbfunctionUtility dbfunction = new DbfunctionUtility(_appSettings);
                    DataSet           ds         = dbfunction.GetDataset("select * from deptamount where deptamount_id= " + id + ";");

                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        model.Dept          = Convert.ToString(ds.Tables[0].Rows[0]["Dept"]);
                        model.Amount        = Convert.ToDecimal(ds.Tables[0].Rows[0]["Amount"]);
                        model.deptamount_id = Convert.ToInt32(id);
                    }
                    else
                    {
                        return(RedirectToAction("DeptAmountList", "DataEntry"));
                    }
                }
            }
            catch (Exception ex)
            {
            }

            return(View(model));
        }
예제 #17
0
        public ActionResult BOL()
        {
            List <Bol_1_ViewModel> bol_1_List = new List <Bol_1_ViewModel>();

            try
            {
                DbfunctionUtility dbfunction = new DbfunctionUtility(_appSettings);
                DataSet           ds         = dbfunction.GetDataset(@"SELECT * FROM  (SELECT COUNT(*)Line,Ordernum FROM ordernotes GROUP BY Ordernum )b   JOIN 
                                                     (SELECT  COUNT(*)COUNT, bol_1.bol1_no,MAX(bol1_CancelDate)bol1_CancelDate,MAX(NAME)NAME,MAX(bol1_date)bol1_date, MAX(bol2_custnum)bol2_custnum,MAX(bol1_name)bol1_name,MAX(shipaddress1)bol1_adrs1,MAX(shipaddress2)bol1_adrs2,MAX(shipaddress3)bol1_adrs3,MAX(bol1_city)bol1_city,MAX(bol1_state)bol1_state,
                                                     MAX(bol1_zip)bol1_zip,MAX(bol1_Lctn)bol1_Lctn,MAX(bol1_pro_no)bol1_pro_no,MAX(bol1_scac)bol1_scac,MAX(bol1_frght_terms)bol1_frght_terms,MAX(bol1_ttl_pkgs)bol1_ttl_pkgs,MAX(bol1_ttl_weight)bol1_ttl_weight,
                                                     MAX(bol1_ttlValue)bol1_ttlValue,MAX(bol1_HE_WH)bol1_HE_WH,MAX(bol2_order_no)bol2_order_no,MAX(clerk)bol1_ref, MAX(bol2_PO)bol1_PO_No,MIN(bol2_PO)bol1_PO_No1,MAX(bol1_carrierName)bol1_carrierName,
                                                     MAX(bol1_carrierPhone)bol1_carrierPhone,MAX(bol1_PkupDate)bol1_PkupDate,MAX(bol1_pkupTime)bol1_pkupTime,MAX(Conformation)Conformation,MAX(bol1_pallet)bol1_pallet,MAX(bol1_pallet_type)bol1_pallet_type
                                                     FROM bol_1 JOIN bol_2 ON (bol_1.bol1_no = bol_2.bol2_No )   JOIN orders ON orders.ordernum = bol_2.bol2_order_no 
                                                     # WHERE bol1_ttl_weight  IS NULL   
                                                     GROUP BY bol_1.bol1_no)a ON a.bol2_order_no = b.ordernum
                                                     ");

                bol_1_List = (from row in ds.Tables[0].AsEnumerable()
                              select new Bol_1_ViewModel
                {
                    Line = Convert.ToString(row["Line"]) == "" ? 0 : Convert.ToInt32(row["Line"]),
                    Count = Convert.ToInt32(row["count"]),
                    bol1_no = Convert.ToString(row["bol1_no"]),
                    bol1_date = Convert.ToString(row["bol1_date"]) == "" ? (DateTime?)null : Convert.ToDateTime(row["bol1_date"]),
                    bol2_custnum = Convert.ToString(row["bol2_custnum"]),
                    bol1_name = Convert.ToString(row["name"]),
                    bol1_adrs1 = Convert.ToString(row["bol1_adrs1"]),
                    bol1_adrs2 = Convert.ToString(row["bol1_adrs2"]),
                    bol1_adrs3 = Convert.ToString(row["bol1_adrs3"]),
                    bol1_city = Convert.ToString(row["bol1_city"]),
                    bol1_state = Convert.ToString(row["bol1_state"]),
                    bol1_zip = Convert.ToString(row["bol1_zip"]),
                    bol1_Lctn = Convert.ToString(row["bol1_Lctn"]),
                    bol1_pro_no = Convert.ToString(row["bol1_pro_no"]),
                    bol1_scac = Convert.ToString(row["bol1_scac"]),
                    bol1_frght_terms = Convert.ToString(row["bol1_frght_terms"]),
                    bol1_ttl_pkgs = Convert.ToString(row["bol1_ttl_pkgs"]) == "" ? (Int32?)null : Convert.ToInt32(row["bol1_ttl_pkgs"]),
                    bol1_ttl_weight = Convert.ToString(row["bol1_ttl_weight"]) == "" ? (Decimal?)null : Convert.ToDecimal(row["bol1_ttl_weight"]),
                    bol1_ttlValue = Convert.ToString(row["bol1_ttlValue"]) == "" ? (Decimal?)null : Convert.ToDecimal(row["bol1_ttlValue"]),
                    bol1_HE_WH = Convert.ToString(row["bol1_HE_WH"]),
                    bol2_order_no = Convert.ToString(row["bol2_order_no"]),
                    bol1_ref = Convert.ToString(row["bol1_ref"]),
                    bol1_PO_No = Convert.ToString(row["bol1_PO_No"]),
                    bol1_PO_No1 = Convert.ToString(row["bol1_PO_No1"]),
                    bol1_carrierName = Convert.ToString(row["bol1_carrierName"]),
                    bol1_carrierPhone = Convert.ToString(row["bol1_carrierPhone"]),
                    bol1_PkupDate = Convert.ToString(row["bol1_PkupDate"]) == "" ? (DateTime?)null : Convert.ToDateTime(row["bol1_PkupDate"]),
                    bol1_CancelDate = Convert.ToString(row["bol1_CancelDate"]) == "" ? (DateTime?)null : Convert.ToDateTime(row["bol1_CancelDate"]),
                    bol1_pkupTime = Convert.ToString(row["bol1_pkupTime"]),
                    Conformation = Convert.ToString(row["Conformation"]),
                    bol1_pallet = Convert.ToString(row["bol1_pallet"]) == "" ? (int?)null : Convert.ToInt32(row["bol1_pallet"]),
                    bol1_pallet_type = Convert.ToString(row["bol1_pallet_type"])
                }).ToList();
            }
            catch (Exception Ex)
            {
            }
            return(View(bol_1_List));
        }
예제 #18
0
        public ActionResult Import_BOL_Notes(IFormFile file)
        {
            try
            {
                if (file == null || file.Length == 0)
                {
                    return(Content("file not selected"));
                }


                var orderNoteList = new List <Tovordernote>();
                using (var sreader = new StreamReader(file.OpenReadStream()))
                {
                    //First line is header. If header is not passed in csv then we can neglect the below line.
                    string[] headers = sreader.ReadLine().Split(',');
                    //Loop through the records
                    while (!sreader.EndOfStream)
                    {
                        string[] rows     = sreader.ReadLine().Split(',');
                        string   Ordernum = "";
                        string   Year     = "";
                        int      Line     = 0;
                        string   Note     = "";


                        Ordernum = Convert.ToString(rows[0]);
                        Year     = (Convert.ToString(rows[1]));
                        int.TryParse(Convert.ToString(rows[2]), out Line);
                        Note = (Convert.ToString(rows[3]));



                        orderNoteList.Add(new Tovordernote
                        {
                            Ordernum = Ordernum,
                            Year     = Year,
                            Line     = Line,
                            Note     = Note,
                        });
                    }
                }

                _dbContext.tbl_Tovordernote.AddRange(orderNoteList);
                _dbContext.SaveChanges();

                DbfunctionUtility dbfunction = new DbfunctionUtility(_appSettings);
                DataSet           ds         = dbfunction.GetDataset("call import_Order_Notes();");
                ViewBag.imported = 1;
            }
            catch (Exception ex)
            {
                ViewBag.imported = 0;
            }
            return(View());
        }
예제 #19
0
        public ActionResult Edit(string id)
        {
            QuestionViewModel model = new QuestionViewModel();

            try
            {
                {
                    DbfunctionUtility dbfunction = new DbfunctionUtility(_appSettings);
                    DataSet           ds         = dbfunction.GetDataset("select * from questions where Id= '" + id + "'");
                    int idInt = 0;
                    int.TryParse(id, out idInt);
                    model = _dbContext.tbl_Questions.Where(w => w.Id == idInt)
                            .Select(s => new QuestionViewModel
                    {
                        Question   = s.Question,
                        Choice1    = s.Choice1,
                        Choice2    = s.Choice2,
                        Choice3    = s.Choice3,
                        Choice4    = s.Choice4,
                        Choice5    = s.Choice5,
                        Answer     = s.Answer,
                        QuestionId = s.Id,
                        TestId     = s.TestId ?? 0
                    }).FirstOrDefault();

                    model.TestList = (from test in _dbContext.tbl_Tests
                                      join season in _dbContext.tbl_Seasons
                                      on test.SeasonId equals season.Id
                                      select new TestViewModel
                    {
                        Name = test.Name + " (" + season.Name + ")",
                        Id = test.Id,
                        IsActive = test.IsActive
                    }).ToList();

                    if (model != null)
                    {
                        return(View(model));
                    }
                    else
                    {
                        return(RedirectToAction("List", "Question"));
                    }
                }
            }
            catch (Exception ex)
            {
            }

            return(View(model));
        }
        public ActionResult Add(DocumentViewModel model, IFormFile file)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    DbfunctionUtility dbfunction = new DbfunctionUtility(_appSettings);
                    var     query = "select * from Documents where Name = '" + model.Name + "' and seasonId = " + model.SeasonId + "";
                    DataSet ds    = dbfunction.GetDataset(query);
                    if (ds.Tables[0].Rows.Count == 0)
                    {
                        var document = new Document
                        {
                            Name        = model.Name,
                            IsActive    = true,
                            CreatedBy   = UserId,
                            CreatedDate = DateTime.Now,
                            FileName    = file.FileName,
                            Description = model.Description,
                            SeasonId    = model.SeasonId
                        };

                        _dbContext.tbl_Documents.Add(document);
                        _dbContext.SaveChanges();

                        var fileName = document.DocumentId.ToString() + Path.GetExtension(file.FileName);
                        document.FileName = fileName;
                        _dbContext.SaveChanges();
                        DocumentUtility _documentUtility = new DocumentUtility();
                        _documentUtility.SaveFile(document.DocumentId.ToString(), "Document", file);

                        ViewBag.SuccessMessage = "File added successfully";
                    }
                    else
                    {
                        ViewBag.ErrorMessage = "File is already exists";
                    }
                }
            }
            catch (Exception ex)
            {
            }

            return(View(model));
        }
        public JsonResult Delete(string id)
        {
            ResponseModel response = new ResponseModel();
            try
            {
                QuestionViewModel model = new QuestionViewModel();
                DbfunctionUtility dbfunction = new DbfunctionUtility(_appSettings);
                var query = " update users set IsActive = 0   where UserId ='" + id + "' ;";
                DataSet ds = dbfunction.GetDataset(query);
                response.Status = "1";
                response.Message = "User deleted successfully";
            }
            catch (Exception ex)
            {
            }

            return Json(response);
        }
예제 #22
0
        public JsonResult UpdateBolDetail(string bol1_no, string column, string bol1_carrierName, string bol1_carrierPhone, DateTime?bol1_PkupDate, DateTime?bol1_pkupTime, string Conformation, int pallet_no, string pallet_type)
        {
            ResponseModel response = new ResponseModel();

            try
            {
                ItemclassViewModel model      = new ItemclassViewModel();
                DbfunctionUtility  dbfunction = new DbfunctionUtility(_appSettings);
                var query = "";
                if (column == "bol1_carrierName")
                {
                    query = "Update bol_1 set bol1_carrierName='" + bol1_carrierName + "'  where bol1_no ='" + bol1_no + "'  ";
                }
                else if (column == "bol1_carrierPhone")
                {
                    query = "Update bol_1 set bol1_carrierPhone='" + bol1_carrierPhone + "'  where bol1_no ='" + bol1_no + "'  ";
                }
                else if (column == "bol1_PkupDate")
                {
                    query = "Update bol_1 set bol1_PkupDate='" + bol1_PkupDate.Value.ToString("yyyy/MM/dd") + "'   where bol1_no ='" + bol1_no + "' ";
                }
                else if (column == "Conformation")
                {
                    query = "Update bol_1 set Conformation='" + Conformation + "'  where bol1_no ='" + bol1_no + "'  ";
                }
                else if (column == "pallet")
                {
                    query = "Update bol_1 set bol1_pallet=" + pallet_no + ",bol1_pallet_type='" + pallet_type + "'  where bol1_no ='" + bol1_no + "'  ";
                }
                else
                {
                    query = "Update bol_1 set bol1_pkupTime='" + bol1_pkupTime.Value.ToString("HH:mm") + "'  where bol1_no ='" + bol1_no + "'  ";
                }

                DataSet ds = dbfunction.GetDataset(query);
                response.Status  = "1";
                response.Message = "Detail updated successfully";
            }
            catch (Exception ex)
            {
            }

            return(Json(response));
        }
예제 #23
0
        public JsonResult Delete(string id)
        {
            ResponseModel response = new ResponseModel();

            try
            {
                int iId = Convert.ToInt32(id);
                DbfunctionUtility dbfunction = new DbfunctionUtility(_appSettings);
                var     query = " update hr_groups set IsActive = 0   where Id ='" + id + "' ;";
                DataSet ds    = dbfunction.GetDataset(query);
                response.Status  = "1";
                response.Message = "Hr group deleted successfully";
            }
            catch (Exception ex)
            {
            }

            return(Json(response));
        }
        public JsonResult DeleteDeptAmount(string id)
        {
            ResponseModel response = new ResponseModel();

            try
            {
                ItemclassViewModel model      = new ItemclassViewModel();
                DbfunctionUtility  dbfunction = new DbfunctionUtility(_appSettings);
                var     query = " delete from deptamount  where deptamount_id = '" + id + "'  ";
                DataSet ds    = dbfunction.GetDataset(query);
                response.Status  = "1";
                response.Message = "Department amount detail deleted successfully";
            }
            catch (Exception ex)
            {
            }

            return(Json(response));
        }
        public JsonResult DeleteItemClass(string id)
        {
            ResponseModel response = new ResponseModel();

            try
            {
                ItemclassViewModel model      = new ItemclassViewModel();
                DbfunctionUtility  dbfunction = new DbfunctionUtility(_appSettings);
                var     query = " delete from tov.itemclass  where class ='" + id + "' ;delete from HEANDB.itemclass  where class ='" + id + "' ; ";
                DataSet ds    = dbfunction.GetDataset(query);
                response.Status  = "1";
                response.Message = "Class deleted successfully";
            }
            catch (Exception ex)
            {
            }

            return(Json(response));
        }
        public JsonResult DeleteDeptProjection(string DeptName, string mm)
        {
            ResponseModel response = new ResponseModel();

            try
            {
                ItemclassViewModel model      = new ItemclassViewModel();
                DbfunctionUtility  dbfunction = new DbfunctionUtility(_appSettings);
                var     query = " delete from tov.DeptProjection  where DeptName = '" + DeptName + "' and mm =" + mm + " ";
                DataSet ds    = dbfunction.GetDataset(query);
                response.Status  = "1";
                response.Message = "Department projection detail deleted successfully";
            }
            catch (Exception ex)
            {
            }

            return(Json(response));
        }
        public ActionResult EditItemComponent(EditIndsellCompoViewModel model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    DbfunctionUtility dbfunction = new DbfunctionUtility(_appSettings);

                    foreach (var item in model.ItemComponentList)
                    {
                        var allowed = (item.indSell_Allowed_Bool ? 1 : 0);
                        dbfunction.GetDataset("Update indSell_Compo set indSell_Allowed = " + allowed + "  where trim(indSell_ItemMaster)='" + model.indSell_ItemMaster.Trim() + "' and trim(indSell_ItemComponent)= '" + item.indSell_ItemComponent.Trim() + "' ");
                    }

                    var totalCount = model.ItemComponentList.Count();
                    var checkCount = model.ItemComponentList.Where(w => w.indSell_Allowed_Bool == true).Count();

                    if (totalCount == checkCount)
                    {
                        ViewBag.showAll = 1;
                    }
                    else
                    {
                        ViewBag.showAll = 0;
                    }

                    ViewBag.SuccessMessage = "Detail added successfully";
                    return(View(model));
                }
                else
                {
                    ViewBag.ErrorMessage = "Please enter valid values";
                }
            }
            catch (Exception ex)
            {
            }

            ViewBag.ErrorMessage = "Error occurred";

            return(View(model));
        }
        public ActionResult Edit(string id)
        {
            DocumentViewModel model = new DocumentViewModel();

            try
            {
                {
                    DbfunctionUtility dbfunction = new DbfunctionUtility(_appSettings);
                    DataSet           ds         = dbfunction.GetDataset("select * from documents where documentId= '" + id + "'");
                    int idInt = 0;
                    int.TryParse(id, out idInt);
                    model = _dbContext.tbl_Documents.Where(w => w.DocumentId == idInt)
                            .Select(s => new DocumentViewModel
                    {
                        DocumentId  = s.DocumentId,
                        Name        = s.Name,
                        Description = s.Description,
                        SeasonId    = s.SeasonId ?? 0
                    }).FirstOrDefault();
                    model.SeasonList = _dbContext.tbl_Seasons.Where(w => w.IsActive == true)
                                       .Select(s => new SeasonViewModel
                    {
                        Name = s.Name,
                        Id   = s.Id
                    }).ToList();

                    if (model != null)
                    {
                        return(View(model));
                    }
                    else
                    {
                        return(RedirectToAction("List", "Question"));
                    }
                }
            }
            catch (Exception ex)
            {
            }

            return(View(model));
        }
        public ActionResult DeptProjectionList()
        {
            List <DeptProjectionViewModel> itemClassList = new List <DeptProjectionViewModel>();

            try
            {
                DbfunctionUtility dbfunction = new DbfunctionUtility(_appSettings);
                DataSet           ds         = dbfunction.GetDataset("Select * from tov.DeptProjection");

                itemClassList = (from row in ds.Tables[0].AsEnumerable()
                                 select new DeptProjectionViewModel
                {
                    DeptName = Convert.ToString(row["DeptName"]),
                    mm = Convert.ToInt32(row["mm"]),
                    Projection = Convert.ToDecimal(row["Projection"]),
                }).ToList();
            }
            catch (Exception Ex)
            {
            }
            return(View(itemClassList));
        }
        public ActionResult DeptAmountList()
        {
            List <DeptAmountViewModel> deptAmountList = new List <DeptAmountViewModel>();

            try
            {
                DbfunctionUtility dbfunction = new DbfunctionUtility(_appSettings);
                DataSet           ds         = dbfunction.GetDataset("Select * from deptamount");

                deptAmountList = (from row in ds.Tables[0].AsEnumerable()
                                  select new DeptAmountViewModel
                {
                    deptamount_id = Convert.ToInt32(row["deptamount_id"]),
                    Dept = Convert.ToString(row["Dept"]),
                    Amount = Convert.ToDecimal(row["Amount"])
                }).ToList();
            }
            catch (Exception Ex)
            {
            }
            return(View(deptAmountList));
        }