Example #1
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            for (int i = 0; i < lbOrderInfos.Items.Count; i++)
            {
                Express.Model.SendOrderInfo orderInfo = new Express.Model.SendOrderInfo();
                orderInfo.SalesmanID   = Convert.ToInt32(ddlSaleMan.SelectedValue);
                orderInfo.OrderNo      = lbOrderInfos.Items[i].ToString();
                orderInfo.Contractdate = dtpReciveDate.Value;
                orderInfo.Daterecived  = orderInfo.Contractdate;
                orderInfo.OperUser     = ClientInfo.Sys_UserInfo.username;
                orderInfo.UserDate     = DateTime.Now;

                new Express.BLL.SendOrderInfo().Add(orderInfo);
            }
            lbOrderInfos.Items.Clear();
            this.DialogResult = System.Windows.Forms.DialogResult.OK;
        }
Example #2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Express.Model.SendOrderInfo DataRowToModel(DataRow row)
 {
     Express.Model.SendOrderInfo model = new Express.Model.SendOrderInfo();
     if (row != null)
     {
         if (row["Id"] != null && row["Id"].ToString() != "")
         {
             model.Id = int.Parse(row["Id"].ToString());
         }
         if (row["OrderNo"] != null)
         {
             model.OrderNo = row["OrderNo"].ToString();
         }
         if (row["Daterecived"] != null && row["Daterecived"].ToString() != "")
         {
             model.Daterecived = DateTime.Parse(row["Daterecived"].ToString());
         }
         if (row["SalesmanID"] != null && row["SalesmanID"].ToString() != "")
         {
             model.SalesmanID = int.Parse(row["SalesmanID"].ToString());
         }
         if (row["CustomerID"] != null && row["CustomerID"].ToString() != "")
         {
             model.CustomerID = int.Parse(row["CustomerID"].ToString());
         }
         if (row["Tel"] != null)
         {
             model.Tel = row["Tel"].ToString();
         }
         if (row["Provice"] != null)
         {
             model.Provice = row["Provice"].ToString();
         }
         if (row["City"] != null)
         {
             model.City = row["City"].ToString();
         }
         if (row["Area"] != null)
         {
             model.Area = row["Area"].ToString();
         }
         if (row["Address"] != null)
         {
             model.Address = row["Address"].ToString();
         }
         if (row["Reciver"] != null)
         {
             model.Reciver = row["Reciver"].ToString();
         }
         if (row["Remark"] != null)
         {
             model.Remark = row["Remark"].ToString();
         }
         if (row["Contractor"] != null)
         {
             model.Contractor = row["Contractor"].ToString();
         }
         if (row["Contractdate"] != null && row["Contractdate"].ToString() != "")
         {
             model.Contractdate = DateTime.Parse(row["Contractdate"].ToString());
         }
         if (row["OState"] != null && row["OState"].ToString() != "")
         {
             model.OState = int.Parse(row["OState"].ToString());
         }
         if (row["Merchandiser"] != null && row["Merchandiser"].ToString() != "")
         {
             model.Merchandiser = int.Parse(row["Merchandiser"].ToString());
         }
         if (row["UserDate"] != null && row["UserDate"].ToString() != "")
         {
             model.UserDate = DateTime.Parse(row["UserDate"].ToString());
         }
         if (row["OperUser"] != null)
         {
             model.OperUser = row["OperUser"].ToString();
         }
         if (row["ORState"] != null && row["ORState"].ToString() != "")
         {
             model.ORState = int.Parse(row["ORState"].ToString());
         }
         if (row["Paream0"] != null)
         {
             model.Paream0 = row["Paream0"].ToString();
         }
         if (row["Paream1"] != null)
         {
             model.Paream1 = row["Paream1"].ToString();
         }
         if (row["Paream2"] != null)
         {
             model.Paream2 = row["Paream2"].ToString();
         }
         if (row["Paream3"] != null)
         {
             model.Paream3 = row["Paream3"].ToString();
         }
         if (row["Paream4"] != null)
         {
             model.Paream4 = row["Paream4"].ToString();
         }
         if (row["Paream5"] != null && row["Paream5"].ToString() != "")
         {
             model.Paream5 = int.Parse(row["Paream5"].ToString());
         }
         if (row["Paream6"] != null && row["Paream6"].ToString() != "")
         {
             model.Paream6 = int.Parse(row["Paream6"].ToString());
         }
         if (row["Paream7"] != null && row["Paream7"].ToString() != "")
         {
             model.Paream7 = int.Parse(row["Paream7"].ToString());
         }
         if (row["Paream8"] != null && row["Paream8"].ToString() != "")
         {
             model.Paream8 = int.Parse(row["Paream8"].ToString());
         }
     }
     return(model);
 }
Example #3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(Express.Model.SendOrderInfo model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into SendOrderInfo(");
            strSql.Append("OrderNo,Daterecived,SalesmanID,CustomerID,Tel,Provice,City,Area,Address,Reciver,Remark,Contractor,Contractdate,OState,Merchandiser,UserDate,OperUser,ORState,Paream0,Paream1,Paream2,Paream3,Paream4,Paream5,Paream6,Paream7,Paream8)");
            strSql.Append(" values (");
            strSql.Append("@OrderNo,@Daterecived,@SalesmanID,@CustomerID,@Tel,@Provice,@City,@Area,@Address,@Reciver,@Remark,@Contractor,@Contractdate,@OState,@Merchandiser,@UserDate,@OperUser,@ORState,@Paream0,@Paream1,@Paream2,@Paream3,@Paream4,@Paream5,@Paream6,@Paream7,@Paream8)");
            OleDbParameter[] parameters =
            {
                new OleDbParameter("@OrderNo",      OleDbType.VarChar,  30),
                new OleDbParameter("@Daterecived",  OleDbType.Date),
                new OleDbParameter("@SalesmanID",   OleDbType.Integer,   4),
                new OleDbParameter("@CustomerID",   OleDbType.Integer,   4),
                new OleDbParameter("@Tel",          OleDbType.VarChar,  30),
                new OleDbParameter("@Provice",      OleDbType.VarChar,  30),
                new OleDbParameter("@City",         OleDbType.VarChar,  30),
                new OleDbParameter("@Area",         OleDbType.VarChar,  30),
                new OleDbParameter("@Address",      OleDbType.VarChar, 200),
                new OleDbParameter("@Reciver",      OleDbType.VarChar,  10),
                new OleDbParameter("@Remark",       OleDbType.VarChar, 100),
                new OleDbParameter("@Contractor",   OleDbType.VarChar,  20),
                new OleDbParameter("@Contractdate", OleDbType.Date),
                new OleDbParameter("@OState",       OleDbType.Integer,   4),
                new OleDbParameter("@Merchandiser", OleDbType.Integer,   4),
                new OleDbParameter("@UserDate",     OleDbType.Date),
                new OleDbParameter("@OperUser",     OleDbType.VarChar,  20),
                new OleDbParameter("@ORState",      OleDbType.Integer,   4),
                new OleDbParameter("@Paream0",      OleDbType.VarChar, 255),
                new OleDbParameter("@Paream1",      OleDbType.VarChar, 255),
                new OleDbParameter("@Paream2",      OleDbType.VarChar, 255),
                new OleDbParameter("@Paream3",      OleDbType.VarChar, 255),
                new OleDbParameter("@Paream4",      OleDbType.VarChar, 255),
                new OleDbParameter("@Paream5",      OleDbType.Integer,   4),
                new OleDbParameter("@Paream6",      OleDbType.Integer,   4),
                new OleDbParameter("@Paream7",      OleDbType.Integer,   4),
                new OleDbParameter("@Paream8",      OleDbType.Integer, 4)
            };
            parameters[0].Value  = model.OrderNo;
            parameters[1].Value  = model.Daterecived;
            parameters[2].Value  = model.SalesmanID;
            parameters[3].Value  = model.CustomerID;
            parameters[4].Value  = model.Tel;
            parameters[5].Value  = model.Provice;
            parameters[6].Value  = model.City;
            parameters[7].Value  = model.Area;
            parameters[8].Value  = model.Address;
            parameters[9].Value  = model.Reciver;
            parameters[10].Value = model.Remark;
            parameters[11].Value = model.Contractor;
            parameters[12].Value = model.Contractdate;
            parameters[13].Value = model.OState;
            parameters[14].Value = model.Merchandiser;
            parameters[15].Value = model.UserDate;
            parameters[16].Value = model.OperUser;
            parameters[17].Value = model.ORState;
            parameters[18].Value = model.Paream0;
            parameters[19].Value = model.Paream1;
            parameters[20].Value = model.Paream2;
            parameters[21].Value = model.Paream3;
            parameters[22].Value = model.Paream4;
            parameters[23].Value = model.Paream5;
            parameters[24].Value = model.Paream6;
            parameters[25].Value = model.Paream7;
            parameters[26].Value = model.Paream8;

            int rows = DbHelperOleDb.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #4
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Express.Model.SendOrderInfo model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update SendOrderInfo set ");
            strSql.Append("OrderNo=@OrderNo,");
            strSql.Append("Daterecived=@Daterecived,");
            strSql.Append("SalesmanID=@SalesmanID,");
            strSql.Append("CustomerID=@CustomerID,");
            strSql.Append("Tel=@Tel,");
            strSql.Append("Provice=@Provice,");
            strSql.Append("City=@City,");
            strSql.Append("Area=@Area,");
            strSql.Append("Address=@Address,");
            strSql.Append("Reciver=@Reciver,");
            strSql.Append("Remark=@Remark,");
            strSql.Append("Contractor=@Contractor,");
            strSql.Append("Contractdate=@Contractdate,");
            strSql.Append("OState=@OState,");
            strSql.Append("Merchandiser=@Merchandiser,");
            strSql.Append("UserDate=@UserDate,");
            strSql.Append("OperUser=@OperUser,");
            strSql.Append("ORState=@ORState,");
            strSql.Append("Paream0=@Paream0,");
            strSql.Append("Paream1=@Paream1,");
            strSql.Append("Paream2=@Paream2,");
            strSql.Append("Paream3=@Paream3,");
            strSql.Append("Paream4=@Paream4,");
            strSql.Append("Paream5=@Paream5,");
            strSql.Append("Paream6=@Paream6,");
            strSql.Append("Paream7=@Paream7,");
            strSql.Append("Paream8=@Paream8");
            strSql.Append(" where Id=@Id");
            OleDbParameter[] parameters =
            {
                new OleDbParameter("@OrderNo",      OleDbType.VarChar,  30),
                new OleDbParameter("@Daterecived",  OleDbType.Date),
                new OleDbParameter("@SalesmanID",   OleDbType.Integer,   4),
                new OleDbParameter("@CustomerID",   OleDbType.Integer,   4),
                new OleDbParameter("@Tel",          OleDbType.VarChar,  30),
                new OleDbParameter("@Provice",      OleDbType.VarChar,  30),
                new OleDbParameter("@City",         OleDbType.VarChar,  30),
                new OleDbParameter("@Area",         OleDbType.VarChar,  30),
                new OleDbParameter("@Address",      OleDbType.VarChar, 200),
                new OleDbParameter("@Reciver",      OleDbType.VarChar,  10),
                new OleDbParameter("@Remark",       OleDbType.VarChar, 100),
                new OleDbParameter("@Contractor",   OleDbType.VarChar,  20),
                new OleDbParameter("@Contractdate", OleDbType.Date),
                new OleDbParameter("@OState",       OleDbType.Integer,   4),
                new OleDbParameter("@Merchandiser", OleDbType.Integer,   4),
                new OleDbParameter("@UserDate",     OleDbType.Date),
                new OleDbParameter("@OperUser",     OleDbType.VarChar,  20),
                new OleDbParameter("@ORState",      OleDbType.Integer,   4),
                new OleDbParameter("@Paream0",      OleDbType.VarChar, 255),
                new OleDbParameter("@Paream1",      OleDbType.VarChar, 255),
                new OleDbParameter("@Paream2",      OleDbType.VarChar, 255),
                new OleDbParameter("@Paream3",      OleDbType.VarChar, 255),
                new OleDbParameter("@Paream4",      OleDbType.VarChar, 255),
                new OleDbParameter("@Paream5",      OleDbType.Integer,   4),
                new OleDbParameter("@Paream6",      OleDbType.Integer,   4),
                new OleDbParameter("@Paream7",      OleDbType.Integer,   4),
                new OleDbParameter("@Paream8",      OleDbType.Integer,   4),
                new OleDbParameter("@Id",           OleDbType.Integer, 4)
            };
            parameters[0].Value  = model.OrderNo;
            parameters[1].Value  = model.Daterecived;
            parameters[2].Value  = model.SalesmanID;
            parameters[3].Value  = model.CustomerID;
            parameters[4].Value  = model.Tel;
            parameters[5].Value  = model.Provice;
            parameters[6].Value  = model.City;
            parameters[7].Value  = model.Area;
            parameters[8].Value  = model.Address;
            parameters[9].Value  = model.Reciver;
            parameters[10].Value = model.Remark;
            parameters[11].Value = model.Contractor;
            parameters[12].Value = model.Contractdate;
            parameters[13].Value = model.OState;
            parameters[14].Value = model.Merchandiser;
            parameters[15].Value = model.UserDate;
            parameters[16].Value = model.OperUser;
            parameters[17].Value = model.ORState;
            parameters[18].Value = model.Paream0;
            parameters[19].Value = model.Paream1;
            parameters[20].Value = model.Paream2;
            parameters[21].Value = model.Paream3;
            parameters[22].Value = model.Paream4;
            parameters[23].Value = model.Paream5;
            parameters[24].Value = model.Paream6;
            parameters[25].Value = model.Paream7;
            parameters[26].Value = model.Paream8;
            parameters[27].Value = model.Id;

            int rows = DbHelperOleDb.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }