public string UpWorkEmp(int MainID, string WorkingName, int EmpID) { string aaa = string.Empty; Hownet.BLL.Working bllW = new Working(); DataTable dtW = bllW.GetList("(Name='" + WorkingName + "')").Tables[0]; if (dtW.Rows.Count > 0) { DataTable dt = dal.GetList("(MainID=" + MainID + ") And (WorkingID=" + dtW.Rows[0]["ID"] + ")").Tables[0]; if (dt.Rows.Count == 1) { Hownet.Model.WorkTicketInfo modWTI = GetModel(Convert.ToInt32(dt.Rows[0]["ID"])); modWTI.EmployeeID = EmpID; modWTI.DateTime = DateTime.Now; Update(modWTI); Hownet.BLL.WorkTicket bllWT = new WorkTicket(); Hownet.BLL.ProductTaskMain bllPTM = new ProductTaskMain(); Hownet.Model.WorkTicket modWT = bllWT.GetModel(modWTI.MainID); Hownet.Model.ProductTaskMain modPTM = bllPTM.GetModel(modWT.TaskID); Hownet.BLL.PayInfo bllPI = new PayInfo(); Hownet.Model.PayInfo modPI = new Hownet.Model.PayInfo(); modPI.A = 3; modPI.Amount = modWTI.Amount; modPI.BoxNum = modWT.BoxNum; modPI.BreakID = 1; modPI.ColorID = modWT.ColorID; modPI.DateTime = DateTime.Now; modPI.EmployeeID = EmpID; modPI.ID = 0; modPI.IsDay = false; modPI.IsSum = false; modPI.MaterielID = modPTM.MaterielID; modPI.OderNum = modPTM.DateTime.ToString("yyyyMMdd") + modPTM.Num.ToString().PadLeft(3, '0'); modPI.Price = 0; modPI.ProductWorkingID = modWTI.PWorkingInfoID; modPI.SizeID = modWT.SizeID; modPI.WorkingID = modWTI.WorkingID; modPI.WorkticketInfoID = modWTI.ID; bllPI.Add(modPI); aaa = DateTime.Now.ToString(); } } return(aaa); }
public void Save(DataTable dt, int mainID, int EmployeeID, DateTime date) { int rowsCount = dt.Rows.Count; if (rowsCount > 0) { Hownet.Model.HandBackInfo model; Hownet.BLL.PayInfo bllPI = new PayInfo(); Hownet.Model.PayInfo modPI = new Hownet.Model.PayInfo(); for (int n = 0; n < rowsCount; n++) { if (dt.Rows[n].RowState != DataRowState.Deleted) { string a = dt.Rows[n]["A"].ToString(); if (a != "1") { model = new Hownet.Model.HandBackInfo(); if (dt.Rows[n]["MaterielID"].ToString() != "") { modPI.MaterielID = model.MaterielID = int.Parse(dt.Rows[n]["MaterielID"].ToString()); } if (dt.Rows[n]["WorkingID"].ToString() != "") { modPI.WorkingID = model.WorkingID = int.Parse(dt.Rows[n]["WorkingID"].ToString()); } if (dt.Rows[n]["Amount"].ToString() != "") { modPI.Amount = model.Amount = int.Parse(dt.Rows[n]["Amount"].ToString()); } if (dt.Rows[n]["Price"].ToString() != "") { modPI.Price = model.Price = decimal.Parse(dt.Rows[n]["Price"].ToString()); } if (dt.Rows[n]["Money"].ToString() != "") { model.Money = decimal.Parse(dt.Rows[n]["Money"].ToString()); } if (dt.Rows[n]["PriceID"].ToString() != "") { modPI.ProductWorkingID = model.PriceID = int.Parse(dt.Rows[n]["PriceID"].ToString()); } modPI.BoxNum = model.InfoID = int.Parse(dt.Rows[n]["InfoID"].ToString()); modPI.EmployeeID = EmployeeID; modPI.DateTime = date; model.MainID = mainID; modPI.ColorID = modPI.SizeID = 0; modPI.OderNum = ""; modPI.IsSum = false; if (model.MaterielID != 0 && model.WorkingID != 0 && model.Amount != 0) { if (a == "3") { modPI.BoxNum = Add(model); bllPI.Add(modPI); } else if (a == "2") { modPI.ID = int.Parse(dt.Rows[n]["PayInfoID"].ToString()); Update(model); bllPI.Update(modPI); } } } } } } }
/// <summary> /// 更新一条数据 /// </summary> public void Update(Hownet.Model.PayInfo model) { dal.Update(model); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Hownet.Model.PayInfo model) { return(dal.Add(model)); }
/// <summary> /// 获得数据列表 /// </summary> public List <Hownet.Model.PayInfo> DataTableToList(DataTable dt) { List <Hownet.Model.PayInfo> modelList = new List <Hownet.Model.PayInfo>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { Hownet.Model.PayInfo model; for (int n = 0; n < rowsCount; n++) { model = new Hownet.Model.PayInfo(); if (dt.Rows[n]["ID"].ToString() != "") { model.ID = int.Parse(dt.Rows[n]["ID"].ToString()); } if (dt.Rows[n]["EmployeeID"].ToString() != "") { model.EmployeeID = int.Parse(dt.Rows[n]["EmployeeID"].ToString()); } if (dt.Rows[n]["DateTime"].ToString() != "") { model.DateTime = DateTime.Parse(dt.Rows[n]["DateTime"].ToString()); } if (dt.Rows[n]["MaterielID"].ToString() != "") { model.MaterielID = int.Parse(dt.Rows[n]["MaterielID"].ToString()); } if (dt.Rows[n]["WorkingID"].ToString() != "") { model.WorkingID = int.Parse(dt.Rows[n]["WorkingID"].ToString()); } if (dt.Rows[n]["Amount"].ToString() != "") { model.Amount = int.Parse(dt.Rows[n]["Amount"].ToString()); } if (dt.Rows[n]["Price"].ToString() != "") { model.Price = decimal.Parse(dt.Rows[n]["Price"].ToString()); } if (dt.Rows[n]["ProductWorkingID"].ToString() != "") { model.ProductWorkingID = int.Parse(dt.Rows[n]["ProductWorkingID"].ToString()); } if (dt.Rows[n]["WorkticketInfoID"].ToString() != "") { model.WorkticketInfoID = int.Parse(dt.Rows[n]["WorkticketInfoID"].ToString()); } if (dt.Rows[n]["IsSum"].ToString() != "") { string oo = dt.Rows[n]["IsSum"].ToString(); if (oo == "1" || oo.ToLower() == "true") { model.IsSum = true; } else { model.IsSum = false; } } if (dt.Rows[n]["BreakID"].ToString() != "") { model.BreakID = int.Parse(dt.Rows[n]["BreakID"].ToString()); } if (dt.Rows[n]["ColorID"].ToString() != "") { model.ColorID = int.Parse(dt.Rows[n]["ColorID"].ToString()); } if (dt.Rows[n]["SizeID"].ToString() != "") { model.SizeID = int.Parse(dt.Rows[n]["SizeID"].ToString()); } if (dt.Rows[n]["BoxNum"].ToString() != "") { model.BoxNum = int.Parse(dt.Rows[n]["BoxNum"].ToString()); } model.OderNum = dt.Rows[n]["OderNum"].ToString(); if (dt.Rows[n]["IsDay"].ToString() != "") { if ((dt.Rows[n]["IsDay"].ToString() == "1") || (dt.Rows[n]["IsDay"].ToString().ToLower() == "true")) { model.IsDay = true; } else { model.IsDay = false; } } modelList.Add(model); } } return(modelList); }