Exemple #1
0
        ////////////////

        public static void UpdateCompany(CompanyUpdModel company, string upd_user)
        {
            try
            {
                string sqlStmt = @"UPDATE b2b.b2d_company SET 
 status=:STATUS, comp_coop_mode=:COMP_COOP_MODE, payment_type=:PAYMENT_TYPE, comp_name=:COMP_NAME, 
 comp_url=:COMP_URL, comp_locale=:COMP_LOCALE, comp_currency=:COMP_CURRENCY, comp_invoice=:COMP_INVOICE, 
 comp_country=:COMP_COUNTRY, comp_tel_country_code=:COMP_TEL_COUNTRY_CODE, comp_tel=:COMP_TEL,
 comp_address=:COMP_ADDRESS, contact_user=:CONTACT_USER, contact_user_email=:CONTACT_USER_EMAIL,
 finance_user=:FINANCE_USER, sales_user=:SALES_USER,
 upd_user=:UPD_USER, upd_datetime=Now()
WHERE xid=:XID";

                NpgsqlParameter[] sqlParams = new NpgsqlParameter[] {
                    new NpgsqlParameter("XID", company.XID),
                    new NpgsqlParameter("STATUS", company.STATUS),
                    new NpgsqlParameter("COMP_COOP_MODE", company.COOP_MODE),
                    new NpgsqlParameter("PAYMENT_TYPE", company.PAYMENT_TYPE),
                    new NpgsqlParameter("COMP_NAME", company.NAME),
                    new NpgsqlParameter("COMP_URL", company.URL),
                    new NpgsqlParameter("COMP_LOCALE", company.LOCALE),
                    new NpgsqlParameter("COMP_CURRENCY", company.CURRENCY),
                    new NpgsqlParameter("COMP_INVOICE", company.INVOICE),
                    new NpgsqlParameter("COMP_COUNTRY", company.COUNTRY),
                    new NpgsqlParameter("COMP_TEL_COUNTRY_CODE", company.TEL_COUNTRY_CODE),
                    new NpgsqlParameter("COMP_TEL", company.TEL),
                    new NpgsqlParameter("COMP_ADDRESS", company.ADDRESS),
                    new NpgsqlParameter("CONTACT_USER", company.CONTACT_USER),
                    new NpgsqlParameter("CONTACT_USER_EMAIL", company.CONTACT_USER_EMAIL),
                    new NpgsqlParameter("FINANCE_USER", company.FINANCE_USER),
                    new NpgsqlParameter("SALES_USER", company.SALES_USER),
                    //new NpgsqlParameter("CHARGE_MAN_FIRST", company.CHARGE_MAN_FIRST),
                    //new NpgsqlParameter("CHARGE_MAN_LAST", company.CHARGE_MAN_LAST),
                    //new NpgsqlParameter("CREDITCARD_NO", company.CREDITCARD_NO),
                    //new NpgsqlParameter("CREDITCARD_VALID", company.CREDITCARD_VALID),
                    //new NpgsqlParameter("CREDITCARD_CVC", company.CREDITCARD_CVC)
                    new NpgsqlParameter("UPD_USER", upd_user)
                };

                NpgsqlHelper.ExecuteNonQuery(Website.Instance.SqlConnectionString, CommandType.Text, sqlStmt, sqlParams);
            }
            catch (Exception ex)
            {
                Website.Instance.logger.FatalFormat("{0}.{1}", ex.Message, ex.StackTrace);
                throw ex;
            }
        }
Exemple #2
0
        public IActionResult Update([FromBody] CompanyUpdModel company)
        {
            Dictionary <string, object> jsonData = new Dictionary <string, object>();

            try
            {
                var compRepos = HttpContext.RequestServices.GetService <CompanyRepository>();
                var upd_user  = User.FindFirst("Account").Value;

                //更新分銷商公司資料
                compRepos.Update(company, upd_user);
                jsonData["status"] = "OK";
            }
            catch (Exception ex)
            {
                jsonData.Clear();
                jsonData.Add("status", "FAIL");
                jsonData.Add("msg", ex.Message);
            }

            return(Json(jsonData));
        }
Exemple #3
0
 public void Update(CompanyUpdModel company, string upd_user)
 {
     CompanyDAL.UpdateCompany(company, upd_user);
 }