public ActionResult Check() { List <ListItemExtension> lieList = new List <ListItemExtension>(); List <string> deportments = new List <string>() { "精工工厂", "加工工厂", "模具工厂", "智能设备工厂", "智能机器" }; foreach (var fanName in deportments) { ListItem item = new ListItem(); item.Text = fanName; item.Value = fanName; ListItemExtension lie = new ListItemExtension(item); lieList.Add(lie); } ViewBag.Deportment = lieList.ToArray(); int year = DateTime.Now.Year; int month = DateTime.Now.Month; ViewBag.RecordCount = db.CapCompleteRate.Where(p => p.PlanDate.Value.Year == year && p.PlanDate.Value.Month == month).Count(); return(View(PagingHelper <CapCompleteRate> .GetPagedDataTable(0, 20, ViewBag.RecordCount, db.CapCompleteRate.Where(p => p.PlanDate.Value.Year == year && p.PlanDate.Value.Month == month).ToList()))); }
public ActionResult Grid1_PageIndexChanged(string[] Grid1_fields, int Grid1_pageIndex, DateTime?yearMonth, string deportment) { List <ProductQua> pmList; int year = DateTime.Now.Year; int month = DateTime.Now.Month; if (yearMonth != null) { pmList = db.ProductQua.Where(p => p.DATE.Value.Year == yearMonth.Value.Year && p.DATE.Value.Month == yearMonth.Value.Month).ToList(); } else { pmList = db.ProductQua.Where(p => p.DATE.Value.Year == year && p.DATE.Value.Month == month).ToList(); } if (!string.IsNullOrEmpty(deportment)) { pmList = pmList.Where(p => p.FAB_NAME == deportment).ToList(); } var grid1 = UIHelper.Grid("Grid1"); var recordCount = pmList.Count(); grid1.RecordCount(recordCount); var dataSource = PagingHelper <ProductQua> .GetPagedDataTable(Grid1_pageIndex, 20, recordCount, pmList); grid1.DataSource(dataSource, Grid1_fields); return(UIHelper.Result()); }
public ActionResult Index(string[] Grid1_fields, DateTime?yearMonth, string deportment) { List <CapCompleteRate> pmList; int year = DateTime.Now.Year; int month = DateTime.Now.Month; if (yearMonth != null) { pmList = db.CapCompleteRate.Where(p => p.PlanDate.Value.Year == yearMonth.Value.Year && p.PlanDate.Value.Month == yearMonth.Value.Month).ToList(); } else { pmList = db.CapCompleteRate.Where(p => p.PlanDate.Value.Year == year && p.PlanDate.Value.Month == month).ToList(); } if (!string.IsNullOrEmpty(deportment)) { pmList = pmList.Where(p => p.FAB_NAME == deportment).ToList(); } var grid1 = UIHelper.Grid("Grid1"); var recordCount = pmList.Count(); grid1.RecordCount(recordCount); var dataSource = PagingHelper <CapCompleteRate> .GetPagedDataTable(0, 20, recordCount, pmList); grid1.DataSource(dataSource, Grid1_fields); return(UIHelper.Result()); }
public ActionResult Index(string[] Grid1_fields, DateTime?yearMonth) { List <SaleManage> smList; if (yearMonth != null) { smList = db.SaleManage.Where(p => p.PLAN_DATE.Year == yearMonth.Value.Year && p.PLAN_DATE.Month == yearMonth.Value.Month).ToList(); } else { smList = db.SaleManage.ToList(); } var grid1 = UIHelper.Grid("Grid1"); var recordCount = smList.Count(); grid1.RecordCount(recordCount); var dataSource = PagingHelper <SaleManage> .GetPagedDataTable(0, 20, recordCount, smList); grid1.DataSource(dataSource, Grid1_fields); return(UIHelper.Result()); }
public ActionResult Grid1_YearPlan_PageIndexChanged(string[] Grid1_fields, int Grid1_pageIndex) { List <YearPlan> ypList; ypList = db.YearPlan.ToList(); var grid1 = UIHelper.Grid("Grid1"); var recordCount = ypList.Count(); grid1.RecordCount(recordCount); var dataSource = PagingHelper <YearPlan> .GetPagedDataTable(Grid1_pageIndex, 20, recordCount, ypList); grid1.DataSource(dataSource, Grid1_fields); return(UIHelper.Result()); }
public ActionResult Index() { List <ListItemExtension> lieList = new List <ListItemExtension>(); List <string> deportments = new List <string>() { "精工工厂", "加工工厂", "模具工厂", "智能设备工厂", "智能机器" }; foreach (var fanName in deportments) { ListItem item = new ListItem(); item.Text = fanName; item.Value = fanName; ListItemExtension lie = new ListItemExtension(item); lieList.Add(lie); } ViewBag.Deportment = lieList.ToArray(); ViewBag.RecordCount = db.VentureCapa.Count(); return(View(PagingHelper <VentureCapa> .GetPagedDataTable(0, 20, ViewBag.RecordCount, db.VentureCapa.ToList()))); }
public ActionResult Index(string[] Grid1_fields, string deportment) { List <VentureCapa> pmList; pmList = db.VentureCapa.ToList(); if (!string.IsNullOrEmpty(deportment)) { pmList = pmList.Where(p => p.FAB_NAME == deportment).ToList(); } var grid1 = UIHelper.Grid("Grid1"); var recordCount = pmList.Count(); grid1.RecordCount(recordCount); var dataSource = PagingHelper <VentureCapa> .GetPagedDataTable(0, 20, recordCount, pmList); grid1.DataSource(dataSource, Grid1_fields); return(UIHelper.Result()); }
public ActionResult Compute(string[] Grid1_fields, DateTime?yearMonth) { List <SaleManage> smList; List <ProductManage> pmList; if (yearMonth != null) { smList = db.SaleManage.Where(p => p.PLAN_DATE.Year == yearMonth.Value.Year && p.PLAN_DATE.Month == yearMonth.Value.Month).ToList(); pmList = db.ProductManage.Where(p => p.PLAN_DATE.Value.Year == yearMonth.Value.Year && p.PLAN_DATE.Value.Month == yearMonth.Value.Month).ToList(); foreach (var sm in smList) { sm.SALE_PLAN = pmList.Where(p => p.FAB_NAME == sm.RSPO_DEPT).Sum(p => p.OUTPUT_VALUE); sm.SALE_FINISH = Convert.ToDouble(sapreader.GetProductWeightCount(GetFactoryCode(sm.RSPO_DEPT), DateTime.Now).ToString("0.00")); } db.SaveChanges(); } else { smList = db.SaleManage.ToList(); } var grid1 = UIHelper.Grid("Grid1"); var recordCount = smList.Count(); grid1.RecordCount(recordCount); var dataSource = PagingHelper <SaleManage> .GetPagedDataTable(0, 20, recordCount, smList); grid1.DataSource(dataSource, Grid1_fields); return(UIHelper.Result()); }
public ActionResult btnSubmit_Click(string[] Grid1_fields, JArray Grid1_modifiedData, int pageIndex, DateTime?yearMonth) { foreach (JObject mergedRow in Grid1_modifiedData) { string status = mergedRow.Value <string>("status"); int rowIndex = mergedRow.Value <int>("index"); JObject values = mergedRow.Value <JObject>("values"); if (status == "modified") { int id = mergedRow.Value <int>("id"); CapCompleteRate pm = db.CapCompleteRate.Where(p => p.ID == id).FirstOrDefault(); string FAB_NAME = values.Value <string>("FAB_NAME"); string Venture = values.Value <string>("Venture"); string Operation = values.Value <string>("Operation"); double? CompleteRate = values.Value <double?>("CompleteRate"); double? PromptnessRate = values.Value <double?>("PromptnessRate"); double? PassRate = values.Value <double?>("PassRate"); DateTime?PlanDate = values.Value <DateTime?>("PlanDate"); if (FAB_NAME != null) { pm.FAB_NAME = FAB_NAME; } if (Venture != null) { pm.Venture = Venture; } if (Operation != null) { pm.Operation = Operation; } if (CompleteRate != null) { pm.CompleteRate = CompleteRate; } if (PromptnessRate != null) { pm.PromptnessRate = PromptnessRate; } if (PassRate != null) { pm.PassRate = PassRate; } if (PlanDate != null) { pm.PlanDate = PlanDate; } db.SaveChanges(); } else if (status == "newadded") { CapCompleteRate pm = new CapCompleteRate(); string FAB_NAME = values.Value <string>("FAB_NAME"); string Venture = values.Value <string>("Venture"); string Operation = values.Value <string>("Operation"); double?CompleteRate = values.Value <double?>("CompleteRate"); double?PromptnessRate = values.Value <double?>("PromptnessRate"); double?PassRate = values.Value <double?>("PassRate"); string PlanDate = values.Value <string>("PlanDate"); if (FAB_NAME != null) { pm.FAB_NAME = FAB_NAME; } if (Venture != null) { pm.Venture = Venture; } if (Operation != null) { pm.Operation = Operation; } if (CompleteRate != null) { pm.CompleteRate = CompleteRate; } if (PromptnessRate != null) { pm.PromptnessRate = PromptnessRate; } if (PassRate != null) { pm.PassRate = PassRate; } if (!string.IsNullOrEmpty(PlanDate)) { pm.PlanDate = Convert.ToDateTime(PlanDate); } db.CapCompleteRate.Add(pm); db.SaveChanges(); } else if (status == "deleted") { int id = mergedRow.Value <int>("id"); CapCompleteRate pm = db.CapCompleteRate.Where(p => p.ID == id).FirstOrDefault(); db.CapCompleteRate.Remove(pm); db.SaveChanges(); } } List <CapCompleteRate> pmList; int year = DateTime.Now.Year; int month = DateTime.Now.Month; if (yearMonth != null) { pmList = db.CapCompleteRate.Where(p => p.PlanDate.Value.Year == yearMonth.Value.Year && p.PlanDate.Value.Month == yearMonth.Value.Month).ToList(); } else { pmList = db.CapCompleteRate.Where(p => p.PlanDate.Value.Year == year && p.PlanDate.Value.Month == month).ToList(); } var dataSource = PagingHelper <CapCompleteRate> .GetPagedDataTable(pageIndex, 20, pmList.Count(), pmList); UIHelper.Grid("Grid1").DataSource(dataSource, Grid1_fields); Alert.Show("操作成功!"); return(UIHelper.Result()); }
public ActionResult btnSubmit_Click(string[] Grid1_fields, JArray Grid1_modifiedData, int pageIndex, DateTime?yearMonth) { foreach (JObject mergedRow in Grid1_modifiedData) { string status = mergedRow.Value <string>("status"); int rowIndex = mergedRow.Value <int>("index"); JObject values = mergedRow.Value <JObject>("values"); if (status == "modified") { int id = mergedRow.Value <int>("id"); ProductQua pm = db.ProductQua.Where(p => p.ID == id).FirstOrDefault(); string FAB_NAME = values.Value <string>("FAB_NAME"); string VENTURENAME = values.Value <string>("VENTURENAME"); string OPERATION_NAME = values.Value <string>("OPERATION_NAME"); int? TOTALQTY = values.Value <int?>("TOTALQTY"); int? QUAQTY = values.Value <int?>("QUAQTY"); DateTime?DATE = values.Value <DateTime?>("DATE"); double? RATE = values.Value <double?>("RATE"); if (FAB_NAME != null) { pm.FAB_NAME = FAB_NAME; } if (VENTURENAME != null) { pm.VENTURENAME = VENTURENAME; } if (OPERATION_NAME != null) { pm.OPERATION_NAME = OPERATION_NAME; } if (TOTALQTY != null) { pm.TOTALQTY = TOTALQTY; } if (QUAQTY != null) { pm.QUAQTY = QUAQTY; } if (DATE != null) { pm.DATE = DATE; } if (RATE != null) { pm.RATE = RATE; } db.SaveChanges(); } else if (status == "newadded") { ProductQua pm = new ProductQua(); string FAB_NAME = values.Value <string>("FAB_NAME"); string VENTURENAME = values.Value <string>("VENTURENAME"); string OPERATION_NAME = values.Value <string>("OPERATION_NAME"); int? TOTALQTY = values.Value <int?>("TOTALQTY"); int? QUAQTY = values.Value <int?>("QUAQTY"); string DATE = values.Value <string>("DATE"); double?RATE = values.Value <double?>("RATE"); if (FAB_NAME != null) { pm.FAB_NAME = FAB_NAME; } if (VENTURENAME != null) { pm.VENTURENAME = VENTURENAME; } if (OPERATION_NAME != null) { pm.OPERATION_NAME = OPERATION_NAME; } if (TOTALQTY != null) { pm.TOTALQTY = TOTALQTY; } if (QUAQTY != null) { pm.QUAQTY = QUAQTY; } if (RATE != null) { pm.RATE = RATE; } if (!string.IsNullOrEmpty(DATE)) { pm.DATE = Convert.ToDateTime(DATE); } db.ProductQua.Add(pm); db.SaveChanges(); } else if (status == "deleted") { int id = mergedRow.Value <int>("id"); ProductQua pm = db.ProductQua.Where(p => p.ID == id).FirstOrDefault(); db.ProductQua.Remove(pm); db.SaveChanges(); } } List <ProductQua> pmList; int year = DateTime.Now.Year; int month = DateTime.Now.Month; if (yearMonth != null) { pmList = db.ProductQua.Where(p => p.DATE.Value.Year == yearMonth.Value.Year && p.DATE.Value.Month == yearMonth.Value.Month).ToList(); } else { pmList = db.ProductQua.Where(p => p.DATE.Value.Year == year && p.DATE.Value.Month == month).ToList(); } var dataSource = PagingHelper <ProductQua> .GetPagedDataTable(pageIndex, 20, pmList.Count(), pmList); UIHelper.Grid("Grid1").DataSource(dataSource, Grid1_fields); Alert.Show("操作成功!"); return(UIHelper.Result()); }
public ActionResult btnSubmit_Click(string[] Grid1_fields, JArray Grid1_modifiedData, int pageIndex, DateTime?yearMonth) { foreach (JObject mergedRow in Grid1_modifiedData) { string status = mergedRow.Value <string>("status"); int rowIndex = mergedRow.Value <int>("index"); JObject values = mergedRow.Value <JObject>("values"); if (status == "modified") { int id = mergedRow.Value <int>("id"); OtdDpmo pm = db.OtdDpmo.Where(p => p.ID == id).FirstOrDefault(); string FAB_NAME = values.Value <string>("FAB_NAME"); double? OTD = values.Value <double?>("OTD"); double? OTDComplete = values.Value <double?>("OTDComplete"); double? DPMO = values.Value <double?>("DPMO"); double? DPMOCompletefloat = values.Value <double?>("DPMOCompletefloat"); double? Ncr = values.Value <double?>("Ncr"); double? HourYearComplete = values.Value <double?>("HourYearComplete"); double? HourMonthPlan = values.Value <double?>("HourMonthPlan"); double? HourMonthComplete = values.Value <double?>("HourMonthComplete"); double? JGGSPlan = values.Value <double?>("JGGSPlan"); double? JGGSComplete = values.Value <double?>("JGGSComplete"); double? CJGDWPlan = values.Value <double?>("CJGDWPlan"); double? CJGDWComplete = values.Value <double?>("CJGDWComplete"); double? JJGDWPlan = values.Value <double?>("JJGDWPlan"); double? JJGDWComplete = values.Value <double?>("JJGDWComplete"); double? Odds = values.Value <double?>("Odds"); double? OddsComplete = values.Value <double?>("OddsComplete"); DateTime?Date = values.Value <DateTime?>("Date"); if (FAB_NAME != null) { pm.FAB_NAME = FAB_NAME; } if (OTD != null) { pm.OTD = OTD; } if (OTDComplete != null) { pm.OTDComplete = OTDComplete; } if (DPMO != null) { pm.DPMO = DPMO; } if (DPMOCompletefloat != null) { pm.DPMOCompletefloat = DPMOCompletefloat; } if (Ncr != null) { pm.Ncr = Ncr; } if (HourYearComplete != null) { pm.HourYearComplete = HourYearComplete; } if (HourMonthPlan != null) { pm.HourMonthPlan = HourMonthPlan; } if (HourMonthComplete != null) { pm.HourMonthComplete = HourMonthComplete; } if (JGGSPlan != null) { pm.JGGSPlan = JGGSPlan; } if (JGGSComplete != null) { pm.JGGSComplete = JGGSComplete; } if (CJGDWPlan != null) { pm.CJGDWPlan = CJGDWPlan; } if (CJGDWComplete != null) { pm.CJGDWComplete = CJGDWComplete; } if (JJGDWPlan != null) { pm.JJGDWPlan = JJGDWPlan; } if (JJGDWComplete != null) { pm.JJGDWComplete = JJGDWComplete; } if (Odds != null) { pm.Odds = Odds; } if (OddsComplete != null) { pm.OddsComplete = OddsComplete; } if (Date != null) { pm.Date = Date; } db.SaveChanges(); } else if (status == "newadded") { OtdDpmo pm = new OtdDpmo(); string FAB_NAME = values.Value <string>("FAB_NAME"); double?OTD = values.Value <double?>("OTD"); double?OTDComplete = values.Value <double?>("OTDComplete"); double?DPMO = values.Value <double?>("DPMO"); double?DPMOCompletefloat = values.Value <double?>("DPMOCompletefloat"); double?Ncr = values.Value <double?>("Ncr"); double?HourYearComplete = values.Value <double?>("HourYearComplete"); double?HourMonthPlan = values.Value <double?>("HourMonthPlan"); double?HourMonthComplete = values.Value <double?>("HourMonthComplete"); double?JGGSPlan = values.Value <double?>("JGGSPlan"); double?JGGSComplete = values.Value <double?>("JGGSComplete"); double?CJGDWPlan = values.Value <double?>("CJGDWPlan"); double?CJGDWComplete = values.Value <double?>("CJGDWComplete"); double?JJGDWPlan = values.Value <double?>("JJGDWPlan"); double?JJGDWComplete = values.Value <double?>("JJGDWComplete"); double?Odds = values.Value <double?>("Odds"); double?OddsComplete = values.Value <double?>("OddsComplete"); string Date = values.Value <string>("Date"); if (FAB_NAME != null) { pm.FAB_NAME = FAB_NAME; } if (OTD != null) { pm.OTD = OTD; } if (OTDComplete != null) { pm.OTDComplete = OTDComplete; } if (DPMO != null) { pm.DPMO = DPMO; } if (DPMOCompletefloat != null) { pm.DPMOCompletefloat = DPMOCompletefloat; } if (Ncr != null) { pm.Ncr = Ncr; } if (HourYearComplete != null) { pm.HourYearComplete = HourYearComplete; } if (HourMonthPlan != null) { pm.HourMonthPlan = HourMonthPlan; } if (HourMonthComplete != null) { pm.HourMonthComplete = HourMonthComplete; } if (JGGSPlan != null) { pm.JGGSPlan = JGGSPlan; } if (JGGSComplete != null) { pm.JGGSComplete = JGGSComplete; } if (CJGDWPlan != null) { pm.CJGDWPlan = CJGDWPlan; } if (CJGDWComplete != null) { pm.CJGDWComplete = CJGDWComplete; } if (JJGDWPlan != null) { pm.JJGDWPlan = JJGDWPlan; } if (JJGDWComplete != null) { pm.JJGDWComplete = JJGDWComplete; } if (Odds != null) { pm.Odds = Odds; } if (OddsComplete != null) { pm.OddsComplete = OddsComplete; } if (!string.IsNullOrEmpty(Date)) { pm.Date = Convert.ToDateTime(Date); } db.OtdDpmo.Add(pm); db.SaveChanges(); } else if (status == "deleted") { int id = mergedRow.Value <int>("id"); OtdDpmo pm = db.OtdDpmo.Where(p => p.ID == id).FirstOrDefault(); db.OtdDpmo.Remove(pm); db.SaveChanges(); } } List <OtdDpmo> pmList; int year = DateTime.Now.Year; int month = DateTime.Now.Month; if (yearMonth != null) { pmList = db.OtdDpmo.Where(p => p.Date.Value.Year == yearMonth.Value.Year && p.Date.Value.Month == yearMonth.Value.Month).ToList(); } else { pmList = db.OtdDpmo.Where(p => p.Date.Value.Year == year && p.Date.Value.Month == month).ToList(); } var dataSource = PagingHelper <OtdDpmo> .GetPagedDataTable(pageIndex, 20, pmList.Count(), pmList); UIHelper.Grid("Grid1").DataSource(dataSource, Grid1_fields); Alert.Show("操作成功!"); return(UIHelper.Result()); }
public ActionResult btnSubmit_Click(string[] Grid1_fields, JArray Grid1_modifiedData, int pageIndex, DateTime?yearMonth) { foreach (JObject mergedRow in Grid1_modifiedData) { string status = mergedRow.Value <string>("status"); int rowIndex = mergedRow.Value <int>("index"); JObject values = mergedRow.Value <JObject>("values"); if (status == "modified") { int id = mergedRow.Value <int>("id"); SaleManage sm = db.SaleManage.Where(p => p.ID == id).FirstOrDefault(); string RSPO_DEPT = values.Value <string>("RSPO_DEPT"); double? MANAGE_PLAN = values.Value <double?>("MANAGE_PLAN"); double? SALE_PLAN = values.Value <double?>("SALE_PLAN"); double? SALE_FINISH = values.Value <double?>("SALE_FINISH"); DateTime?PLAN_DATE = values.Value <DateTime?>("PLAN_DATE"); string REMARK = values.Value <string>("REMARK"); string Company = values.Value <string>("Company"); int? SellYear = values.Value <int>("SellYear"); if (RSPO_DEPT != null) { sm.RSPO_DEPT = RSPO_DEPT; } if (MANAGE_PLAN != null) { sm.MANAGE_PLAN = (double)MANAGE_PLAN; } if (SALE_PLAN != null) { sm.SALE_PLAN = SALE_PLAN; } if (SALE_FINISH != null) { sm.SALE_FINISH = SALE_FINISH; } if (PLAN_DATE != null) { sm.PLAN_DATE = (DateTime)PLAN_DATE; } if (REMARK != null) { sm.REMARK = REMARK; } if (Company != null) { sm.Company = Company; } if (SellYear != null) { sm.SellYear = (int)SellYear; } db.SaveChanges(); } else if (status == "newadded") { SaleManage sm = new SaleManage(); string RSPO_DEPT = values.Value <string>("RSPO_DEPT"); double?MANAGE_PLAN = values.Value <double?>("MANAGE_PLAN"); double?SALE_PLAN = values.Value <double?>("SALE_PLAN"); double?SALE_FINISH = values.Value <double?>("SALE_FINISH"); string PLAN_DATE = values.Value <string>("PLAN_DATE"); string REMARK = values.Value <string>("REMARK"); string Company = values.Value <string>("Company"); int? SellYear = values.Value <int>("SellYear"); if (RSPO_DEPT != null) { sm.RSPO_DEPT = RSPO_DEPT; } if (MANAGE_PLAN != null) { sm.MANAGE_PLAN = (double)MANAGE_PLAN; } if (SALE_PLAN != null) { sm.SALE_PLAN = SALE_PLAN; } if (SALE_FINISH != null) { sm.SALE_FINISH = SALE_FINISH; } if (PLAN_DATE != null) { sm.PLAN_DATE = Convert.ToDateTime(PLAN_DATE); } if (REMARK != null) { sm.REMARK = REMARK; } if (Company != null) { sm.Company = Company; } if (SellYear != null) { sm.SellYear = (int)SellYear; } db.SaleManage.Add(sm); db.SaveChanges(); } else if (status == "deleted") { int id = mergedRow.Value <int>("id"); SaleManage sm = db.SaleManage.Where(p => p.ID == id).FirstOrDefault(); db.SaleManage.Remove(sm); db.SaveChanges(); } } List <SaleManage> smList; if (yearMonth != null) { smList = db.SaleManage.Where(p => p.PLAN_DATE.Year == yearMonth.Value.Year && p.PLAN_DATE.Month == yearMonth.Value.Month).ToList(); } else { smList = db.SaleManage.ToList(); } var dataSource = PagingHelper <SaleManage> .GetPagedDataTable(pageIndex, 20, smList.Count(), smList); UIHelper.Grid("Grid1").DataSource(dataSource, Grid1_fields); Alert.Show("操作成功!"); return(UIHelper.Result()); }
public ActionResult btnSubmit_YearPlan_Click(string[] Grid1_fields, JArray Grid1_modifiedData, int pageIndex) { foreach (JObject mergedRow in Grid1_modifiedData) { string status = mergedRow.Value <string>("status"); int rowIndex = mergedRow.Value <int>("index"); JObject values = mergedRow.Value <JObject>("values"); if (status == "modified") { int id = mergedRow.Value <int>("id"); YearPlan yp = db.YearPlan.Where(p => p.ID == id).FirstOrDefault(); string Factory = values.Value <string>("Factory"); int? Year = values.Value <int?>("Year"); double?SellYearPlan = values.Value <double?>("SellYearPlan"); double?YearPlan1 = values.Value <double?>("YearPlan1"); if (Factory != null) { yp.Factory = Factory; } if (Year != null) { yp.Year = (int)Year; } if (SellYearPlan != null) { yp.SellYearPlan = (double)SellYearPlan; } if (YearPlan1 != null) { yp.YearPlan1 = (double)YearPlan1; } db.SaveChanges(); } else if (status == "newadded") { YearPlan yp = new YearPlan(); string Factory = values.Value <string>("Factory"); int? Year = values.Value <int?>("Year"); double?SellYearPlan = values.Value <double?>("SellYearPlan"); double?YearPlan1 = values.Value <double?>("YearPlan1"); if (Factory != null) { yp.Factory = Factory; } if (Year != null) { yp.Year = (int)Year; } if (SellYearPlan != null) { yp.SellYearPlan = (double)SellYearPlan; } if (YearPlan1 != null) { yp.YearPlan1 = (double)YearPlan1; } db.YearPlan.Add(yp); db.SaveChanges(); } else if (status == "deleted") { int id = mergedRow.Value <int>("id"); YearPlan yp = db.YearPlan.Where(p => p.ID == id).FirstOrDefault(); db.YearPlan.Remove(yp); db.SaveChanges(); } } List <YearPlan> ypList; ypList = db.YearPlan.ToList(); var dataSource = PagingHelper <YearPlan> .GetPagedDataTable(pageIndex, 20, ypList.Count(), ypList); UIHelper.Grid("Grid1").DataSource(dataSource, Grid1_fields); Alert.Show("操作成功!"); return(UIHelper.Result()); }
// GET: ProductManages public ActionResult Index() { ViewBag.RecordCount = db.SaleManage.Count(); return(View(PagingHelper <SaleManage> .GetPagedDataTable(0, 20, db.SaleManage.Count(), db.SaleManage.ToList()))); }
public ActionResult btnSubmit_Click(string[] Grid1_fields, JArray Grid1_modifiedData, int pageIndex, DateTime?yearMonth) { foreach (JObject mergedRow in Grid1_modifiedData) { string status = mergedRow.Value <string>("status"); int rowIndex = mergedRow.Value <int>("index"); JObject values = mergedRow.Value <JObject>("values"); if (status == "modified") { int id = mergedRow.Value <int>("id"); TimelyRate pm = db.TimelyRate.Where(p => p.ID == id).FirstOrDefault(); string FAB_NAME = values.Value <string>("FAB_NAME"); double? Week1 = values.Value <double?>("Week1"); double? Week2 = values.Value <double?>("Week2"); double? Week3 = values.Value <double?>("Week3"); double? Week4 = values.Value <double?>("Week4"); double? Month1 = values.Value <double?>("Month1"); double? RealPlan = values.Value <double?>("RealPlan"); DateTime?PlanDate = values.Value <DateTime?>("PlanDate"); if (FAB_NAME != null) { pm.FAB_NAME = FAB_NAME; } if (Week1 != null) { pm.Week1 = Week1; } if (Week2 != null) { pm.Week2 = Week2; } if (Week3 != null) { pm.Week3 = Week3; } if (Week4 != null) { pm.Week4 = Week4; } if (Month1 != null) { pm.Month1 = Month1; } if (RealPlan != null) { pm.RealPlan = RealPlan; } if (PlanDate != null) { pm.PlanDate = PlanDate; } db.SaveChanges(); } else if (status == "newadded") { TimelyRate pm = new TimelyRate(); string FAB_NAME = values.Value <string>("FAB_NAME"); double?Week1 = values.Value <double?>("Week1"); double?Week2 = values.Value <double?>("Week2"); double?Week3 = values.Value <double?>("Week3"); double?Week4 = values.Value <double?>("Week4"); double?Month1 = values.Value <double?>("Month1"); double?RealPlan = values.Value <double?>("RealPlan"); string PlanDate = values.Value <string>("PlanDate"); if (FAB_NAME != null) { pm.FAB_NAME = FAB_NAME; } if (Week1 != null) { pm.Week1 = Week1; } if (Week2 != null) { pm.Week2 = Week2; } if (Week3 != null) { pm.Week3 = Week3; } if (Week4 != null) { pm.Week4 = Week4; } if (Month1 != null) { pm.Month1 = Month1; } if (RealPlan != null) { pm.RealPlan = RealPlan; } if (!string.IsNullOrEmpty(PlanDate)) { pm.PlanDate = Convert.ToDateTime(PlanDate); } db.TimelyRate.Add(pm); db.SaveChanges(); } else if (status == "deleted") { int id = mergedRow.Value <int>("id"); TimelyRate pm = db.TimelyRate.Where(p => p.ID == id).FirstOrDefault(); db.TimelyRate.Remove(pm); db.SaveChanges(); } } List <TimelyRate> pmList; int year = DateTime.Now.Year; int month = DateTime.Now.Month; if (yearMonth != null) { pmList = db.TimelyRate.Where(p => p.PlanDate.Value.Year == yearMonth.Value.Year && p.PlanDate.Value.Month == yearMonth.Value.Month).ToList(); } else { pmList = db.TimelyRate.Where(p => p.PlanDate.Value.Year == year && p.PlanDate.Value.Month == month).ToList(); } var dataSource = PagingHelper <TimelyRate> .GetPagedDataTable(pageIndex, 20, pmList.Count(), pmList); UIHelper.Grid("Grid1").DataSource(dataSource, Grid1_fields); Alert.Show("操作成功!"); return(UIHelper.Result()); }
public ActionResult btnSubmit_Click(string[] Grid1_fields, JArray Grid1_modifiedData, int pageIndex) { foreach (JObject mergedRow in Grid1_modifiedData) { string status = mergedRow.Value <string>("status"); int rowIndex = mergedRow.Value <int>("index"); JObject values = mergedRow.Value <JObject>("values"); if (status == "modified") { int id = mergedRow.Value <int>("id"); VentureCapa pm = db.VentureCapa.Where(p => p.ID == id).FirstOrDefault(); string FAB_NAME = values.Value <string>("FAB_NAME"); string VENTURENAME = values.Value <string>("VENTURENAME"); string OPERATIONNAME = values.Value <string>("OPERATIONNAME"); double?PROCUT_QUOTA = values.Value <double?>("PROCUT_QUOTA"); double?PROCUT_QUOTA_WEEK = values.Value <double?>("PROCUT_QUOTA_WEEK"); double?PROCUT_QUOTA_MONTH = values.Value <double?>("PROCUT_QUOTA_MONTH"); if (FAB_NAME != null) { pm.FAB_NAME = FAB_NAME; } if (VENTURENAME != null) { pm.VENTURENAME = VENTURENAME; } if (OPERATIONNAME != null) { pm.OPERATIONNAME = OPERATIONNAME; } if (PROCUT_QUOTA != null) { pm.PROCUT_QUOTA = PROCUT_QUOTA; } if (PROCUT_QUOTA_WEEK != null) { pm.PROCUT_QUOTA_WEEK = PROCUT_QUOTA_WEEK; } if (PROCUT_QUOTA_MONTH != null) { pm.PROCUT_QUOTA_MONTH = PROCUT_QUOTA_MONTH; } db.SaveChanges(); } else if (status == "newadded") { VentureCapa pm = new VentureCapa(); string FAB_NAME = values.Value <string>("FAB_NAME"); string VENTURENAME = values.Value <string>("VENTURENAME"); string OPERATIONNAME = values.Value <string>("OPERATIONNAME"); double?PROCUT_QUOTA = values.Value <double?>("PROCUT_QUOTA"); double?PROCUT_QUOTA_WEEK = values.Value <double?>("PROCUT_QUOTA_WEEK"); double?PROCUT_QUOTA_MONTH = values.Value <double?>("PROCUT_QUOTA_MONTH"); if (FAB_NAME != null) { pm.FAB_NAME = FAB_NAME; } if (VENTURENAME != null) { pm.VENTURENAME = VENTURENAME; } if (OPERATIONNAME != null) { pm.OPERATIONNAME = OPERATIONNAME; } if (PROCUT_QUOTA != null) { pm.PROCUT_QUOTA = PROCUT_QUOTA; } if (PROCUT_QUOTA_WEEK != null) { pm.PROCUT_QUOTA_WEEK = PROCUT_QUOTA_WEEK; } if (PROCUT_QUOTA_MONTH != null) { pm.PROCUT_QUOTA_MONTH = PROCUT_QUOTA_MONTH; } db.VentureCapa.Add(pm); db.SaveChanges(); } else if (status == "deleted") { int id = mergedRow.Value <int>("id"); VentureCapa pm = db.VentureCapa.Where(p => p.ID == id).FirstOrDefault(); db.VentureCapa.Remove(pm); db.SaveChanges(); } } List <VentureCapa> pmList; int year = DateTime.Now.Year; int month = DateTime.Now.Month; pmList = db.VentureCapa.ToList(); var dataSource = PagingHelper <VentureCapa> .GetPagedDataTable(pageIndex, 20, pmList.Count(), pmList); UIHelper.Grid("Grid1").DataSource(dataSource, Grid1_fields); Alert.Show("操作成功!"); return(UIHelper.Result()); }