private void buildNode(string SalesOutID, string ConsignorId) { SalesOutDAL sdal = Leyp.SQLServerDAL.Sales.Factory.getSalesOutDAL(); VSalesOut vs = sdal.getByID(SalesOutID); if (vs.State == 1) { SalesDispatch d = new SalesDispatch(); d.Consignor = ConsignorId; d.CreateDate = DateTime.Now.ToString("yyyy-MM-dd");; d.DeliveryDate = DateTime.Now.ToString("yyyy-MM-dd");; d.DeliveryType = vs.DeliveryName; d.Description = "无"; d.SalesOutID = SalesOutID; d.SentDate = DateTime.Now.ToString("yyyy-MM-dd");; d.State = 0; d.UserName = getUserName(); Leyp.SQLServerDAL.Sales.Factory.getSalesDispatchDAL().insertNewEntity(d); Response.Write("单号:" + SalesOutID + " 成功生成<br>"); } else { Response.Write("单号:" + SalesOutID + " 没有审核 或已经处理了 <br>"); } }
public bool insertNewEntity(SalesDispatch s) { int rowsAffected = 0; SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@SalesOutID", SqlDbType.NVarChar), new SqlParameter("@CreateDate", SqlDbType.NVarChar), new SqlParameter("@DeliveryType", SqlDbType.NVarChar), new SqlParameter("@DeliveryDate", SqlDbType.NVarChar), new SqlParameter("@SentDate", SqlDbType.NVarChar), new SqlParameter("@Consignor ", SqlDbType.NVarChar), new SqlParameter("@UserName", SqlDbType.NVarChar), new SqlParameter("@Description", SqlDbType.NVarChar), new SqlParameter("@State", SqlDbType.Int) }; parameters[0].Value = s.SalesOutID; parameters[1].Value = s.CreateDate; parameters[2].Value = s.DeliveryType; parameters[3].Value = s.DeliveryDate; parameters[4].Value = s.SentDate; parameters[5].Value = s.Consignor; parameters[6].Value = s.UserName; parameters[7].Value = s.Description; parameters[8].Value = s.State; SQLHelper.RunProcedure("p_SalesDispatch_insertNewEntity", parameters, out rowsAffected); if (s.State == 0) { new SalesOutDAL().updateSate(2, s.SalesOutID); } else if (s.State == 1) { new SalesOutDAL().updateSate(3, s.SalesOutID); } return(1 == rowsAffected); }
protected void init() { string action = Request.Form["action"].ToString(); if (action.Equals("add"))//添加 { #region 单据添加 string str0 = Request.Form["SalesOutID"].ToString(); string str1 = Request.Form["CreateDate"].ToString(); string str2 = Request.Form["DeliveryType"].ToString(); string str3 = Request.Form["DeliveryDate"].ToString(); string str4 = Request.Form["SentDate"].ToString(); string str5 = Request.Form["Consignor"].ToString(); string str6 = Request.Form["Description"].ToString(); string str7 = Request.Form["State"].ToString(); SalesDispatch d = new SalesDispatch(); d.Consignor = str5; d.CreateDate = str1; d.DeliveryDate = str3; d.DeliveryType = str2; d.Description = str6; d.SalesOutID = str0; d.SentDate = str4; d.State = int.Parse(str7); d.UserName = getUserName(); Leyp.SQLServerDAL.Sales.Factory.getSalesDispatchDAL().insertNewEntity(d); Response.Write("00"); Response.End(); #endregion } else if (action.Equals("edit"))//加载明细BY SalesOrderID { #region 单据修改提交 string str0 = Request.Form["SalesOutID"].ToString(); string str2 = Request.Form["DeliveryType"].ToString(); string str3 = Request.Form["DeliveryDate"].ToString(); string str4 = Request.Form["SentDate"].ToString(); string str5 = Request.Form["Consignor"].ToString(); string str6 = Request.Form["Description"].ToString(); string str7 = Request.Form["State"].ToString(); string str8 = Request.Form["DispatchID"].ToString(); SalesDispatch d = new SalesDispatch(); d.Consignor = str5; d.DeliveryDate = str3; d.DeliveryType = str2; d.Description = str6; d.SentDate = str4; d.State = int.Parse(str7); d.UserName = getUserName(); d.DispatchID = int.Parse(str8); d.SalesOutID = str0; Leyp.SQLServerDAL.Sales.Factory.getSalesDispatchDAL().updateEntity(d); Response.Write("00"); Response.End(); #endregion } else if (action.Equals("delDetail"))//delete { } }