public void JumpShow(WorkerEntity obj) { if (obj.Workunit == "人事管理") { WorkerManage worker = new WorkerManage(); worker.Show(); } else if (obj.Workunit == "销售管理") { SaleManage saleManage = new SaleManage(); saleManage.Show(); } else if (obj.Workunit == "进货管理") { PurchaseManage purchase = new PurchaseManage(); purchase.Show(); } else if (obj.Workunit == "库存管理") { StockManage stockManage = new StockManage(); stockManage.Show(); } else if (obj.Workunit == "销售员") { SalerManage salerManage = new SalerManage(obj); salerManage.Show(); } }
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 List <SaleManage> ConvertToProductManage(List <List <object> > beanList) { List <SaleManage> pList = new List <SaleManage>(); foreach (var bean in beanList) { try { SaleManage p = new SaleManage(); if (bean[0] != null) { p.PLAN_DATE = (DateTime)bean[0]; } else { continue; } if (bean[1] != null) { p.MANAGE_PLAN = (double)bean[1]; } else { continue; } if (bean[2] != null) { p.SALE_PLAN = (double)bean[2]; } else { continue; } if (bean[3] != null) { p.SALE_FINISH = (double)bean[3]; } else { continue; } if (bean[4] != null) { p.RSPO_DEPT = (string)bean[4]; } else { continue; } if (bean[5] != null) { p.REMARK = (string)bean[5]; } else { continue; } if (bean[6] != null) { p.Company = (string)bean[6]; } else { continue; } if (bean[7] != null && bean[7].GetType() == typeof(double)) { p.SellYear = Convert.ToInt32((double)bean[7]); } else { continue; } pList.Add(p); } catch (Exception e) { e.ToString(); continue; } } return(pList); }
private void LoadSale() { var sale = new SaleManage(); ShowForm.Show(sale, Dialog: true); }