public bool saveTempListItem(DTO_Warehouse_Export_Data item, string deptCode) { try { using (SqlCommand cmd = new SqlCommand("TempExport", conn)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@LOT_ID", item.LOTID); cmd.Parameters.AddWithValue("@LOT_NUMBER", item.LOTNumber); cmd.Parameters.AddWithValue("@CODE", item.ValidCode); cmd.Parameters.AddWithValue("@CUSTOMER", deptCode); conn.Open(); if (cmd.ExecuteNonQuery() > 0) { return(true); } } return(false); } catch (Exception ex) { string str = ex.ToString(); str = ""; } finally { conn.Close(); } return(false); }
public List <DTO_Warehouse_Export_Data> getTempListItem(string deptCode) { List <DTO_Warehouse_Export_Data> list = new List <DTO_Warehouse_Export_Data>(); try { string sqlString = string.Format(@"SELECT TOP 500 W.[LOT_ID],W.[LOT_NUMBER],W.[VALID_CODE],W.[ITEM_CODE],M.[NAME],M.[ENG_NAME],W.[EXPORT_UNIT],W.[QTY_TRANS],W.[INPUT_DATE],M.[MOQ],M.[TECH_INFO] FROM[dbo].[WAREHOUSE] W INNER JOIN[dbo].[MATERIAL_ITEM] M ON W.[ITEM_CODE] = M.[ITEM_CODE] WHERE W.ITEM_STATUS = 'ACTIVE' AND W.[OUTPUT_CUSTOMER] = '{0}'", deptCode); SqlDataAdapter da = new SqlDataAdapter(sqlString, conn); DataTable dt = new DataTable(); da.Fill(dt); foreach (DataRow row in dt.Rows) { DTO_Warehouse_Export_Data item = new DTO_Warehouse_Export_Data(); item.LOTID = int.Parse(row[0].ToString()); item.LOTNumber = int.Parse(row[1].ToString()); item.ValidCode = row[2].ToString(); item.ItemCode = row[3].ToString(); item.Name = row[4].ToString(); item.EngName = row[5].ToString(); item.ExportUnit = row[6].ToString(); item.QtyTrans = row[7].ToString(); item.InputDate = row[8].ToString(); item.MOQ = int.Parse(row[9].ToString()); item.TechInfo = row[10].ToString(); list.Add(item); } return(list); } catch { } finally { conn.Close(); } return(list); }
public DTO_Warehouse_Export_Data getExportItemInfo(int lot, int number, string code) { DTO_Warehouse_Export_Data lotItem = new DTO_Warehouse_Export_Data(); try { string sqlString = string.Format(@"SELECT TOP 1 W.[LOT_ID],W.[LOT_NUMBER],W.[VALID_CODE],W.[ITEM_CODE],M.[NAME],M.[ENG_NAME],W.[EXPORT_UNIT],W.[QTY_TRANS],W.[INPUT_DATE],M.[MOQ],M.[TECH_INFO] FROM[dbo].[WAREHOUSE] W INNER JOIN[dbo].[MATERIAL_ITEM] M ON W.[ITEM_CODE] = M.[ITEM_CODE] WHERE W.ITEM_STATUS = 'ACTIVE' AND W.[LOT_ID] = {0} AND W.[LOT_NUMBER] = {1} AND W.[VALID_CODE] = '{2}'", lot, number, code); SqlDataAdapter da = new SqlDataAdapter(sqlString, conn); DataTable dt = new DataTable(); da.Fill(dt); if (dt.Rows.Count == 1) { lotItem.LOTID = int.Parse(dt.Rows[0][0].ToString()); lotItem.LOTNumber = int.Parse(dt.Rows[0][1].ToString()); lotItem.ValidCode = dt.Rows[0][2].ToString(); lotItem.ItemCode = dt.Rows[0][3].ToString(); lotItem.Name = dt.Rows[0][4].ToString(); lotItem.EngName = dt.Rows[0][5].ToString(); lotItem.ExportUnit = dt.Rows[0][6].ToString(); lotItem.QtyTrans = dt.Rows[0][7].ToString(); lotItem.InputDate = dt.Rows[0][8].ToString(); lotItem.MOQ = int.Parse(dt.Rows[0][9].ToString()); lotItem.TechInfo = dt.Rows[0][10].ToString(); return(lotItem); } } catch { } finally { conn.Close(); } return(null); }
public bool saveTempListItem(DTO_Warehouse_Export_Data item, string deptCode) { return(dalWarehouseData.saveTempListItem(item, deptCode)); }