protected void BindGvIvn() { conn.Open(); string strSelectCmd = "SELECT * FROM View_Tna_Plan WHERE PO_Ship_Date is NULL AND ActiveOrder='1' AND TnAapproved IS NOT NULL AND TnaByrNm = '" + ddlbuyerI.SelectedItem.Value + "'order by ord_no,po_xfactory ASC"; SqlDataAdapter da = new SqlDataAdapter(strSelectCmd, conn); DataSet ds = new DataSet(); da.Fill(ds); if (ds.Tables[0].Rows.Count == 0) { ds.Tables[0].Rows.Add(ds.Tables[0].NewRow()); GvIvn.DataSource = ds; GvIvn.DataBind(); int columncount = GvIvn.Rows[0].Cells.Count; GvIvn.Rows[0].Cells.Clear(); GvIvn.Rows[0].Cells.Add(new TableCell()); GvIvn.Rows[0].Cells[0].ColumnSpan = columncount; GvIvn.Rows[0].Cells[0].Text = ""; } else { //Search Option-RUS ViewState["dtOrder"] = ds.Tables[0]; //Search Option-RUS GvIvn.DataSource = ds; GvIvn.DataBind(); } }
protected void BindGvIvn() { using (SqlConnection conn = new SqlConnection(DbSmartCode.x)) { conn.Open(); string strSelectCmd = "select (select SUM(cQty) from SmartCode.dbo.View_Web_StyleCutWiseCutOut where cStyleNo='" + ddlStyle.SelectedItem.Text + "') as TotalCutting,(SELECT SUM(BQty) FROM [SmartCode].[dbo].[View_Web_ScanData_ColourSize] where BTStyle='" + ddlStyle.SelectedItem.Text + "' and BTDescription='INPUT') as TotalInput,(SELECT SUM(BQty) FROM [SmartCode].[dbo].[View_Web_ScanData_ColourSize] where BTStyle='" + ddlStyle.SelectedItem.Text + "' and BTDescription='SEWING QC OUT') as TotalSewing ,(SELECT SUM(BQty) FROM [SmartCode].[dbo].[View_Web_ScanData_ColourSize] where BTStyle='" + ddlStyle.SelectedItem.Text + "' and BTDescription='FINAL OUT' ) as TotalPoly , SUM(sp.sp_SizeQty) as ShipmentReady,sm.nTotOrdQty as ShipmentRequired from SmartCode.dbo.Smt_ShipmentInf sp join SpecFo.dbo.Smt_StyleMaster sm on sp.sp_StyleID=sm.nStyleID where sm.cStyleNo='"+ ddlStyle.SelectedItem.Text + "' group by sm.nTotOrdQty"; //string strSelectCmd = "SELECT * FROM View_Tna_Plan WHERE Po_ShipDate is NULL AND ActiveOrder='1' AND TnAapproved IS NOT NULL AND TnaByrNm = '" + ddlbuyerI.SelectedItem.Value + "'order by ord_no,po_xfactory ASC"; SqlDataAdapter da = new SqlDataAdapter(strSelectCmd, conn); DataSet ds = new DataSet(); da.Fill(ds); if (ds.Tables[0].Rows.Count == 0) { ds.Tables[0].Rows.Add(ds.Tables[0].NewRow()); GvIvn.DataSource = ds; GvIvn.DataBind(); int columncount = GvIvn.Rows[0].Cells.Count; GvIvn.Rows[0].Cells.Clear(); GvIvn.Rows[0].Cells.Add(new TableCell()); GvIvn.Rows[0].Cells[0].ColumnSpan = columncount; GvIvn.Rows[0].Cells[0].Text = ""; } else { GvIvn.DataSource = ds; GvIvn.DataBind(); } } }
//Search Option-RUS protected void btnSearch_Click(object sender, EventArgs e) { DataTable dtOrder = (DataTable)ViewState["dtOrder"]; DataView dvOrder = dtOrder.DefaultView; dvOrder.RowFilter = "ord_no like '" + txtSearch.Text + "%'"; GvIvn.DataSource = dvOrder; GvIvn.DataBind(); }
protected void BindGvIvn() { try { using (SqlConnection conn = new SqlConnection(DbSmartCode.x)) { conn.Open(); //string strSelectCmd = "select (select SUM(cQty) from SmartCode.dbo.View_Web_StyleCutWiseCutOut where cStyleNo='" + ddlStyle.SelectedItem.Text + "') as TotalCutting,(SELECT SUM(BQty) FROM [SmartCode].[dbo].[View_Web_ScanData_ColourSize] where BTStyle='" + ddlStyle.SelectedItem.Text + "' and BTDescription='INPUT') as TotalInput,(SELECT SUM(BQty) FROM [SmartCode].[dbo].[View_Web_ScanData_ColourSize] where BTStyle='" + ddlStyle.SelectedItem.Text + "' and BTDescription='SEWING QC OUT') as TotalSewing ,(SELECT SUM(BQty) FROM [SmartCode].[dbo].[View_Web_ScanData_ColourSize] where BTStyle='" + ddlStyle.SelectedItem.Text + "' and BTDescription='FINAL OUT' ) as TotalPoly ,(select SUM(sp.sp_SizeQty) from SmartCode.dbo.Smt_ShipmentInf sp join SpecFo.dbo.Smt_StyleMaster sm on sp.sp_StyleID=sm.nStyleID where sm.cStyleNo='" + ddlStyle.SelectedItem.Text + "') as ShipmentReady,sm.nTotOrdQty as ShipmentRequired,(select sum(ex.sp_SizeQty) from Smt_ExportInf ex join SpecFo.dbo.Smt_StyleMaster sm on ex.sp_StyleID=sm.nStyleID where sm.cStyleNo='" + ddlStyle.SelectedItem.Text + "') as ExportQty,(select sum(ex.sp_TotalValue) from Smt_ExportInf ex join SpecFo.dbo.Smt_StyleMaster sm on ex.sp_StyleID=sm.nStyleID where sm.cStyleNo='" + ddlStyle.SelectedItem.Text + "') as ExportValue,sb.cBuyer_Name from SmartCode.dbo.Smt_ShipmentInf sp join SpecFo.dbo.Smt_StyleMaster sm on sp.sp_StyleID=sm.nStyleID join SmartCode.dbo.Smt_ExportInf ex on sp.sp_StyleID=ex.sp_StyleID join SpecFo.dbo.Smt_BuyerName sb on sm.nAcct=sb.nBuyer_ID where sm.cStyleNo='" + ddlStyle.SelectedItem.Text + "' group by sm.nTotOrdQty,sb.cBuyer_Name"; string strSelectCmd = @"select isnull((select SUM(cQty) from SmartCode.dbo.View_Web_StyleCutWiseCutOut where cStyleNo='" + ddlStyle.SelectedItem.Text + "'),0) as TotalCutting, isnull((SELECT SUM(BQty) FROM [SmartCode].[dbo].[View_Web_ScanData_ColourSize] where BTStyle='" + ddlStyle.SelectedItem.Text + "' and BTDescription='INPUT'),0) as TotalInput, isnull((SELECT SUM(BQty) FROM [SmartCode].[dbo].[View_Web_ScanData_ColourSize] where BTStyle='" + ddlStyle.SelectedItem.Text + "' and BTDescription='SEWING QC OUT'),0) as TotalSewing , isnull((SELECT SUM(BQty) FROM [SmartCode].[dbo].[View_Web_ScanData_ColourSize] where BTStyle='" + ddlStyle.SelectedItem.Text + "' and BTDescription='FINAL OUT'),0) as TotalPoly , isnull((select SUM(sp.sp_SizeQty) from SmartCode.dbo.Smt_ShipmentInf sp join SpecFo.dbo.Smt_StyleMaster sm on sp.sp_StyleID=sm.nStyleID where sm.cStyleNo='" + ddlStyle.SelectedItem.Text + "'),0) as ShipmentReady,sm.nTotOrdQty as ShipmentRequired, isnull((select sum(ex.sp_SizeQty) from Smt_ExportInf ex join SpecFo.dbo.Smt_StyleMaster sm on ex.sp_StyleID=sm.nStyleID where sm.cStyleNo='" + ddlStyle.SelectedItem.Text + "'),0) as ExportQty, isnull((select sum(ex.sp_TotalValue) from Smt_ExportInf ex join SpecFo.dbo.Smt_StyleMaster sm on ex.sp_StyleID=sm.nStyleID where sm.cStyleNo='" + ddlStyle.SelectedItem.Text + "'),0) as ExportValue, sb.cBuyer_Name from SpecFo.dbo.Smt_StyleMaster sm left join SmartCode.dbo.Smt_ShipmentInf sp on sm.nStyleID= sp.sp_StyleID Left join SmartCode.dbo.Smt_ExportInf ex on sp.sp_StyleID=ex.sp_StyleID join SpecFo.dbo.Smt_BuyerName sb on sm.nAcct=sb.nBuyer_ID where sm.cStyleNo='" + ddlStyle.SelectedItem.Text + "' group by sm.nTotOrdQty,sb.cBuyer_Name"; SqlDataAdapter da = new SqlDataAdapter(strSelectCmd, conn); DataTable ds = new DataTable(); da.Fill(ds); if (ds.Rows.Count == 0) { DataRow dr = ds.NewRow(); foreach (DataColumn dc in ds.Columns) { dr[dc] = 0; } ds.Rows.Add(dr); GvIvn.DataSource = ds; GvIvn.DataBind(); int columncount = GvIvn.Rows[0].Cells.Count; GvIvn.Rows[0].Cells.Clear(); GvIvn.Rows[0].Cells.Add(new TableCell()); GvIvn.Rows[0].Cells[0].ColumnSpan = columncount; GvIvn.Rows[0].Cells[0].Text = "No data found."; } else { GvIvn.DataSource = ds; GvIvn.DataBind(); } } } catch (Exception ex) { throw ex; } }
protected void BindGvIvn() { try { using (SqlConnection conn = new SqlConnection(DbSmartCode.x)) { conn.Open(); SqlDataAdapter adapter = new SqlDataAdapter("Sp_reportGroupSummary '" + this.txtDate.Text + "'", cn); DataTable ds = new DataTable(); adapter.Fill(ds); if (ds.Rows.Count == 0) { DataRow dr = ds.NewRow(); foreach (DataColumn dc in ds.Columns) { dr[dc] = 0; } ds.Rows.Add(dr); GvIvn.DataSource = ds; GvIvn.DataBind(); int columncount = GvIvn.Rows[0].Cells.Count; GvIvn.Rows[0].Cells.Clear(); GvIvn.Rows[0].Cells.Add(new TableCell()); GvIvn.Rows[0].Cells[0].ColumnSpan = columncount; GvIvn.Rows[0].Cells[0].Text = "No data found."; } else { GvIvn.DataSource = ds; GvIvn.DataBind(); } } } catch (Exception ex) { throw ex; } }
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; }