/// <summary>
        /// 从一个SqlDataReader里读数据
        /// </summary>
        /// <param name="Reader">SqlDataReader</param>
        /// <returns>basic_order_planExample</returns>
        public static basic_order_plan GetByReader(SqlDataReader Reader)
        {
            basic_order_plan basic_order_planExample = new basic_order_plan();

            basic_order_planExample.opid     = Reader["opid"] == DBNull.Value ? 0 : (int)Reader["opid"];
            basic_order_planExample.opday1   = Reader["opday1"] == DBNull.Value ? 0 : (int)Reader["opday1"];
            basic_order_planExample.opday2   = Reader["opday2"] == DBNull.Value ? 0 : (int)Reader["opday2"];
            basic_order_planExample.opday3   = Reader["opday3"] == DBNull.Value ? 0 : (int)Reader["opday3"];
            basic_order_planExample.opday4   = Reader["opday4"] == DBNull.Value ? 0 : (int)Reader["opday4"];
            basic_order_planExample.opday5   = Reader["opday5"] == DBNull.Value ? 0 : (int)Reader["opday5"];
            basic_order_planExample.opday6   = Reader["opday6"] == DBNull.Value ? 0 : (int)Reader["opday6"];
            basic_order_planExample.opday7   = Reader["opday7"] == DBNull.Value ? 0 : (int)Reader["opday7"];
            basic_order_planExample.opday8   = Reader["opday8"] == DBNull.Value ? 0 : (int)Reader["opday8"];
            basic_order_planExample.opday9   = Reader["opday9"] == DBNull.Value ? 0 : (int)Reader["opday9"];
            basic_order_planExample.opday10  = Reader["opday10"] == DBNull.Value ? 0 : (int)Reader["opday10"];
            basic_order_planExample.opday11  = Reader["opday11"] == DBNull.Value ? 0 : (int)Reader["opday11"];
            basic_order_planExample.opday12  = Reader["opday12"] == DBNull.Value ? 0 : (int)Reader["opday12"];
            basic_order_planExample.opday13  = Reader["opday13"] == DBNull.Value ? 0 : (int)Reader["opday13"];
            basic_order_planExample.opday14  = Reader["opday14"] == DBNull.Value ? 0 : (int)Reader["opday14"];
            basic_order_planExample.opnum    = Reader["opnum"] == DBNull.Value ? 0 : (int)Reader["opnum"];
            basic_order_planExample.optype   = Reader["optype"] == DBNull.Value ? null : Reader["optype"].ToString();
            basic_order_planExample.opremark = Reader["opremark"] == DBNull.Value ? null : Reader["opremark"].ToString();
            basic_order_planExample.opname   = Reader["opname"] == DBNull.Value ? null : Reader["opname"].ToString();
            return(basic_order_planExample);
        }
Exemple #2
0
 void bind()
 {
     if (!string.IsNullOrEmpty(id))
     {
         int temp = 0;
         if (int.TryParse(id, out temp))
         {
             basic_order_plan dp = basic_order_planManager.SearchByID(temp);
             if (dp != null)
             {
                 try
                 {
                     ddl_optype.SelectedValue = dp.optype;
                     txt_1.Text      = dp.opday1.ToString();
                     txt_2.Text      = dp.opday2.ToString();
                     txt_3.Text      = dp.opday3.ToString();
                     txt_4.Text      = dp.opday4.ToString();
                     txt_5.Text      = dp.opday5.ToString();
                     txt_6.Text      = dp.opday6.ToString();
                     txt_7.Text      = dp.opday7.ToString();
                     txt_8.Text      = dp.opday8.ToString();
                     txt_9.Text      = dp.opday9.ToString();
                     txt_10.Text     = dp.opday10.ToString();
                     txt_11.Text     = dp.opday11.ToString();
                     txt_12.Text     = dp.opday12.ToString();
                     txt_13.Text     = dp.opday13.ToString();
                     txt_14.Text     = dp.opday14.ToString();
                     txt_name.Text   = dp.opname;
                     txt_remark.Text = dp.opremark;
                 }
                 catch { }
             }
         }
     }
 }
        /// <summary>
        /// 查询全部数据
        /// </summary>
        /// <returns>IList</returns>
        /*查看是否为视图*/
        public IList <basic_order_plan> SearchAll()
        {
            DBHelper.sqlstr = "select * from basic_order_plan ";
            List <basic_order_plan> list   = new List <basic_order_plan>();
            SqlDataReader           reader = DBHelper.ExecuteReader();

            while (reader.Read())
            {
                basic_order_plan Obj = GetByReader(reader);
                list.Add(Obj);
            }
            reader.Close();
            return(list);
        }
Exemple #4
0
        /// <summary>
        /// 根据编号获取补单方案
        /// </summary>
        /// <param name="opid"></param>
        /// <returns></returns>
        public static basic_order_plan GetInList(string opid)
        {
            basic_order_plan         op   = null;
            IList <basic_order_plan> list = GetList();

            foreach (basic_order_plan dp in list)
            {
                if (dp.opid.ToString() == opid)
                {
                    op = dp;
                    break;
                }
            }
            return(op);
        }
        /// <summary>
        /// 根据opid,查询一条数据
        /// </summary>
        /// <param name="opid">编号</param>
        /// <returns></returns>
        /*查看是否为视图*/

        public basic_order_plan SearchByID(int opid)
        {
            DBHelper.sqlstr = "select * from basic_order_plan where opid = @opid";
            SqlParameter[] param = new SqlParameter[] {
                new SqlParameter("@opid", opid)
            };
            SqlDataReader    reader = DBHelper.ExecuteReader(param);
            basic_order_plan Obj    = null;

            if (reader.Read())
            {
                Obj = GetByReader(reader);
            }
            reader.Close();
            return(Obj);
        }
        /// <summary>
        /// 搜索条件
        /// </summary>
        /// <param name="s">开始位置</param>
        /// <param name="e">结束位置</param>
        /// <param name="key">关键词</param>
        /// <param name="state">状态</param>
        /// <param name="orderby">排序方式,直接输入order by后面的语句</param>
        /// <returns>IList<basic_order_plan></returns>
        public IList <basic_order_plan> Search(int s, int e, string key, string state, string orderby)
        {
            string sql1 = "select  top " + (e - s + 1).ToString() + " *   from basic_order_plan where ";
            string sql2 = string.IsNullOrEmpty(key) ? " 1=1 " : " ( opremark like '%" + key + "%' or   opname like '%" + key + "%'   ) ";
            string sql3 = string.IsNullOrEmpty(state) ? "" : " and optype= '" + state + "' ";
            string sql4 = string.IsNullOrEmpty(orderby) ? " order by opid desc " : " order by " + orderby;
            string sql5 = s == 1 ? "" : " and opid not in ( select top " + (s - 1).ToString() + " opid from basic_order_plan where " + sql2 + sql3 + sql4 + " ) ";

            DBHelper.sqlstr = sql1 + sql2 + sql3 + sql5 + sql4;
            List <basic_order_plan> list   = new List <basic_order_plan>();
            SqlDataReader           reader = DBHelper.ExecuteReader();

            while (reader.Read())
            {
                basic_order_plan Obj = GetByReader(reader);
                list.Add(Obj);
            }
            reader.Close();
            return(list);
        }
        /// <summary>
        /// 搜索条件
        /// </summary>
        /// <param name="s">开始位置</param>
        /// <param name="e">结束位置</param>
        /// <param name="key">关键词</param>
        /// <param name="state">状态</param>
        /// <param name="orderby">排序方式,直接输入order by后面的语句</param>
        /// <returns>IList<basic_order_plan></returns>
        public IList <basic_order_plan> Search(int s, int e, string key, string state, string orderby)
        {
            string sql1  = "select  *   from basic_order_plan where ";
            string sql2  = string.IsNullOrEmpty(key) ? " 1=1 " : " ( opremark like '%" + key + "%' or   opname like '%" + key + "%'   ) ";
            string sql3  = string.IsNullOrEmpty(state) ? "" : " and optype= '" + state + "' ";
            string sql4  = string.IsNullOrEmpty(orderby) ? " order by opid desc " : " order by " + orderby;
            string sql10 = e == 0 ? " " : " limit " + s + "," + e;

            DBHelper.sqlstr = sql1 + sql2 + sql3 + sql4 + sql10;
            List <basic_order_plan> list   = new List <basic_order_plan>();
            MySqlDataReader         reader = DBHelper.ExecuteReader();

            while (reader.Read())
            {
                basic_order_plan Obj = GetByReader(reader);
                list.Add(Obj);
            }
            reader.Close();
            return(list);
        }
Exemple #8
0
    protected void btn_save_Click(object sender, EventArgs e)
    {
        try
        {
            string _type = ddl_optype.SelectedValue;
            int    op1   = 0;
            if (!int.TryParse(txt_1.Text.Trim(), out op1))
            {
                Manager.Alert("请输入正确的数量", Page);
                Manager.TextBox_Select(txt_1);
                return;
            }
            int op2 = 0;
            if (!int.TryParse(txt_2.Text.Trim(), out op2))
            {
                Manager.Alert("请输入正确的数量", Page);
                Manager.TextBox_Select(txt_1);
                return;
            }
            int op3 = 0;
            if (!int.TryParse(txt_3.Text.Trim(), out op3))
            {
                Manager.Alert("请输入正确的数量", Page);
                Manager.TextBox_Select(txt_3);
                return;
            }
            int op4 = 0;
            if (!int.TryParse(txt_4.Text.Trim(), out op4))
            {
                Manager.Alert("请输入正确的数量", Page);
                Manager.TextBox_Select(txt_4);
                return;
            }
            int op5 = 0;
            if (!int.TryParse(txt_5.Text.Trim(), out op5))
            {
                Manager.Alert("请输入正确的数量", Page);
                Manager.TextBox_Select(txt_5);
                return;
            }
            int op6 = 0;
            if (!int.TryParse(txt_6.Text.Trim(), out op6))
            {
                Manager.Alert("请输入正确的数量", Page);
                Manager.TextBox_Select(txt_6);
                return;
            }
            int op7 = 0;
            if (!int.TryParse(txt_7.Text.Trim(), out op7))
            {
                Manager.Alert("请输入正确的数量", Page);
                Manager.TextBox_Select(txt_7);
                return;
            }
            int op8 = 0;
            if (!int.TryParse(txt_8.Text.Trim(), out op8))
            {
                Manager.Alert("请输入正确的数量", Page);
                Manager.TextBox_Select(txt_8);
                return;
            }
            int op9 = 0;
            if (!int.TryParse(txt_9.Text.Trim(), out op9))
            {
                Manager.Alert("请输入正确的数量", Page);
                Manager.TextBox_Select(txt_9);
                return;
            }
            int op10 = 0;
            if (!int.TryParse(txt_10.Text.Trim(), out op10))
            {
                Manager.Alert("请输入正确的数量", Page);
                Manager.TextBox_Select(txt_10);
                return;
            }
            int op11 = 0;
            if (!int.TryParse(txt_11.Text.Trim(), out op11))
            {
                Manager.Alert("请输入正确的数量", Page);
                Manager.TextBox_Select(txt_11);
                return;
            }
            int op12 = 0;
            if (!int.TryParse(txt_12.Text.Trim(), out op12))
            {
                Manager.Alert("请输入正确的数量", Page);
                Manager.TextBox_Select(txt_12);
                return;
            }
            int op13 = 0;
            if (!int.TryParse(txt_13.Text.Trim(), out op13))
            {
                Manager.Alert("请输入正确的数量", Page);
                Manager.TextBox_Select(txt_13);
                return;
            }
            int op14 = 0;
            if (!int.TryParse(txt_14.Text.Trim(), out op14))
            {
                Manager.Alert("请输入正确的数量", Page);
                Manager.TextBox_Select(txt_14);
                return;
            }



            string name   = txt_name.Text.Trim();
            string remark = txt_remark.Text.Trim();

            basic_order_plan dp = new basic_order_plan();


            if (!string.IsNullOrEmpty(id))
            {
                dp = BLL.basic_order_planManager.SearchByID(Convert.ToInt32(id));
            }


            dp.optype   = _type;
            dp.opremark = remark;
            dp.opday1   = op1;
            dp.opday2   = op2;
            dp.opday3   = op3;
            dp.opday4   = op4;
            dp.opday5   = op5;
            dp.opday6   = op6;
            dp.opday7   = op7;
            dp.opday8   = op8;
            dp.opday9   = op9;
            dp.opday10  = op10;
            dp.opday11  = op11;
            dp.opday12  = op12;
            dp.opday13  = op13;
            dp.opday14  = op14;
            dp.opname   = name;



            int res;
            if (string.IsNullOrEmpty(id))
            {
                res = BLL.basic_order_planManager.Insert(dp);
            }
            else
            {
                res = BLL.basic_order_planManager.Update(dp);
            }
            if (res == 1)
            {
                Manager.Alert("保存成功", Page);
            }
            else
            {
                Manager.Alert("保存失败", Page);
            }
        }
        catch (Exception ex)
        {
            Manager.Alert(ex.ToString(), Page);
        }
        Manager.page_href_reload(Page);
    }
Exemple #9
0
 /// <summary>
 /// 更新
 /// </summary>
 /// <param name="basic_order_plan">basic_order_plan表实例</param>
 /// <returns>int</returns>
 public static int Update(basic_order_plan basic_order_planExample)
 {
     return(Service.Update(basic_order_planExample));
 }
Exemple #10
0
 /// <summary>
 /// 插入方法
 /// </summary>
 /// <param name="basic_order_plan">basic_order_plan表实例</param>
 /// <returns>int</returns>
 public static int Insert(basic_order_plan basic_order_planExample)
 {
     return(Service.Insert(basic_order_planExample));
 }
Exemple #11
0
        /// <summary>
        /// 根据上架时间获取补单计划中需要补单数量
        /// </summary>
        /// <param name="dt">上架时间</param>
        /// <param name="id">补单方案编号</param>
        /// <returns>补单数量</returns>
        public static int GetNumInPlan(DateTime dt, int id)
        {
            int res             = 0;
            basic_order_plan bg = GetInList(id.ToString());

            if (bg != null)
            {
                //int temp_day = Manager.DateDiff_GetInt(DateTime.Now, dt);
                DateTime dt1      = Convert.ToDateTime(DateTime.Now.ToString("yyyy/MM/dd"));
                DateTime dt2      = Convert.ToDateTime(dt.ToString("yyyy/MM/dd"));
                TimeSpan ts       = dt1 - dt2;
                int      temp_day = ts.Days;
                if (temp_day == 0)
                {
                    res = bg.opday1;
                }
                if (temp_day == 1)
                {
                    res = bg.opday2;
                }
                if (temp_day == 2)
                {
                    res = bg.opday3;
                }
                if (temp_day == 3)
                {
                    res = bg.opday4;
                }
                if (temp_day == 4)
                {
                    res = bg.opday5;
                }
                if (temp_day == 5)
                {
                    res = bg.opday6;
                }
                if (temp_day == 6)
                {
                    res = bg.opday7;
                }
                if (temp_day == 7)
                {
                    res = bg.opday8;
                }
                if (temp_day == 8)
                {
                    res = bg.opday9;
                }
                if (temp_day == 9)
                {
                    res = bg.opday10;
                }
                if (temp_day == 10)
                {
                    res = bg.opday11;
                }
                if (temp_day == 11)
                {
                    res = bg.opday12;
                }
                if (temp_day == 12)
                {
                    res = bg.opday13;
                }
                if (temp_day == 13)
                {
                    res = bg.opday14;
                }
            }
            return(res);
        }
 /// <summary>
 /// 更新
 /// </summary>
 /// <param name="basic_order_plan">basic_order_plan表实例</param>
 /// <returns>int</returns>
 public int Update(basic_order_plan basic_order_planExample)
 {
     DBHelper.sqlstr = "update basic_order_plan set opday1=@opday1,opday2=@opday2,opday3=@opday3,opday4=@opday4,opday5=@opday5,opday6=@opday6,opday7=@opday7,opday8=@opday8,opday9=@opday9,opday10=@opday10,opday11=@opday11,opday12=@opday12,opday13=@opday13,opday14=@opday14,opnum=@opnum,optype=@optype,opremark=@opremark,opname=@opname where opid=" + basic_order_planExample.opid;
     return(DBHelper.ExecuteNonQuery(GetSqlParameters(basic_order_planExample)));
 }
 /// <summary>
 /// 插入方法
 /// </summary>
 /// <param name="basic_order_plan">basic_order_plan表实例</param>
 /// <returns>int</returns>
 public int Insert(basic_order_plan basic_order_planExample)
 {
     DBHelper.sqlstr = "insert into  basic_order_plan (opday1,opday2,opday3,opday4,opday5,opday6,opday7,opday8,opday9,opday10,opday11,opday12,opday13,opday14,opnum,optype,opremark,opname)values(@opday1,@opday2,@opday3,@opday4,@opday5,@opday6,@opday7,@opday8,@opday9,@opday10,@opday11,@opday12,@opday13,@opday14,@opnum,@optype,@opremark,@opname)";
     return(DBHelper.ExecuteNonQuery(GetSqlParameters(basic_order_planExample)));
 }
        /// <summary>
        /// 根据表,获取一个SqlParameter数组
        /// </summary>
        /// <returns>SqlParameter[]</returns>
        public static SqlParameter[] GetSqlParameters(basic_order_plan basic_order_planExample)
        {
            List <SqlParameter> list_param = new List <SqlParameter>();

            if (basic_order_planExample.opday1 != 0)
            {
                list_param.Add(new SqlParameter("@opday1", basic_order_planExample.opday1));
            }
            else
            {
                list_param.Add(new SqlParameter("@opday1", DBNull.Value));
            }
            if (basic_order_planExample.opday2 != 0)
            {
                list_param.Add(new SqlParameter("@opday2", basic_order_planExample.opday2));
            }
            else
            {
                list_param.Add(new SqlParameter("@opday2", DBNull.Value));
            }
            if (basic_order_planExample.opday3 != 0)
            {
                list_param.Add(new SqlParameter("@opday3", basic_order_planExample.opday3));
            }
            else
            {
                list_param.Add(new SqlParameter("@opday3", DBNull.Value));
            }
            if (basic_order_planExample.opday4 != 0)
            {
                list_param.Add(new SqlParameter("@opday4", basic_order_planExample.opday4));
            }
            else
            {
                list_param.Add(new SqlParameter("@opday4", DBNull.Value));
            }
            if (basic_order_planExample.opday5 != 0)
            {
                list_param.Add(new SqlParameter("@opday5", basic_order_planExample.opday5));
            }
            else
            {
                list_param.Add(new SqlParameter("@opday5", DBNull.Value));
            }
            if (basic_order_planExample.opday6 != 0)
            {
                list_param.Add(new SqlParameter("@opday6", basic_order_planExample.opday6));
            }
            else
            {
                list_param.Add(new SqlParameter("@opday6", DBNull.Value));
            }
            if (basic_order_planExample.opday7 != 0)
            {
                list_param.Add(new SqlParameter("@opday7", basic_order_planExample.opday7));
            }
            else
            {
                list_param.Add(new SqlParameter("@opday7", DBNull.Value));
            }
            if (basic_order_planExample.opday8 != 0)
            {
                list_param.Add(new SqlParameter("@opday8", basic_order_planExample.opday8));
            }
            else
            {
                list_param.Add(new SqlParameter("@opday8", DBNull.Value));
            }
            if (basic_order_planExample.opday9 != 0)
            {
                list_param.Add(new SqlParameter("@opday9", basic_order_planExample.opday9));
            }
            else
            {
                list_param.Add(new SqlParameter("@opday9", DBNull.Value));
            }
            if (basic_order_planExample.opday10 != 0)
            {
                list_param.Add(new SqlParameter("@opday10", basic_order_planExample.opday10));
            }
            else
            {
                list_param.Add(new SqlParameter("@opday10", DBNull.Value));
            }
            if (basic_order_planExample.opday11 != 0)
            {
                list_param.Add(new SqlParameter("@opday11", basic_order_planExample.opday11));
            }
            else
            {
                list_param.Add(new SqlParameter("@opday11", DBNull.Value));
            }
            if (basic_order_planExample.opday12 != 0)
            {
                list_param.Add(new SqlParameter("@opday12", basic_order_planExample.opday12));
            }
            else
            {
                list_param.Add(new SqlParameter("@opday12", DBNull.Value));
            }
            if (basic_order_planExample.opday13 != 0)
            {
                list_param.Add(new SqlParameter("@opday13", basic_order_planExample.opday13));
            }
            else
            {
                list_param.Add(new SqlParameter("@opday13", DBNull.Value));
            }
            if (basic_order_planExample.opday14 != 0)
            {
                list_param.Add(new SqlParameter("@opday14", basic_order_planExample.opday14));
            }
            else
            {
                list_param.Add(new SqlParameter("@opday14", DBNull.Value));
            }
            if (basic_order_planExample.opnum != 0)
            {
                list_param.Add(new SqlParameter("@opnum", basic_order_planExample.opnum));
            }
            else
            {
                list_param.Add(new SqlParameter("@opnum", DBNull.Value));
            }

            if (!string.IsNullOrEmpty(basic_order_planExample.optype))
            {
                list_param.Add(new SqlParameter("@optype", basic_order_planExample.optype));
            }
            else
            {
                list_param.Add(new SqlParameter("@optype", DBNull.Value));
            }

            if (!string.IsNullOrEmpty(basic_order_planExample.opremark))
            {
                list_param.Add(new SqlParameter("@opremark", basic_order_planExample.opremark));
            }
            else
            {
                list_param.Add(new SqlParameter("@opremark", DBNull.Value));
            }

            if (!string.IsNullOrEmpty(basic_order_planExample.opname))
            {
                list_param.Add(new SqlParameter("@opname", basic_order_planExample.opname));
            }
            else
            {
                list_param.Add(new SqlParameter("@opname", DBNull.Value));
            }
            SqlParameter[] param = new SqlParameter[list_param.Count];
            int            index = 0;

            foreach (SqlParameter p in list_param)
            {
                param[index] = p;
                index++;
            }
            return(param);
        }