예제 #1
0
        public bool InsertRecords_Company(CompanyCls slCls, out string returnMessage)
        {
            bool b = false;

            returnMessage = string.Empty;
            int liExecute = 0;

            try
            {
                string query = " INSERT INTO sys_Company (CompanyCode, CompanyName " +
                               " , CompanyFullName, Principal, CompanyTel, CompanyFax " +
                               " , CompanyEmail, CompanyWebSite, CompanyAddress, CompanyLocation " +
                               " , BeneficiaryName, BeneficiaryBank, AccountNO, SwiftCode " +
                               " , CountryCode, CompanyOrder, ActiveYN, UpdUserID, UpdDT) VALUES " +
                               " ( @CompanyCode, @CompanyName " +
                               " , @CompanyFullName, @Principal, @CompanyTel, @CompanyFax " +
                               " , @CompanyEmail, @CompanyWebSite, @CompanyAddress, @CompanyLocation " +
                               " , @BeneficiaryName, @BeneficiaryBank, @AccountNO, @SwiftCode " +
                               " , @CountryCode, @CompanyOrder, @ActiveYN, @UpdUserID " +
                               " , NOW() ) ";

                using (MySqlCommand cmd = new MySqlCommand(query))
                {
                    cmd.Parameters.Clear();
                    //cmd.Parameters.AddWithValue("@CompanyPID", slCls.CompanyPID);
                    cmd.Parameters.AddWithValue("@CompanyCode", slCls.CompanyCode);
                    cmd.Parameters.AddWithValue("@CompanyName", slCls.CompanyName);
                    cmd.Parameters.AddWithValue("@CompanyFullName", slCls.CompanyFullName);
                    cmd.Parameters.AddWithValue("@Principal", slCls.Principal);
                    cmd.Parameters.AddWithValue("@CompanyTel", slCls.CompanyTel);
                    cmd.Parameters.AddWithValue("@CompanyFax", slCls.CompanyFax);
                    cmd.Parameters.AddWithValue("@CompanyEmail", slCls.CompanyEmail);
                    cmd.Parameters.AddWithValue("@CompanyWebSite", slCls.CompanyWebSite);
                    cmd.Parameters.AddWithValue("@CompanyAddress", slCls.CompanyAddress);
                    cmd.Parameters.AddWithValue("@CompanyLocation", slCls.CompanyLocation);
                    cmd.Parameters.AddWithValue("@BeneficiaryName", slCls.BeneficiaryName);
                    cmd.Parameters.AddWithValue("@BeneficiaryBank", slCls.BeneficiaryBank);
                    cmd.Parameters.AddWithValue("@AccountNO", slCls.AccountNO);
                    cmd.Parameters.AddWithValue("@SwiftCode", slCls.SwiftCode);
                    cmd.Parameters.AddWithValue("@CountryCode", slCls.CountryCode);
                    cmd.Parameters.AddWithValue("@CompanyOrder", slCls.CompanyOrder);
                    cmd.Parameters.AddWithValue("@ActiveYN", slCls.ActiveYN);
                    cmd.Parameters.AddWithValue("@UpdUserID", slCls.UpdUserID);

                    liExecute = publicNewClass.mydb.ExecuteCmd(query, 300, cmd.Parameters, out returnMessage);
                    b         = (liExecute == -1) ? false : true;
                }
            }
            catch (Exception ex)
            {
                returnMessage = ex.Message;
                liExecute     = -1;
            }

            b = liExecute == -1 ? false : true;
            return(b);
        }
예제 #2
0
        public bool UpdateRecords_Company(CompanyCls slCls, out string returnMessage)
        {
            bool b = false;

            returnMessage = string.Empty;
            int liExecute = 0;

            try
            {
                string query = " UPDATE sys_Company SET " +
                               //"   CompanyCode = @CompanyCode " +
                               "   CompanyName = @CompanyName " +
                               " , CompanyFullName = @CompanyFullName " +
                               " , Principal = @Principal " +
                               " , CompanyTel = @CompanyTel " +
                               " , CompanyFax = @CompanyFax " +
                               " , CompanyEmail = @CompanyEmail " +
                               " , CompanyWebSite = @CompanyWebSite " +
                               " , CompanyAddress = @CompanyAddress " +
                               " , CompanyLocation = @CompanyLocation " +
                               " , BeneficiaryName = @BeneficiaryName " +
                               " , BeneficiaryBank = @BeneficiaryBank " +
                               " , AccountNO = @AccountNO " +
                               " , SwiftCode = @SwiftCode " +
                               " , CountryCode = @CountryCode " +
                               " , CompanyOrder = @CompanyOrder " +
                               " , ActiveYN = @ActiveYN " +
                               " , CompanyAddress = @CompanyAddress " +
                               " , UpdUserID = @UpdUserID " +
                               " , UpdDT = NOW() " +
                               " WHERE CompanyPID = @CompanyPID ";

                using (MySqlCommand cmd = new MySqlCommand(query))
                {
                    cmd.Parameters.Clear();
                    cmd.Parameters.AddWithValue("@CompanyPID", slCls.CompanyPID);
                    //cmd.Parameters.AddWithValue("@CompanyCode", slCls.CompanyCode);
                    cmd.Parameters.AddWithValue("@CompanyName", slCls.CompanyName);
                    cmd.Parameters.AddWithValue("@CompanyFullName", slCls.CompanyFullName);
                    cmd.Parameters.AddWithValue("@Principal", slCls.Principal);
                    cmd.Parameters.AddWithValue("@CompanyTel", slCls.CompanyTel);
                    cmd.Parameters.AddWithValue("@CompanyFax", slCls.CompanyFax);
                    cmd.Parameters.AddWithValue("@CompanyEmail", slCls.CompanyEmail);
                    cmd.Parameters.AddWithValue("@CompanyWebSite", slCls.CompanyWebSite);
                    cmd.Parameters.AddWithValue("@CompanyAddress", slCls.CompanyAddress);
                    cmd.Parameters.AddWithValue("@CompanyLocation", slCls.CompanyLocation);
                    cmd.Parameters.AddWithValue("@BeneficiaryName", slCls.BeneficiaryName);
                    cmd.Parameters.AddWithValue("@BeneficiaryBank", slCls.BeneficiaryBank);
                    cmd.Parameters.AddWithValue("@AccountNO", slCls.AccountNO);
                    cmd.Parameters.AddWithValue("@SwiftCode", slCls.SwiftCode);
                    cmd.Parameters.AddWithValue("@CountryCode", slCls.CountryCode);
                    cmd.Parameters.AddWithValue("@CompanyOrder", slCls.CompanyOrder);
                    cmd.Parameters.AddWithValue("@ActiveYN", slCls.ActiveYN);
                    cmd.Parameters.AddWithValue("@UpdUserID", slCls.UpdUserID);

                    liExecute = publicNewClass.mydb.ExecuteCmd(query, 300, cmd.Parameters, out returnMessage);
                    b         = (liExecute == -1) ? false : true;
                }
            }
            catch (Exception ex)
            {
                returnMessage = ex.Message;
                liExecute     = -1;
            }

            b = liExecute == -1 ? false : true;
            return(b);
        }