示例#1
0
    protected void BindGvM()
    {
        conn.Open();

        //lblGType.Text = Session["GType"].ToString();
        int gType = int.Parse(Session["GTypeId"].ToString());
        //string strSelectCmd = "SELECT  * FROM View_Tna_Plan WHERE PO_Ship_Date is NULL AND ActiveOrder='1' AND TnAapproved IS NOT NULL AND TnaByrNm = '" + ddbuyerM.SelectedItem.Value + "' order by ord_no,po_xfactory ASC";

        string strSelectCmd = @"select p.Id,p.OperationName,p.MachineName,gtp.SMV,gtp.MachineQty,gtp.ManQty from tblGtypeProcess gtp join tblProcess p on gtp.Process=p.Id
                                join GarmentsType g on gtp.GType = g.gmtid  where g.gmtid = " + gType;

        SqlDataAdapter da = new SqlDataAdapter(strSelectCmd, conn);
        DataSet        ds = new DataSet();

        da.Fill(ds);
        Session["SelectedProcess"] = null;


        if (ds.Tables[0].Rows.Count == 0)
        {
            ds.Tables[0].Rows.Add(ds.Tables[0].NewRow());
            GvProcess.DataSource = ds;
            GvProcess.DataBind();
            int columncount = GvProcess.Rows[0].Cells.Count;
            GvProcess.Rows[0].Cells.Clear();
            GvProcess.Rows[0].Cells.Add(new TableCell());
            GvProcess.Rows[0].Cells[0].ColumnSpan = columncount;
            GvProcess.Rows[0].Cells[0].Text       = "";
        }
        else
        {
            //Search Option-RUS
            ViewState["dtOrder"] = ds.Tables[0];
            //Search Option-RUS
            GvProcess.DataSource = ds;
            GvProcess.DataBind();
            //Session["GTypeId"] = dt.Rows[0]["art_item"];
            //Session["PId"] = GvProcess.Rows[0].Cells[0].
        }
    }
示例#2
0
    protected void saveProcess_Click(object sender, EventArgs e)
    {
        SqlConnection con = new SqlConnection(DbConnect.x);

        //Master Data Insert
        SqlCommand cmd = new SqlCommand("uspInsertIEMaster", con);

        cmd.CommandType = CommandType.StoredProcedure;

        cmd.Parameters.AddWithValue("@Style", SqlDbType.NVarChar).Value      = GetStn.SelectedValue;
        cmd.Parameters.AddWithValue("@art_id", SqlDbType.Int).Value          = GetArticle.SelectedValue;
        cmd.Parameters.AddWithValue("@PEffeciency", SqlDbType.TinyInt).Value = txtPlanEff.Text.Trim();
        cmd.Parameters.AddWithValue("@TotSmv", SqlDbType.Decimal).Value      = txtSmv.Text.Trim();
        cmd.Parameters.AddWithValue("@MOperator", SqlDbType.TinyInt).Value   = txtMo.Text.Trim();
        cmd.Parameters.AddWithValue("@Helper", SqlDbType.TinyInt).Value      = txtHelper.Text.Trim();
        cmd.Parameters.AddWithValue("@TargetPHr", SqlDbType.SmallInt).Value  = txtTargetHr.Text.Trim();

        con.Open();
        cmd.ExecuteNonQuery();
        cmd.Dispose();
        //con.Close();
        //con.Dispose();

        // Details Data Insert
        foreach (GridViewRow row in gvSelected.Rows)
        {
            //DataTable dt = this.SelectedProcess;
            SqlCommand cmdd = new SqlCommand("uspInsertIEDetails", con);
            cmdd.CommandType = CommandType.StoredProcedure;
            cmdd.Parameters.AddWithValue("@art_id", SqlDbType.Int).Value = GetArticle.SelectedValue;

            int pid = Convert.ToInt32(((Label)row.FindControl("lblPId")).Text);
            cmdd.Parameters.AddWithValue("@ProcessId", pid);
            //int srl = Convert.ToInt32((row.Cells[0]).Text);
            //cmdd.Parameters.AddWithValue("@SrlNo", srl);

            //con.Open();
            cmdd.ExecuteNonQuery();
            cmdd.Dispose();
            //con.Dispose();
        }


        con.Close();
        gvSelected.DataSource = null;
        gvSelected.DataBind();

        GvProcess.DataSource = null;
        GvProcess.DataBind();

        txtHelper.Text   = "";
        txtMo.Text       = "";
        txtPlanEff.Text  = "";
        txtSmv.Text      = "";
        txtTargetHr.Text = "";
        GetGType.Text    = "";
        GetByr.Items.Clear();
        GetStn.Items.Clear();
        GetArticle.Items.Clear();
        saveProcess.Visible = false;

        Response.Redirect(Request.RawUrl);
    }