public List <material> getIndexPageData()
        {
            List <material>      mList  = new List <material>();
            SelectCommandBuilder select = new SelectCommandBuilder("materials");

            select.SelectColumn("name");
            select.SelectColumn("sccj_id");
            select.SelectColumn("new_price");
            select.SelectColumn("wb_name");
            select.ConditionsColumn("1", 1);
            select.getSelectCommand();
            SqlDataReader dr = select.ExecuteReader();

            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    material m = new material()
                    {
                        name         = dr.IsDBNull(0) ? "NULL" : dr.GetString(0),
                        sccj         = dr.IsDBNull(1) ? "NULL" : getVendorById(dr.GetString(1)),
                        price        = dr.IsDBNull(2) ? 0.0 : dr.GetDouble(2),
                        currency     = dr.IsDBNull(3) ? "N" : dr.GetString(3),
                        exchangeRate = getexchangeRate(dr.IsDBNull(3) ? "N" : dr.GetString(3))
                    };
                    mList.Add(m);
                }
            }
            ViewState["DataTable_GridView_ReferedDataDetail"] = ListToDataaTable(mList);
            return(mList);
        }
        public void getData(string id)
        {
            SelectCommandBuilder s = new SelectCommandBuilder("m_materials");

            s.SelectColumn("id");
            s.SelectColumn("name");
            s.SelectColumn("spec");
            s.SelectColumn("sccj_id");
            s.SelectColumn("new_price");
            s.SelectColumn("wb_name");
            s.SelectColumn("lb1_id");
            s.SelectColumn("texture");
            s.SelectColumn("color");
            s.SelectColumn("dm");
            s.ConditionsColumn("id", id);
            s.getSelectCommand();
            DataTable dt = s.ExecuteDataTable();

            if (dt != null && dt.Rows.Count != 0)
            {
                txtName.Text            = dt.Rows[0]["name"].ToString().Trim();
                txtSpec.Text            = dt.Rows[0]["spec"].ToString().Trim();
                ddlVendor.SelectedIndex = getIndex(dt.Rows[0]["sccj_id"].ToString().Trim());
                txtPrie.Text            = dt.Rows[0]["new_price"].ToString() == string.Empty ? "0.00" : Convert.ToDouble(dt.Rows[0]["new_price"]).ToString("0.00#");
                txtmoneyType.Text       = dt.Rows[0]["wb_name"].ToString().Trim();
                txttype.Text            = dt.Rows[0]["lb1_id"].ToString().Trim();
                txtCz.Text       = dt.Rows[0]["texture"].ToString().Trim();
                txtColor.Text    = dt.Rows[0]["color"].ToString().Trim();
                txtShotName.Text = dt.Rows[0]["dm"].ToString().Trim();
            }
        }
        protected void txtMNo_TextChanged(object sender, EventArgs e)
        {
            SelectCommandBuilder s = new SelectCommandBuilder("materials");

            s.SelectColumn("texture");
            s.SelectColumn("spec");
            s.SelectColumn("color");
            s.ConditionsColumn("name", txtMNo.Text.Trim().ToUpper());
            s.getSelectCommand();
            DataTable td = s.ExecuteDataTable();

            if (td != null && td.Rows.Count != 0)
            {
                txtMName.Text        = td.Rows[0]["texture"].ToString();
                txtMModel.Text       = td.Rows[0]["spec"].ToString();
                txtMVenderColor.Text = td.Rows[0]["color"].ToString();
                txtWeight.Focus();
                btnAdd.Enabled = true;
            }
            else
            {
                ClientScript.RegisterClientScriptBlock(ClientScript.GetType(), "alert", "<script>alert('材料未建档'); history.back();</script>", false);
                txtMName.Focus();
            }
        }
Example #4
0
        protected DataTable getCustomers()
        {
            SelectCommandBuilder s = new SelectCommandBuilder("customer");

            s.SelectColumn("customer_id");
            s.SelectColumn("customer_aname");
            s.ConditionsColumn("1", "1");
            s.getSelectCommand();
            return(s.ExecuteDataTable());
        }
Example #5
0
        public DataTable getStockInput()
        {
            SelectCommandBuilder s = new SelectCommandBuilder("Goods_Up");

            s.SelectColumn("goods_name");
            s.SelectColumn("qty");
            s.SelectColumn("qty");
            s.ConditionsColumn("1", "1");
            s.getSelectCommand();
            return(s.ExecuteDataTable());
        }
Example #6
0
        protected void getCustomer(DropDownList ddl)
        {
            SelectCommandBuilder s = new SelectCommandBuilder(constr, "customer");

            s.SelectColumn("customer_id");
            s.SelectColumn("customer_name");
            s.ConditionsColumn("1", "1");
            s.getSelectCommand();
            DataTable d = s.ExecuteDataTable();

            for (int i = 0; i < d.Rows.Count; i++)
            {
                ddl.Items.Add(new ListItem(d.Rows[i]["customer_name"].ToString(), d.Rows[i]["customer_id"].ToString()));
            }
            ddl.DataTextField = "customer_aname";
        }
Example #7
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            string msg = inputValidate();

            if (msg != "")
            {
                Response.Write("<script>alert('" + msg + "')</script>");
                return;
            }
            SelectCommandBuilder select = new SelectCommandBuilder(constr, "goods_tmp");

            select.SelectColumn("Count(*)");
            select.ConditionsColumn("goods_name", goods_name.Value.Trim().ToUpper());
            select.getSelectCommand();
            int count = Convert.ToInt32(select.ExecuteScalar());

            if (count == 0)
            {
                Response.Write("<script>alert('部番不存在')</script>");
                return;
            }
            inputData indata = new inputData()
            {
                goods_name = goods_name.Value.Trim().ToUpper(),
                Qty        = int.Parse(qty.Value.Trim()),
                unit       = "pcs",
                goodsPost  = hwh.Value.Trim().ToUpper(),
                batch      = pch.Value.Trim().ToUpper()
            };

            insList.Add(indata);
            gvData.DataSource = insList;
            gvData.DataBind();
            clearText();
        }
Example #8
0
        public static string getNextId(string front_fix)
        {
            string Id = "";
            SelectCommandBuilder select = new SelectCommandBuilder("tmp_id");

            select.SelectColumn("str_bill_id");
            select.ConditionsColumn("1", 1);
            select.getSelectCommand();
            DataTable dt = select.ExecuteDataTable();

            if (dt == null || dt.Rows.Count == 0)
            {
                new InsertCommandBuilder().ExecuteNonQuery("insert into tmp_id values ('0')");
            }
            string currId = (dt != null && dt.Rows.Count != 0) ? dt.Rows[0][0].ToString() : "0";

            if (currId == "99999")
            {
                currId = "0";
            }
            int sNumber = int.Parse(currId);

            sNumber += 1;
            Id       = front_fix + DateTime.Now.ToString("yyyyMMdd") + sNumber.ToString();
            new UpdateCommandBuilder().ExecuteNonQuery("update tmp_id set str_bill_id = '" + sNumber.ToString() + "'");
            return(Id);
        }
        private List <m> getAllData(string con)
        {
            List <m>             mList = new List <m>();
            SelectCommandBuilder s     = new SelectCommandBuilder("m_materials");

            s.SelectColumn("id");
            s.SelectColumn("name");
            s.SelectColumn("spec");
            s.SelectColumn("sccj_id");
            s.SelectColumn("new_price");
            s.SelectColumn("wb_name");
            s.SelectColumn("lb1_id");
            s.SelectColumn("texture");
            s.SelectColumn("color");
            s.SelectColumn("dm");
            s.ConditionsColumn("1", 1);
            string sql = s.getSelectCommand();

            if (txtName.Value != string.Empty)
            {
                sql += " and name like '" + txtName.Value + "%'";
            }
            SqlDataReader dr = s.ExecuteReader(sql);

            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    m m = new m()
                    {
                        id  = dr.GetInt64(0),
                        mc  = dr.IsDBNull(1) ? "" : dr.GetString(1),
                        gg  = dr.IsDBNull(2) ? "" : dr.GetString(2),
                        gys = dr.IsDBNull(3) ? "" : dr.GetString(3),
                        dj  = dr.IsDBNull(4) ? "0.00" : dr.GetDouble(4).ToString("0.00#"),
                        bz  = dr.IsDBNull(5) ? "" : dr.GetString(5),
                        lx  = dr.IsDBNull(6) ? "" : dr.GetString(6),
                        cz  = dr.IsDBNull(7) ? "" : dr.GetString(7),
                        ys  = dr.IsDBNull(8) ? "" : dr.GetString(8),
                        jc  = dr.IsDBNull(9) ? "" : dr.GetString(9)
                    };
                    mList.Add(m);
                }
            }
            return(mList);
        }
Example #10
0
        protected List <string> getSQLList(GridView dgv)
        {
            int           index = 0;
            List <string> sList = new List <string>();

            try
            {
                InsertCommandBuilder insert = new InsertCommandBuilder(constr, "Goods_Up");
                for (int i = 0; i < dgv.Rows.Count; i++)
                {
                    string goods_name = dgv.Rows[i].Cells[0].Text.ToString().ToUpper();
                    index = i;
                    SelectCommandBuilder s = new SelectCommandBuilder(constr, "goods_tmp");
                    s.SelectColumn("Count(goods_id)");
                    s.ConditionsColumn("goods_name", goods_name.Trim());
                    s.getSelectCommand();
                    int count = Convert.ToInt32(s.ExecuteScalar());
                    if (count == 0)
                    {
                        sList.Add(InsertData(
                                      dgv.Rows[i].Cells[0].Text.ToString().ToUpper(),
                                      dgv.Rows[i].Cells[1].Text.ToString().ToUpper(),
                                      dgv.Rows[i].Cells[2].Text.ToString().ToUpper(),
                                      dgv.Rows[i].Cells[3].Text.ToString().ToUpper(),
                                      dgv.Rows[i].Cells[4].Text.ToString().ToUpper(),
                                      dgv.Rows[i].Cells[5].Text.ToString().ToUpper(),
                                      dgv.Rows[i].Cells[6].Text.ToString().ToUpper(),
                                      dgv.Rows[i].Cells[7].Text.ToString().ToUpper(),
                                      dgv.Rows[i].Cells[8].Text.ToString().ToUpper(),
                                      dgv.Rows[i].Cells[9].Text.ToString().ToUpper(),
                                      dgv.Rows[i].Cells[10].Text.ToString().ToUpper(),
                                      dgv.Rows[i].Cells[11].Text.ToString().ToUpper(),
                                      dgv.Rows[i].Cells[12].Text.ToString().ToUpper(),
                                      dgv.Rows[i].Cells[13].Text.ToString().ToUpper(),
                                      dgv.Rows[i].Cells[14].Text.ToString().ToUpper(),
                                      dgv.Rows[i].Cells[15].Text.ToString().ToUpper(),
                                      dgv.Rows[i].Cells[16].Text.ToString().ToUpper(),
                                      dgv.Rows[i].Cells[17].Text.ToString().ToUpper(),
                                      dgv.Rows[i].Cells[18].Text.ToString().ToUpper(),
                                      dgv.Rows[i].Cells[19].Text.ToString().ToUpper(),
                                      dgv.Rows[i].Cells[20].Text.ToString().ToUpper(),
                                      dgv.Rows[i].Cells[21].Text.ToString().ToUpper().IndexOf('%') != -1 ? (Convert.ToDecimal(dgv.Rows[i].Cells[21].Text.ToString().ToUpper().Split('%')[0]) / 100).ToString() : (Convert.ToDecimal(dgv.Rows[i].Cells[21].Text.ToString().ToUpper()) / 100).ToString(),
                                      dgv.Rows[i].Cells[22].Text.ToString().ToUpper(),
                                      dgv.Rows[i].Cells[23].Text.ToString().ToUpper(),
                                      dgv.Rows[i].Cells[24].Text.ToString().ToUpper(),
                                      dgv.Rows[i].Cells[25].Text.ToString().ToUpper(),
                                      ddlCustomer.SelectedItem.Value
                                      ));
                    }
                }
            }
            catch (Exception ex)
            {
                Response.Write("<script>alert('系统出现以下错误:" + ex.Message + "!')</script>");
                gvExcel.Rows[index].BackColor = System.Drawing.Color.Red;
            }
            return(sList);
        }
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            string msg = inputValidate();

            if (msg != "")
            {
                Response.Write("<script>alert('" + msg + "')</script>");
                return;
            }
            SelectCommandBuilder select = new SelectCommandBuilder(constr, "goods_tmp");

            select.SelectColumn("goods_id");
            select.ConditionsColumn("goods_name", txtGoodsName.Text.Trim().ToUpper());
            select.getSelectCommand();
            DataTable dt       = select.ExecuteDataTable();
            string    goods_id = "";

            if (dt == null || dt.Rows.Count == 0)
            {
                Response.Write("<script>alert('部番不存在')</script>");
                return;
            }
            else
            {
                goods_id = dt.Rows[0][0].ToString();
            }
            string    sql = "SELECT sum( stock_remain.qty) as qty  FROM batch INNER JOIN stock_remain ON batch.batch_id = stock_remain.batch_id where (batch.hwh = '" + hwh.Value.Trim().ToUpper() + "') AND (stock_remain.goods_id = '" + goods_id + "') group by  stock_remain.goods_id,batch.hwh";
            DataTable ddt = new SelectCommandBuilder(constr, "").ExecuteDataTable(sql);

            if (ddt == null || ddt.Rows.Count == 0)
            {
                Response.Write("<script>alert('仓位错误')</script>");
                hwh.Focus();
                return;
            }
            else
            {
                if (Convert.ToInt32(qty.Value) > Convert.ToInt32(ddt.Rows[0]["qty"]))
                {
                    Response.Write("<script>alert('仓位数量不足')</script>");
                    qty.Focus();
                    return;
                }
            }
            inputData indata = new inputData()
            {
                goods_name = txtGoodsName.Text.Trim().ToUpper(),
                Qty        = int.Parse(qty.Value.Trim()),
                unit       = "pcs",
                goodsPost  = hwh.Value.Trim().ToUpper(),
            };

            insList.Add(indata);
            gvData.DataSource = insList;
            gvData.DataBind();
            clearText();
        }
Example #12
0
        private void BindCustomer()
        {
            SelectCommandBuilder s = new SelectCommandBuilder(constr, "customer");

            s.SelectColumn("customer_id");
            s.SelectColumn("customer_aname");
            s.ConditionsColumn("1", "1");
            s.getSelectCommand();
            DataTable d = s.ExecuteDataTable();

            ddlCustomer.Items.Clear();
            ddlCustomer.Items.Add(new ListItem("请选择", "0"));
            for (int i = 0; i < d.Rows.Count; i++)
            {
                ddlCustomer.Items.Add(new ListItem(d.Rows[i]["customer_aname"].ToString(), d.Rows[i]["customer_id"].ToString()));
            }
            ddlCustomer.DataTextField = "customer_aname";
        }
Example #13
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         string name            = Request.QueryString["name"];
         SelectCommandBuilder s = new SelectCommandBuilder("materials_newest_price");
         s.SelectColumn("name as '部番'");
         s.SelectColumn("price as '价格'");
         s.SelectColumn("wb_name as '币种'");
         s.SelectColumn("exchange_rate as '汇率'");
         s.SelectColumn("CONVERT(varchar(100),update_date,20) as '更改日期'");
         s.ConditionsColumn("name", name);
         s.OrderColumn("update_date");
         s.getSelectCommand(OrderType.desc);
         dgvDataDetail.DataSource = s.ExecuteDataTable();
         dgvDataDetail.DataBind();
     }
 }
Example #14
0
        public DateTime getDate(string Pid, string khdm)
        {
            SelectCommandBuilder s = new SelectCommandBuilder("goods_up");

            s.SelectColumn("delivery_date");
            s.ConditionsColumn("khdm", khdm);
            s.ConditionsColumn("Prepare_goods_Id", Pid);
            s.getSelectCommand();
            return(Convert.ToDateTime(s.ExecuteDataTable().Rows[0][0].ToString()));
        }
Example #15
0
        protected bool CheckLogin(string UserName, string PassWord)
        {
            bool result = false;
            SelectCommandBuilder select = new SelectCommandBuilder("UserInfo");

            select.SelectColumn("password");
            select.SelectColumn("PassWordKey");
            select.ConditionsColumn("operator_name", UserName);
            select.getSelectCommand();
            DataTable dt        = select.ExecuteDataTable();
            string    _passWord = dt.Rows[0]["password"].ToString().Trim();
            string    _key      = dt.Rows[0]["PassWordKey"].ToString().Trim();

            if (PassWord == ClassDES.Decrypt(_passWord, _key))
            {
                result = true;
            }
            return(result);
        }
Example #16
0
        public static int getCurrentId()
        {
            SelectCommandBuilder select = new SelectCommandBuilder("tmp_id");

            select.SelectColumn("str_bill_id");
            select.ConditionsColumn("1", 1);
            select.getSelectCommand();
            int currId = int.Parse(select.ExecuteDataTable().Rows[0][0].ToString());

            return(currId);
        }
        public bool getUser(string UserId)
        {
            SelectCommandBuilder select = new SelectCommandBuilder(ConnectionFactory.ConnectionString_hudsonwwwroot, "HUDSON_User");

            select.SelectColumn("Count(*)");
            select.ConditionsColumn("UserId", UserId);
            select.getSelectCommand();
            bool flag = Convert.ToInt32(select.ExecuteScalar()) != 0 ? true : false;

            return(flag);
        }
        public List <material> getIndexPageData(string name, string sccj)
        {
            List <material>      mList  = new List <material>();
            SelectCommandBuilder select = new SelectCommandBuilder("materials");

            select.SelectColumn("name");
            select.SelectColumn("sccj_id");
            select.SelectColumn("new_price");
            select.SelectColumn("wb_name");
            select.ConditionsColumn("1", 1);
            string sql = select.getSelectCommand();

            if (!string.IsNullOrEmpty(name))
            {
                sql += "and name like '%" + name + "%'";
            }
            if (!string.IsNullOrEmpty(sccj))
            {
                select.ConditionsColumn("sccj_id", sccj);
                sql += "and sccj_id = '" + sccj + "'";
            }
            SqlDataReader dr = select.ExecuteReader(sql);

            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    material m = new material()
                    {
                        name         = dr.GetString(0),
                        sccj         = getVendorById(dr.GetString(1)),
                        price        = dr.IsDBNull(2) ? 0.00 : dr.GetDouble(2),
                        currency     = dr.IsDBNull(3) ? "RMB" : dr.GetString(3),
                        exchangeRate = getexchangeRate(dr.IsDBNull(3) ? "RMB" : dr.GetString(3))
                    };
                    mList.Add(m);
                }
            }
            ViewState["DataTable_GridView_ReferedDataDetail"] = ListToDataaTable(mList);
            return(mList);
        }
Example #19
0
        protected void bindEquip()
        {
            SelectCommandBuilder s = new SelectCommandBuilder(constr, "Equip");

            s.SelectColumn("Equip_no");
            s.SelectColumn("Equip_name");
            s.ConditionsColumn("1", "1");
            s.getSelectCommand();
            DataTable d = s.ExecuteDataTable();

            ddlMachine.Items.Clear();
            ddlMachine.Items.Add(new ListItem("请选择", "0"));
            for (int i = 0; i < d.Rows.Count; i++)
            {
                if (!string.IsNullOrEmpty(d.Rows[i]["Equip_name"].ToString().Trim()))
                {
                    ddlMachine.Items.Add(new ListItem(d.Rows[i]["Equip_name"].ToString().Trim(), d.Rows[i]["Equip_no"].ToString().Trim()));
                }
            }
            ddlMachine.DataTextField = "Equip_name";
        }
Example #20
0
        protected void getType()
        {
            SelectCommandBuilder s = new SelectCommandBuilder("Mode_type");

            s.SelectColumn("Mode_type_id");
            s.SelectColumn("Mode_type_name");
            s.ConditionsColumn("1", "1");
            s.getSelectCommand();
            DataTable d = s.ExecuteDataTable();

            ddlMode_Type.Items.Clear();
            ddlMode_Type.Items.Add(new ListItem("请选择", "0"));
            for (int i = 0; i < d.Rows.Count; i++)
            {
                if (!string.IsNullOrEmpty(d.Rows[i]["Mode_type_name"].ToString().Trim()))
                {
                    ddlMode_Type.Items.Add(new ListItem(d.Rows[i]["Mode_type_name"].ToString().Trim(), d.Rows[i]["Mode_type_id"].ToString().Trim()));
                }
            }
            ddlMode_Type.DataTextField = "Mode_type_name";
        }
Example #21
0
        protected string getOperatoName(string operator_Id)
        {
            string name = "";

            if (!string.IsNullOrEmpty(operator_Id))
            {
                SelectCommandBuilder s = new SelectCommandBuilder("operator");
                s.SelectColumn("operator_name");
                s.ConditionsColumn("operator_id", operator_Id);
                s.getSelectCommand();
                name = s.ExecuteDataTable().Rows[0]["operator_name"].ToString();
            }
            return(name);
        }
Example #22
0
        protected void txtMColor_TextChanged(object sender, EventArgs e)
        {
            SelectCommandBuilder s = new SelectCommandBuilder(constr, "materials");

            s.SelectColumn("texture");
            s.SelectColumn("spec");
            s.SelectColumn("color");
            s.ConditionsColumn("name", txtMNo.Text.Trim().ToUpper());
            s.getSelectCommand();
            DataTable td = s.ExecuteDataTable();

            if (td != null && td.Rows.Count != 0)
            {
                txtMName.Text        = td.Rows[0]["texture"].ToString();
                txtMModel.Text       = td.Rows[0]["spec"].ToString();
                txtMVenderColor.Text = td.Rows[0]["color"].ToString();
                txtWeight.Focus();
            }
            else
            {
                txtMName.Focus();
            }
        }
        public string getVendorById(string vendor_id)
        {
            string venderName      = "NULL";
            SelectCommandBuilder s = new SelectCommandBuilder("vendor");

            s.SelectColumn("vendor_name");
            s.ConditionsColumn("vendor_id", vendor_id);
            s.getSelectCommand();
            DataTable dt = s.ExecuteDataTable();

            if (dt != null && dt.Rows.Count != 0)
            {
                venderName = dt.Rows[0]["vendor_name"].ToString();
            }
            return(venderName);
        }
        public double getexchangeRate(string currency)
        {
            SelectCommandBuilder s = new SelectCommandBuilder("prd_dictate_wb");
            double exchangeRate    = 0.00;

            s.SelectColumn("wb_hl");
            s.ConditionsColumn("wb_name", currency);
            s.getSelectCommand();
            DataTable dt = s.ExecuteDataTable();

            if (dt != null && dt.Rows.Count != 0)
            {
                exchangeRate = Convert.ToDouble(dt.Rows[0]["wb_hl"]);
            }
            return(exchangeRate);
        }
        public List <string> getCurrency()
        {
            List <string>        sList = new List <string>();
            SelectCommandBuilder s     = new SelectCommandBuilder("prd_dictate_wb");

            s.SelectColumn("wb_name");
            s.ConditionsColumn("1", 1);
            s.getSelectCommand();
            DataTable d = s.ExecuteDataTable();

            for (int i = 0; i < d.Rows.Count; i++)
            {
                sList.Add(d.Rows[i][0].ToString());
            }
            return(sList);
        }
Example #26
0
        public bool checkIsUpload(string goods_name, string prapareId)
        {
            bool flag = false;
            SelectCommandBuilder s = new SelectCommandBuilder("Goods_Up");

            s.SelectColumn("count(goods_name)");
            s.ConditionsColumn("Prepare_goods_Id", prapareId);
            s.ConditionsColumn("goods_name", goods_name);
            s.getSelectCommand();
            int count = Convert.ToInt32(s.ExecuteScalar());

            if (count != 0)
            {
                flag = true;
            }
            return(flag);
        }
        public void getPerson()
        {
            SelectCommandBuilder s = new SelectCommandBuilder(ConnectionFactory.ConnectionString_hudsonwwwroot, "HUDSON_User");

            s.SelectColumn("UserName");
            s.ConditionsColumn("user_l", "19");
            s.getSelectCommand();
            DataTable dt = s.ExecuteDataTable();

            cblPerson.Items.Clear();
            if (dt != null && dt.Rows.Count != 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    cblPerson.Items.Add(new ListItem(dt.Rows[i]["UserName"].ToString()));
                }
            }
        }
Example #28
0
        protected bool checkCustomer(string goods_name)
        {
            bool flag = false;
            SelectCommandBuilder s = new SelectCommandBuilder("goods");

            s.SelectColumn("khdm");
            s.ConditionsColumn("goods_name", goods_name);
            s.getSelectCommand();
            DataTable d = s.ExecuteDataTable();

            if (d != null && d.Rows.Count != 0)
            {
                if (d.Rows[0][0].ToString() == ddlCustomers.SelectedItem.Value.Trim())
                {
                    flag = true;
                }
            }
            return(flag);
        }
Example #29
0
 protected void btnAdd_Click(object sender, EventArgs e)
 {
     try
     {
         if (string.IsNullOrEmpty(txtgoodsName.Text.Trim()))
         {
             Response.Write("<script>alert('请输入部番!')</script>");
             return;
         }
         SelectCommandBuilder s = new SelectCommandBuilder(constr, "goods_tmp");
         s.SelectColumn("Count(goods_name)");
         s.ConditionsColumn("goods_name", txtgoodsName.Text.Trim());
         if (txtVersion.Text != string.Empty)
         {
             s.ConditionsColumn("Version", txtVersion.Text.Trim());
         }
         s.getSelectCommand();
         int i     = Convert.ToInt32(s.ExecuteScalar());
         int count = 0;
         if (i == 0)
         {
             count = InsertData();
         }
         else
         {
             count = UpdateData();
         }
         if (count != 0)
         {
             ClearTextBox();
             btnAdd.Enabled = false;
         }
         else
         {
             Response.Write("<script>alert('添加失败!')</script>");
         }
     }
     catch (Exception ex)
     {
         Response.Write("<script>alert('" + ex.Message + "!')</script>");
     }
 }
Example #30
0
        public static string getNextId(string front_fix, string end_fix, int count)
        {
            string Id = "";
            SelectCommandBuilder select = new SelectCommandBuilder("tmp_id");

            select.SelectColumn("str_bill_id");
            select.ConditionsColumn("1", 1);
            select.getSelectCommand();
            string currId = select.ExecuteDataTable().Rows[0][0].ToString();

            currId = currId == "" ? "0" : currId;
            if (currId == "999999")
            {
                currId = "0";
            }
            int sNumber = int.Parse(currId);

            sNumber += 1;
            Id       = front_fix + sNumber.ToString().PadLeft(6, '0') + end_fix;
            new UpdateCommandBuilder().ExecuteNonQuery("update tmp_id set str_bill_id = '" + sNumber.ToString() + "'");
            return(Id);
        }