コード例 #1
0
    protected void GetArticle_SelectedIndexChanged(object sender, EventArgs e)
    {
        GetPo.Items.Clear();
        GetPo.Items.Add(new ListItem("-", ""));
        GetPo.AppendDataBoundItems = true;
        SqlConnection conn = new SqlConnection(DbConnect.x);

        try
        {
            DataTable  dt       = new DataTable();
            String     strQuery = "select distinct a.po_no,b.gmtyp as art_item,b.gmtid,a.Fact_nm from view_Article_Po a join GarmentsType b on a.art_item = b.gmtid where art_no='" + GetArticle.SelectedItem.Value + "' and a.po_no not in (select Po_no from Line_Booking) ";
            SqlCommand cmd      = new SqlCommand();
            cmd.CommandType = CommandType.Text;
            cmd.CommandText = strQuery;
            cmd.Connection  = conn;

            conn.Open();
            SqlDataAdapter da = new SqlDataAdapter(cmd);
            da.Fill(dt);
            if (dt.Rows.Count > 0)
            {
                //If you want to get mutiple data from the database then you need to write a simple looping
                GetGType.Text      = dt.Rows[0]["art_item"].ToString();
                GetFactory.Text    = dt.Rows[0]["Fact_nm"].ToString();
                Session["GType"]   = GetGType.Text;
                Session["GTypeId"] = dt.Rows[0]["gmtid"];
                GetPo.ClearSelection();
                GetPo.DataTextField  = "po_no";
                GetPo.DataValueField = "po_no";
                GetPo.DataSource     = dt;
                GetPo.DataBind();
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
        finally
        {
            conn.Close();
            conn.Dispose();
        }
    }
コード例 #2
0
    protected void Btnsave_Click(object sender, System.EventArgs e)
    {
        try
        {
            SqlConnection conn = new SqlConnection(DbConnect.x);

            SqlCommand Syscmd = new SqlCommand();
            Syscmd.CommandType = CommandType.StoredProcedure;
            Syscmd.CommandText = "Sp_ProductionCAD_Data";

            //DateTime shipDate = DateTime.ParseExact(txtentdt.Text, "d", null);
            //Syscmd.Parameters.AddWithValue("@sp_Date", shipDate);
            Syscmd.Parameters.AddWithValue("@ord_no", ddlStyle.SelectedItem.ToString());
            Syscmd.Parameters.AddWithValue("@art_no", GetPo.SelectedItem.ToString());
            Syscmd.Parameters.AddWithValue("@pCADCons", txtPCons.Text.Trim());
            Syscmd.Parameters.AddWithValue("@pCADDia", int.Parse(txtPDia.Text.Trim()));
            Syscmd.Parameters.AddWithValue("@pCADGsm", int.Parse(txtPGsm.Text.Trim()));
            Syscmd.Parameters.AddWithValue("@sp_User", this.Session["Username"].ToString());

            Syscmd.Connection = conn;
            conn.Open();

            Syscmd.ExecuteNonQuery();
            conn.Close();
        }
        catch (Exception ex)
        {
            throw ex;
        }

        ddlStyle.ClearSelection();
        GetPo.ClearSelection();
        txtPCons.Text = string.Empty;
        txtPDia.Text  = string.Empty;
        txtPGsm.Text  = string.Empty;
        //GvIvn.SelectedIndex = -1;
        GvIvn.DataSource = null;
        GvIvn.DataBind();
        prodEntry.Visible = false;
    }
コード例 #3
0
    protected void Btnsave_Click(object sender, System.EventArgs e)
    {
        try
        {
            SqlConnection conn = new SqlConnection(DbConnect.x);

            SqlCommand Syscmd = new SqlCommand();
            Syscmd.CommandType = CommandType.StoredProcedure;
            Syscmd.CommandText = "Sp_BookingCAD_Data";

            //DateTime shipDate = DateTime.ParseExact(txtentdt.Text, "d", null);
            //Syscmd.Parameters.AddWithValue("@sp_Date", shipDate);
            Syscmd.Parameters.AddWithValue("@ord_no", GetStyle.SelectedItem.ToString());
            Syscmd.Parameters.AddWithValue("@art_no", GetPo.SelectedItem.ToString());
            Syscmd.Parameters.AddWithValue("@art_qty", int.Parse(txtQty.Text.Trim()));
            Syscmd.Parameters.AddWithValue("@byr_nm", txtBuyer.Text.Trim());
            Syscmd.Parameters.AddWithValue("@bCADCons", txtBCons.Text.Trim());
            Syscmd.Parameters.AddWithValue("@bCADDia", int.Parse(txtBDia.Text.Trim()));
            Syscmd.Parameters.AddWithValue("@bCADGsm", int.Parse(txtBGsm.Text.Trim()));
            Syscmd.Parameters.AddWithValue("@sp_User", this.Session["Username"].ToString());

            Syscmd.Connection = conn;
            conn.Open();

            Syscmd.ExecuteNonQuery();
            conn.Close();
        }
        catch (Exception ex)
        {
            throw ex;
        }

        GetStyle.ClearSelection();
        GetPo.ClearSelection();
        txtQty.Text   = string.Empty;
        txtBuyer.Text = string.Empty;
        txtBCons.Text = string.Empty;
        txtBDia.Text  = string.Empty;
        txtBGsm.Text  = string.Empty;
    }
コード例 #4
0
    protected void GetStyle_SelectedIndexChanged(object sender, EventArgs e)
    {
        GetPo.Items.Clear();
        GetPo.Items.Add(new ListItem("-", ""));
        GetPo.AppendDataBoundItems = true;
        SqlConnection conn      = new SqlConnection(DbSpecFo.x);
        String        strQuery1 = "select sm.cStyleNo,om.cPoNum from Smt_OrdersMaster om join Smt_StyleMaster sm on om.nOStyleId=sm.nStyleID where cStyleNo='" + GetStyle.SelectedItem.Text + "' ";
        SqlCommand    cmd1      = new SqlCommand();

        cmd1.CommandType = CommandType.Text;
        cmd1.CommandText = strQuery1;
        cmd1.Connection  = conn;
        try
        {
            conn.Open();
            GetPo.DataSource    = cmd1.ExecuteReader();
            GetPo.DataTextField = "cPoNum";
            GetPo.DataBind();
            if (GetPo.Items.Count > 1)
            {
                GetPo.Enabled = true;
            }
            else
            {
                GetPo.Enabled = false;
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
        finally
        {
            conn.Close();
            conn.Dispose();
        }
    }
コード例 #5
0
    protected void ddlStyle_SelectedIndexChanged(object sender, EventArgs e)
    {
        GetPo.Items.Clear();
        GetPo.Items.Add(new ListItem("-", ""));
        GetPo.AppendDataBoundItems = true;
        SqlConnection conn      = new SqlConnection(DbConnect.x);
        String        strQuery1 = "select art_no from tblBookCAD where ord_no='" + ddlStyle.SelectedItem.Text + "' ";
        SqlCommand    cmd1      = new SqlCommand();

        cmd1.CommandType = CommandType.Text;
        cmd1.CommandText = strQuery1;
        cmd1.Connection  = conn;
        try
        {
            conn.Open();
            GetPo.DataSource    = cmd1.ExecuteReader();
            GetPo.DataTextField = "art_no";
            GetPo.DataBind();
            if (GetPo.Items.Count > 1)
            {
                GetPo.Enabled = true;
            }
            else
            {
                GetPo.Enabled = false;
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
        finally
        {
            conn.Close();
            conn.Dispose();
        }
    }