コード例 #1
0
        static void Main_TestATPCTPConfirm()
        {
            String ConStrCustom;
            String ConstrStd;
            string WarningMsg = string.Empty;

            Cls_Connection t = new Cls_Connection();

            ConStrCustom = t.GetConnectionString_Custom();
            ConstrStd    = t.GetConnectionString_Std();

            d = new ATPCTP(ConStrCustom, ConstrStd);
            clsDTConfirm DTConfirm = new clsDTConfirm {
                SolutionId = 3296, Quantity = 35
            };

            DTConfirm.AddRow();

            if (d.Confirm(DTConfirm, UserID: 0, ref WarningMsg) == true)
            {
                Console.WriteLine($"Confirm process is success");
            }
            else
            {
                Console.WriteLine($"WarningMsg:{WarningMsg}");
            }
        }
コード例 #2
0
        public bool Confirm(clsDTConfirm DTConfirm, int UserID, ref string WarningMsg)
        {
            try
            {
                Console.WriteLine("Start Confirm ... ");
                int logID;
                logID = log.LogProcessInsert(clsLog.Logger.ATPCTP, clsLog.ProcessCategory.ConfirmATPCTP, "ATPCTP Confirm", DateTime.Now);
                string    procName = "proc_DUP_ConfirmATPCTP_4322";
                DataTable DT1      = DTConfirm.DT;

                using (SqlConnection con = new SqlConnection(_conStr))
                {
                    con.Open();
                    using (SqlCommand cmd = con.CreateCommand())
                    {
                        cmd.CommandType    = CommandType.StoredProcedure;
                        cmd.CommandText    = procName;
                        cmd.CommandTimeout = 180;
                        SqlParameter dtc;
                        dtc          = cmd.Parameters.Add("@DTConfirm", SqlDbType.Structured);
                        dtc.Value    = DT1;
                        dtc.TypeName = "dbo.DT_ConfirmATPCTP";

                        cmd.Parameters.AddWithValue("@UserID", UserID);

                        cmd.ExecuteNonQuery();
                    }
                }

                log.LogProcessUpdate(logID, DateTime.Now);
                Console.WriteLine("End Confirm");
                return(true);
            }
            catch (SqlException ex)
            {
                string errmsg     = ex.Message;
                string showerrmsg = string.Empty;
                WarningMsg = errmsg;
                try
                {
                    log.LogAlert(clsLog.Logger.ATPCTP, clsLog.ErrorLevel.CriticalImapact, clsLog.ProcessCategory.ConfirmATPCTP, $"Unable to Confirm ATCTP {errmsg}");
                    if (IsRealError(errmsg, ref showerrmsg) == true)
                    {
                        WarningMsg = errmsg;
                        Console.WriteLine($"Error found on Confirm ATPCTP:{errmsg}");
                        return(false);
                    }
                    else
                    {
                        WarningMsg = showerrmsg;
                        return(false);
                    }
                }
                catch (Exception)
                {
                    //nothing
                    throw ex;
                }
            }
        }