コード例 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string[] produceArea = new string[] { projectBad, returnBad };
                DropDownListArea.DataSource = produceArea;
                DropDownListArea.DataBind();


                Debug.WriteLine(sql);
                DataTable dt = new SelectCommandBuilder().ExecuteDataTable(sql);
                GridView1.DataSource = dt;
                GridView1.DataBind();

                string     sqltableSign = @"select  distinct top 10 tableSign  from shatter_Parts
                                where tableSign is not null 
                                and(inputArea = 1) order by tableSign desc ";
                DataTable  dtSign       = new SelectCommandBuilder().ExecuteDataTable(sqltableSign);
                DataColumn sign         = new DataColumn();
                sign.ColumnName = "Sign";
                sign.DataType   = System.Type.GetType("System.String");
                dtSign.Columns.Add(sign);
                var i = 1;
                foreach (DataRow dr in dtSign.Rows)
                {
                    dr["Sign"] = string.Format("{0}", i++);
                }
                DropDownListIndex.DataSource     = dtSign;
                DropDownListIndex.DataValueField = "tableSign";
                DropDownListIndex.DataTextField  = "Sign";
                DropDownListIndex.DataBind();
            }
        }
コード例 #2
0
        //打印查询
        protected void ButtonprintQuery_Click(object sender, EventArgs e)
        {
            string inputArea1   = "inputArea = 2";
            string inputArea2   = " inputArea = 1";
            string produceField = DropDownListArea.SelectedValue;
            string tableSign    = DropDownListIndex.SelectedValue;

            if (produceField.Equals(returnBad))
            {
                sqlquery += @" and(" + inputArea1 + ")";

                sqlquery += " and tableSign = '" + tableSign + "'";

                Debug.WriteLine(sqlquery);
                DataTable dt = new SelectCommandBuilder().ExecuteDataTable(sqlquery);
                GridView1.DataSource = dt;
                GridView1.DataBind();
            }
            else
            {
                sqlquery += @"and (" + inputArea2 + ")";
                sqlquery += " and tableSign = '" + tableSign + "'";

                Debug.WriteLine(sqlquery);
                DataTable dt = new SelectCommandBuilder().ExecuteDataTable(sqlquery);
                GridView1.DataSource = dt;
                GridView1.DataBind();
            }
        }
コード例 #3
0
        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();
            }
        }
コード例 #4
0
        public string getCustomerName(string c_id)
        {
            string sql             = "select Customer_name from customer where customer_id='" + c_id + "'";
            SelectCommandBuilder s = new SelectCommandBuilder();

            return(s.ExecuteDataTable(sql).Rows[0][0].ToString());
        }
コード例 #5
0
        public DataTable getData()
        {
            string    sql = "SELECT (SELECT s." + Resources.Resource.store + " FROM store s  WHERE a.store_id = s.store_id) AS '" + Resources.Resource.clck + "', prd_pk_id  as '" + Resources.Resource.pddh + "', prd_pk_date as '" + Resources.Resource.pdrq + "','" + Resources.Resource.czry + "'=(select operator_name from operator o where o.operator_id =a.operator_id),remark as '" + Resources.Resource.bz + "' FROM pre_prd_pk a ";
            DataTable dt  = new SelectCommandBuilder().ExecuteDataTable(sql);

            return(dt);
        }
コード例 #6
0
ファイル: getMode.ashx.cs プロジェクト: justhyx/ERPNET.1.199
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string keyword = context.Request.QueryString["keyword"];

            if (keyword != null)
            {
                string sql             = "SELECT DISTINCT TOP 5 mode FROM Mold_management_accounting WHERE (mode LIKE '" + keyword + "%')";
                SelectCommandBuilder s = new SelectCommandBuilder();
                DataTable            d = s.ExecuteDataTable(sql);
                string jsonString      = "";
                if (d != null && d.Rows.Count != 0)
                {
                    jsonString += "[";
                    for (int i = 0; i < d.Rows.Count; i++)
                    {
                        if (i != d.Rows.Count - 1)
                        {
                            jsonString += '"' + d.Rows[i][0].ToString().Trim() + '"' + ",";
                        }
                        else
                        {
                            jsonString += '"' + d.Rows[i][0].ToString().Trim() + '"' + "]";
                        }
                    }
                }
                context.Response.Write(jsonString);
            }
        }
コード例 #7
0
        public void print(string label, string goodsName, int Qty, string userId)
        {
            InsertData(label, goodsName, Qty, 3, userId);
            SelectCommandBuilder s = new SelectCommandBuilder();
            int    count           = Convert.ToInt32(s.ExecuteScalar("select count(*) from Material_control_process where label = '" + label + "' and process_id = 3"));
            string sql             = string.Empty;

            if (count != 0)
            {
                sql = "update Material_control_process set OutQty = InQty + " + Qty + " ,CurrQty = CurrQty + " + Qty + " where label = '" + label + "' and process_id = 3 ";
            }
            else
            {
                InsertCommandBuilder ins = new InsertCommandBuilder("Material_control_process");
                ins.InsertColumn("label", label);
                ins.InsertColumn("goods_name", goodsName);
                ins.InsertColumn("process_id", 3);
                ins.InsertColumn("InQty", Qty);
                ins.InsertColumn("OutQty", 0);
                ins.InsertColumn("CurrQty", Qty);
                ins.InsertColumn("in_date", "getDate()");
                sql = ins.getInsertCommand();
            }
            string        sql1 = "update Material_control_process set OutQty = OutQty + " + Qty + " ,CurrQty = CurrQty - " + Qty + " where label = '" + label + "' and process_id = 1 ";
            List <string> list = new List <string>();

            list.Add(sql);
            list.Add(sql1);
            new InsertCommandBuilder().ExcutTransaction(list);
        }
コード例 #8
0
        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);
        }
コード例 #9
0
        public void waitStorge(string label, string goodsName, int Qty, string userId)
        {
            InsertData(label, goodsName, Qty, 1, userId);
            SelectCommandBuilder s = new SelectCommandBuilder();
            int    count           = Convert.ToInt32(s.ExecuteScalar("select count(*) from Material_control_process where label = '" + label + "' and process_id = 1"));
            string sql             = string.Empty;

            if (count != 0)
            {
                UpdateCommandBuilder up = new UpdateCommandBuilder();
                sql = "update Material_control_process set InQty = InQty + " + Qty + " ,CurrQty = CurrQty + " + Qty + " where label = '" + label + "' and process_id = 1";
            }
            else
            {
                InsertCommandBuilder ins = new InsertCommandBuilder("Material_control_process");
                ins.InsertColumn("label", label);
                ins.InsertColumn("goods_name", goodsName);
                ins.InsertColumn("process_id", 1);
                ins.InsertColumn("InQty", Qty);
                ins.InsertColumn("OutQty", 0);
                ins.InsertColumn("CurrQty", Qty);
                ins.InsertColumn("in_date", "getDate()");
                sql = ins.getInsertCommand();
            }
            new InsertCommandBuilder().ExecuteNonQuery(sql);
        }
コード例 #10
0
        public List <Vendor> getAllVendor(string VendorName)
        {
            List <Vendor> vList = new List <Vendor>();
            string        sql   = "select vendor_id,vendor_name ,vendor_aname from Vendor where CheckFirst = 'Y'";

            if (!string.IsNullOrEmpty(VendorName))
            {
                sql += " and vendor_name like '%" + VendorName + "%'";
            }
            SelectCommandBuilder select = new SelectCommandBuilder();
            SqlDataReader        reader = select.ExecuteReader(sql);

            if (reader.HasRows)
            {
                while (reader.Read())
                {
                    Vendor v = new Vendor()
                    {
                        VendorID = reader.GetString(0), VenderName = reader.GetString(1), VenderShortName = reader.IsDBNull(2) ? "null" : reader.GetString(2)
                    };
                    vList.Add(v);
                }
            }
            return(vList);
        }
コード例 #11
0
        public List <CrushedMaterial> getAllCrushedMaterial()
        {
            List <CrushedMaterial> cList = new List <CrushedMaterial>();
            SelectCommandBuilder   s     = new SelectCommandBuilder(ConnectionFactory.ConnectionString_hudsonwwwroot, "trymolde");
            string        sql            = "SELECT id, 品番, 材料, 材料编号, 模具担当, addtime, PO处理 FROM trymolde WHERE (PO处理 = '粉碎') AND(isApprove is null) ORDER BY addtime";
            SqlDataReader dr             = s.ExecuteReader(sql);

            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    CrushedMaterial c = new CrushedMaterial()
                    {
                        id         = dr.GetInt32(0),
                        Name       = dr.GetString(1),
                        Material   = dr.GetString(2),
                        MaterialNo = dr.GetString(3),
                        JigLeader  = dr.GetString(4),
                        addtime    = dr.GetString(5)
                    };
                    cList.Add(c);
                }
            }
            return(cList);
        }
コード例 #12
0
        protected string getUserMailAddress(string userName)
        {
            string mail = "";

            string[]             nameList = userName.Split(';');
            SelectCommandBuilder s        = new SelectCommandBuilder(ConnectionFactory.ConnectionString_hudsonwwwroot, "trymolde");
            string sql = "SELECT email FROM HUDSON_User";

            for (int i = 0; i < nameList.Length; i++)
            {
                if (i == 0)
                {
                    sql += " Where UserName = '******'";
                }
                else
                {
                    sql += " or UserName = '******'";
                }
            }
            DataTable dt = s.ExecuteDataTable(sql);

            if (dt != null && dt.Rows.Count != 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    if (!string.IsNullOrEmpty(dt.Rows[i]["email"].ToString()))
                    {
                        mail += dt.Rows[i]["email"].ToString() + ";";
                    }
                }
            }
            return(mail);
        }
コード例 #13
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);
        }
コード例 #14
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();
        }
コード例 #15
0
    public void Can_Build_SelectCommand_From_SelectCommandBuilder_With_Or_Clause()
    {
        // Arrange
        var command = new SelectCommandBuilder();

        // Act
        var actual = command
                     .From("Table")
                     .Select("Field1", "Field2")
                     .Where("Field1 = @field1")
                     .Or("Field2 IS NOT NULL")
                     .AppendParameter("field1", "some value")
                     .Build();

        // Assert
        actual.CommandText.Should().Be("SELECT Field1, Field2 FROM Table WHERE Field1 = @field1 OR Field2 IS NOT NULL");
        actual.CommandParameters.Should().BeAssignableTo <IDictionary <string, object> >();
        var parameters = actual.CommandParameters as IDictionary <string, object>;

        if (parameters != null)
        {
            parameters.Should().HaveCount(1);
            parameters.First().Key.Should().Be("field1");
            parameters.First().Value.Should().Be("some value");
        }
    }
コード例 #16
0
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            string sql = @"SELECT DISTINCT a.Bill_Id, a.Bill_no, a.Pk_id, ISNULL
                                      ((SELECT " + Resources.Resource.store + @"
                                      FROM store
                                      WHERE store_id = a.store_id), a.store_id) AS store_id, 
                                  pre_pk.pk_date AS pk_date, ISNULL
                                      ((SELECT operator_name
                                      FROM operator
                                      WHERE operator_id = a.Crt_emp), a.Crt_emp) AS Crt_emp, a.Crt_Date, a.Remark, 
                                 Status= (case when a.status ='Y' then 'true' else 'false' end) 
                            FROM tmp_pk_bill a INNER JOIN
                                  pre_pk ON a.Pk_id = pre_pk.pk_id INNER JOIN
                                  tmp_pk_detail b ON a.Bill_Id = b.Bill_id WHERE a.status <> 'A'";

            if (!string.IsNullOrEmpty(txtStartDate.Text))
            {
                sql += " WHERE (CONVERT(varchar(100),pre_pk.pk_date, 23) = '" + txtStartDate.Text + @"')";
            }
            SelectCommandBuilder s = new SelectCommandBuilder();

            gvData.DataSource = s.ExecuteDataTable(sql);
            gvData.DataBind();
            if (gvData.Rows.Count != 0)
            {
                gvData.SelectedIndex = 0;
                gvData_SelectedIndexChanged(sender, e);
            }
            gvDetailData.DataSource = null;
            gvDetailData.DataBind();
        }
コード例 #17
0
        protected void btnFind_Click(object sender, EventArgs e)
        {
            dgv.Disabled = false;
            SelectCommandBuilder select = new SelectCommandBuilder();
            string sql = "SELECT name, spec, texture FROM m_materials";

            if (txtM_name.Text != string.Empty)
            {
                sql += " where name like '" + txtM_name.Text.Trim() + "%'";
            }
            SqlDataReader       dr      = select.ExecuteReader(sql);
            List <AddGoodsInfo> addinfo = new List <AddGoodsInfo>();

            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    AddGoodsInfo info = new AddGoodsInfo()
                    {
                        name = dr.GetString(0),
                        spec = dr.IsDBNull(1) ? "" : dr.GetString(1),
                        cz   = dr.IsDBNull(2) ? "" : dr.GetString(2)
                    };
                    addinfo.Add(info);
                }
            }
            gvShowData.DataSource = addinfo;
            gvShowData.DataBind();
        }
コード例 #18
0
        public List <inputData> getConfirmData(string str_id)
        {
            List <inputData> insList = new List <inputData>();
            string           sql     = @"SELECT goods_tmp.goods_name, pre_str_out_bill_detail.qty, pre_str_out_bill_detail.hwh
                            FROM pre_str_out_bill_detail INNER JOIN
                                  goods_tmp ON pre_str_out_bill_detail.goods_id = goods_tmp.goods_id INNER JOIN
                                  pre_str_out_bill ON 
                                  pre_str_out_bill_detail.str_out_bill_id = pre_str_out_bill.str_out_bill_id
                            WHERE (pre_str_out_bill.str_out_bill_id = '" + str_id + "')";
            DataTable        dt      = new SelectCommandBuilder(constr, "").ExecuteDataTable(sql);

            if (dt != null && dt.Rows.Count != 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    inputData indata = new inputData()
                    {
                        goods_name = dt.Rows[i]["goods_name"].ToString(),
                        Qty        = Convert.ToInt32(dt.Rows[i]["qty"]),
                        goodsPost  = dt.Rows[i]["hwh"].ToString()
                    };
                    insList.Add(indata);
                }
            }
            return(insList);
        }
コード例 #19
0
        protected void btnQuery_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtStartDate.Text))
            {
                Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "Alert", "<script>alert('请输入开始日期')</script>");
                return;
            }
            if (string.IsNullOrEmpty(txtEndDate.Text))
            {
                Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "Alert", "<script>alert('请输入结束日期')</script>");
                return;
            }
            string startDate            = Convert.ToDateTime(txtStartDate.Text).ToString("yyyyMMdd");
            string endDate              = Convert.ToDateTime(txtEndDate.Text).ToString("yyyyMMdd");
            SelectCommandBuilder select = new SelectCommandBuilder();

            SqlParameter[] parm = new SqlParameter[]
            {
                new SqlParameter("@BeginDate", startDate),
                new SqlParameter("@EndDate", endDate)
            };
            DataSet ds = SqlHelper.ExecuteDataset(constr, CommandType.StoredProcedure, "goods_itos", parm);

            gvShowData.DataSource = ds.Tables[0];
            gvShowData.DataBind();
            if (ds.Tables.Count != 0)
            {
                myTable = ds.Tables[0];
            }
        }
コード例 #20
0
        protected void btnReCon_Click(object sender, EventArgs e)
        {
            if (gvData.SelectedIndex == -1)
            {
                Response.Write("<script>alert('" + Resources.Resource.alterwxz + "!')</script>");
                return;
            }
            if (!((CheckBox)gvData.SelectedRow.Cells[8].Controls[0]).Checked)
            {
                Response.Write("<script>alert('" + Resources.Resource.alterReConfrim + "!')</script>");
                return;
            }
            SelectCommandBuilder s = new SelectCommandBuilder("pre_pk_Detail");
            //s.SelectColumn("Count(*)");
            //s.ConditionsColumn("Batch_id", lList[i].pch);
            //s.getSelectCommand();
            //int ct = Convert.ToInt32(s.ExecuteScalar());
            string sql = "update tmp_pk_bill set status ='N' where bill_id ='" + ViewState["billId"].ToString() + "' ";
            int    i   = new UpdateCommandBuilder().ExecuteNonQuery(sql);

            if (i != 0)
            {
                Response.Write("<script>alert('" + Resources.Resource.alterOk + "!')</script>");
                btnSearch_Click(sender, e);
            }
        }
コード例 #21
0
        public List <CrushedMaterialDetail> getAllCrushedMaterial(string area, string status)
        {
            List <CrushedMaterialDetail> cList = new List <CrushedMaterialDetail>();
            SelectCommandBuilder         s     = new SelectCommandBuilder(ConnectionFactory.ConnectionString_hudsonwwwroot, "trymolde");
            string        sql = "SELECT id, 品番, 材料, 材料编号, 模具担当, addtime, area1style, area2style, area3style, area4style FROM trymolde WHERE (PO处理 = '粉碎') AND (isApprove = 'OK') AND (area" + area + "style = '" + status + "') ORDER BY addtime";
            SqlDataReader dr  = s.ExecuteReader(sql);

            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    CrushedMaterialDetail c = new CrushedMaterialDetail()
                    {
                        id         = dr.GetInt32(0),
                        Name       = dr.GetString(1),
                        Material   = dr.GetString(2),
                        MaterialNo = dr.GetString(3),
                        JigLeader  = dr.GetString(4),
                        addtime    = dr.GetString(5),
                        area1style = dr.IsDBNull(6) ? "待粉碎" : getStatusdeng(dr.GetString(6)),
                        area2style = dr.IsDBNull(7) ? "待粉碎" : getStatusdeng(dr.GetString(7)),
                        area3style = dr.IsDBNull(8) ? "待粉碎" : getStatusdeng(dr.GetString(8)),
                        area4style = dr.IsDBNull(9) ? "待粉碎" : getStatusdeng(dr.GetString(9))
                    };
                    cList.Add(c);
                }
            }
            return(cList);
        }
コード例 #22
0
        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();
            }
        }
コード例 #23
0
        public DataTable getData(string store)
        {
            string    sql = "SELECT DISTINCT(SELECT s." + Resources.Resource.store + " FROM store s  WHERE a.store_id = s.store_id) AS '" + Resources.Resource.clck + @"', a.pk_id as '" + Resources.Resource.pddh + @"', CONVERT(varchar(100), a.pk_date, 20) as '" + Resources.Resource.pdrq + @"','" + Resources.Resource.czry + @"'=(select operator_name from operator o where o.operator_id =a.operator_id),a.remark as '" + Resources.Resource.bz + @"' FROM pre_pk a join tmp_pk_bill b on a.pk_id=b.pk_id where a.store_id='" + store + "' and b.status = 'Y'";
            DataTable dt  = new SelectCommandBuilder().ExecuteDataTable(sql);

            return(dt);
        }
コード例 #24
0
        public static SelectCommandBuilder Select(this IDataContext context, string table)
        {
            var builder = new SelectCommandBuilder(context);

            builder.From(table);

            return(builder);
        }
コード例 #25
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);
        }
コード例 #26
0
        protected void ddlMaterialStock_SelectedIndexChanged(object sender, EventArgs e)
        {
            string    sql = "SELECT (SELECT s." + Resources.Resource.store + " FROM store s  WHERE a.store_id = s.store_id) AS '" + Resources.Resource.clck + "', prd_pk_id '" + Resources.Resource.pddh + "', prd_pk_date '" + Resources.Resource.pdrq + "','" + Resources.Resource.czry + "'=(select operator_name from operator o where o.operator_id =a.operator_id),remark as '" + Resources.Resource.bz + "' FROM pre_prd_pk a where a.store_id = '" + ddlMaterialStock.SelectedItem.Value + "' ";
            DataTable dt  = new SelectCommandBuilder().ExecuteDataTable(sql);

            tr.Visible        = true;
            gvData.DataSource = dt;
            gvData.DataBind();
        }
コード例 #27
0
 public InsertSelectCommandBuilder()
 {
     CommandParameters = new Dictionary <string, object>();
     FieldNames        = new List <string>();
     OutputFields      = new List <string>();
     SelectCommand     = new SelectCommandBuilder();
     Table             = string.Empty;
     TemporaryTable    = string.Empty;
 }
コード例 #28
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("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();
        }
コード例 #29
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         string    sqlgetproduce = @"select distinct equip.Area  from goods inner join equip on  goods.sbdm=equip.equip_id 
                              where equip.Area is not null ";
         DataTable prodouce      = new SelectCommandBuilder().ExecuteDataTable(sqlgetproduce);
     }
 }
コード例 #30
0
        private void getData()
        {
            SelectCommandBuilder cmd = new SelectCommandBuilder();
            string    sql            = "select userid,name,department from shatter_Parts_Password";
            DataTable dt             = cmd.ExecuteDataTable(sql);

            GridView1.DataSource = dt;
            GridView1.DataBind();
        }