예제 #1
0
        private static void UpdateFoundPart(string passedGuid, GetMasterResult getResult)
        {
            using (var conn = new OleDbConnection(ConfigurationManager.AppSettings["AS400ConnectionStringDev"]))
            {
                string query = GetPartFoundUpdateMasterString();

                var cmd = new OleDbCommand(query, conn);

                cmd.Connection.Open();
                cmd.CommandText = query;

                cmd.CommandText = cmd.CommandText.Replace("@passedGuid", ConvertString(passedGuid));
                cmd.CommandText = cmd.CommandText.Replace("@usrid", ConvertString((getResult.UserID.Trim().Length > 0) ? getResult.UserID : " "));
                cmd.CommandText = cmd.CommandText.Replace("@branded", ConvertString(getResult.Branded));
                cmd.CommandText = cmd.CommandText.Replace("@comcode",
                    ConvertString((getResult.Commodity_Code.Trim().Length > 0)
                        ? getResult.Commodity_Code
                        : " "));
                cmd.CommandText = cmd.CommandText.Replace("@level", (getResult.Level).ToString(CultureInfo.InvariantCulture));
                cmd.CommandText = cmd.CommandText.Replace("@status", ConvertString((getResult.Status.Trim().Length > 0) ? getResult.Status : " "));

                cmd.CommandText = cmd.CommandText.Replace("@rtnble", ConvertString((getResult.Status.Trim().Length > 0) ? getResult.Status : " "));
                cmd.CommandText = cmd.CommandText.Replace("@tariffcd", ConvertString(getResult.Returnable));
                cmd.CommandText = cmd.CommandText.Replace("@amsc", ConvertString((getResult.AMSC.Trim().Length > 0) ? getResult.AMSC : " "));
                cmd.CommandText = cmd.CommandText.Replace("@tqty", getResult.Technical_Qty.ToString(CultureInfo.InvariantCulture));
                cmd.CommandText = cmd.CommandText.Replace("@svclife", getResult.Service_Life.ToString(CultureInfo.InvariantCulture));
                cmd.CommandText = cmd.CommandText.Replace("@pkgcode", ConvertString((getResult.Package_Code.Trim().Length > 0) ? getResult.Package_Code : " "));
                cmd.CommandText = cmd.CommandText.Replace("@info", ConvertString((getResult.Information.Trim().Length > 0) ? getResult.Information : " "));
                cmd.CommandText = cmd.CommandText.Replace("@retrn", ConvertString("R"));

                cmd.ExecuteNonQuery();
                cmd.Connection.Close();
            }
        }
예제 #2
0
        private static void InsertCrossParts(string guid, GetMasterResult getResult)
        {
            foreach (CrossPart s in getResult.CrossPartList)
            {
                using (
                    var conn = new iDB2Connection(ConfigurationManager.AppSettings["AS400ConnectionString"]))
                {
                    string query = GetCrossPartInsertString();

                    var objDataAdapter = new iDB2DataAdapter();

                    var cmd = new iDB2Command(query, conn);

                    cmd.Connection.Open();

                    objDataAdapter.InsertCommand = cmd;
                    objDataAdapter.InsertCommand.CommandTimeout = 0;
                    cmd.Parameters.Add("@guid", iDB2DbType.iDB2Char);
                    cmd.Parameters["@guid"].Value = guid;

                    cmd.Parameters.Add("@item", iDB2DbType.iDB2Char);
                    cmd.Parameters["@item"].Value = s.PartNumber;

                    cmd.Parameters.Add("@brand", iDB2DbType.iDB2Char);
                    cmd.Parameters["@brand"].Value = s.Brand;

                    cmd.ExecuteNonQuery();
                    cmd.Connection.Close();
                }
            }
        }
예제 #3
0
        private static void InsertCrossParts(string passedGuid, GetMasterResult getResult)
        {
            foreach (CrossPart s in getResult.CrossPartList)
            {
                using (
                    var conn = new OleDbConnection(ConfigurationManager.AppSettings["AS400ConnectionStringDev"]))
                {
                    string query = GetCrossPartInsertString();

                    var cmd = new OleDbCommand(query, conn);

                    cmd.Connection.Open();

                    cmd.CommandText = query;

                    cmd.CommandText = cmd.CommandText.Replace("@passedGuid", ConvertString(passedGuid));
                    cmd.CommandText = cmd.CommandText.Replace("@item", ConvertString(s.PartNumber));
                    cmd.CommandText = cmd.CommandText.Replace("@brand", ConvertString(s.Brand));

                    cmd.ExecuteNonQuery();
                    cmd.Connection.Close();
                }
            }
        }
예제 #4
0
        private static void UpdateFoundPart(string guid, GetMasterResult getResult)
        {
            using (var conn = new iDB2Connection(ConfigurationManager.AppSettings["AS400ConnectionString"]))
            {
                string query = GetPartFoundUpdateMasterString();

                var objDataAdapter = new iDB2DataAdapter();

                var cmd = new iDB2Command(query, conn);

                cmd.Connection.Open();

                objDataAdapter.UpdateCommand = cmd;
                objDataAdapter.UpdateCommand.CommandTimeout = 0;
                cmd.Parameters.Add("@guid", iDB2DbType.iDB2Char);
                cmd.Parameters["@guid"].Value = guid;

                cmd.Parameters.Add("@usrid", iDB2DbType.iDB2Char);
                cmd.Parameters["@usrid"].Value = (getResult.UserID.Trim().Length > 0) ? getResult.UserID : " ";

                cmd.Parameters.Add("@branded", iDB2DbType.iDB2Char);
                cmd.Parameters["@branded"].Value = getResult.Branded;

                cmd.Parameters.Add("@comcode", iDB2DbType.iDB2Char);
                cmd.Parameters["@comcode"].Value = (getResult.Commodity_Code.Trim().Length > 0)
                    ? getResult.Commodity_Code
                    : " ";

                cmd.Parameters.Add("@level", iDB2DbType.iDB2Integer);
                cmd.Parameters["@level"].Value = getResult.Level;

                cmd.Parameters.Add("@status", iDB2DbType.iDB2Char);
                cmd.Parameters["@status"].Value = (getResult.Status.Trim().Length > 0) ? getResult.Status : " ";

                cmd.Parameters.Add("@rtnble", iDB2DbType.iDB2Char);
                cmd.Parameters["@rtnble"].Value = getResult.Returnable;

                cmd.Parameters.Add("@tariffcd", iDB2DbType.iDB2Char);
                cmd.Parameters["@tariffcd"].Value = (getResult.Tariff_Code.Trim().Length > 0)
                    ? getResult.Tariff_Code
                    : " ";

                cmd.Parameters.Add("@amsc", iDB2DbType.iDB2Char);
                cmd.Parameters["@amsc"].Value = (getResult.AMSC.Trim().Length > 0) ? getResult.AMSC : " ";

                cmd.Parameters.Add("@tqty", iDB2DbType.iDB2Integer);
                cmd.Parameters["@tqty"].Value = getResult.Technical_Qty;

                cmd.Parameters.Add("@svclife", iDB2DbType.iDB2Integer);
                cmd.Parameters["@svclife"].Value = getResult.Service_Life;

                cmd.Parameters.Add("@pkgcode", iDB2DbType.iDB2Char);
                cmd.Parameters["@pkgcode"].Value = (getResult.Package_Code.Trim().Length > 0)
                    ? getResult.Package_Code
                    : " ";

                cmd.Parameters.Add("@info", iDB2DbType.iDB2Char);
                cmd.Parameters["@info"].Value = (getResult.Information.Trim().Length > 0)
                    ? getResult.Information
                    : " ";

                cmd.Parameters.Add("@retrn", iDB2DbType.iDB2Char);
                cmd.Parameters["@retrn"].Value = 'R';

                cmd.ExecuteNonQuery();
                cmd.Connection.Close();
            }
        }