Example #1
0
        public int SaveOther(Channel ch)
        {
            ch.Replace4MySQL();
            try
            {
                strSql = string.Format(@"update channel set deal_method={0},deal_percent={1},deal_fee={2},creditcard_1_percent={3},creditcard_3_percent={4},
                shopping_car_percent={5},commission_percent={6},cost_by_percent={7},cost_low_percent={8},cost_normal_percent={9},invoice_checkout_day={10},
                invoice_apply_start={11},invoice_apply_end={12},checkout_note='{13}',receipt_to={14},channel_manager='{15}',channel_note='{16}' where channel_id='{17}'",
               ch.deal_method == 0 ? "null" : ch.deal_method.ToString(),
               ch.deal_percent == 0 ? "null" : ch.deal_percent.ToString(),
               ch.deal_fee == 0 ? "null" : ch.deal_fee.ToString(),
               ch.creditcard_1_percent == 0 ? "null" : ch.creditcard_1_percent.ToString(),
               ch.creditcard_3_percent == 0 ? "null" : ch.creditcard_3_percent.ToString(),
               ch.shopping_car_percent == 0 ? "null" : ch.shopping_car_percent.ToString(),
               ch.commission_percent == 0 ? "null" : ch.commission_percent.ToString(),
               ch.cost_by_percent == 0 ? "null" : ch.cost_by_percent.ToString(),
               ch.cost_low_percent == 0 ? "null" : ch.cost_low_percent.ToString(),
               ch.cost_normal_percent == 0 ? "null" : ch.cost_normal_percent.ToString(),
               ch.invoice_checkout_day == 0 ? "null" : ch.invoice_checkout_day.ToString(),
               ch.invoice_apply_start == 0 ? "null" : ch.invoice_apply_start.ToString(),
               ch.invoice_apply_end == 0 ? "null" : ch.invoice_apply_end.ToString(),
               ch.checkout_note,
               ch.receipt_to == 0 ? "null" : ch.receipt_to.ToString(),
               ch.channel_manager, ch.channel_note, ch.channel_id);

                return _accessMySql.execCommand(strSql);
            }
            catch (Exception ex)
            {
                throw new Exception("ChannelDao-->SaveOther-->" + ex.Message, ex);
            }
           
        }
Example #2
0
        public int Edit(Channel ch)
        {
            ch.Replace4MySQL();
            try
            {
                StringBuilder sql = new StringBuilder("update channel set ");
                sql.Append(string.Format("channel_status='{0}',channel_name_full='{1}',channel_name_simple='{2}',channel_invoice='{3}',channel_email='{4}',company_phone='{5}',company_fax='{6}',company_zip='{7}',company_address='{8}',invoice_title='{9}',invoice_zip='{10}',invoice_address='{11}',annaul_fee='{12}',renew_fee='{13}',channel_type='{14}',user_id='{15}',model_in='{16}',notify_sms='{17}',erp_id='{18}' ", ch.channel_status, ch.channel_name_full, ch.channel_name_simple, ch.channel_invoice, ch.channel_email, ch.company_phone, ch.company_fax, ch.company_zip, ch.company_address, ch.invoice_title, ch.invoice_zip, ch.invoice_address, ch.annaul_fee, ch.renew_fee, ch.channel_type, ch.user_id, ch.model_in, ch.notify_sms, ch.erp_id));
                if (ch.contract_createdate != DateTime.MinValue)
                {
                    sql.Append(string.Format(",contract_createdate='{0}'", ch.contract_createdate.ToString("yyyy/MM/dd")));
                }
                if (ch.contract_start != DateTime.MinValue)
                {
                    sql.Append(string.Format(",contract_start='{0}'", ch.contract_start.ToString("yyyy/MM/dd")));
                }
                if (ch.contract_end != DateTime.MinValue)
                {
                    sql.Append(string.Format(",contract_end='{0}'", ch.contract_end.ToString("yyyy/MM/dd")));
                }
                sql.Append(string.Format(" WHERE channel_id = '{0}';", ch.channel_id));

                sql.Append(string.Format(" UPDATE users SET user_name = '{0}' WHERE user_id='{1}'", ch.channel_name_full, ch.user_id));
                return _accessMySql.execCommand(sql.ToString());
            }
            catch (Exception ex)
            {
                throw new Exception("ChannelDao-->Edit-->" + ex.Message, ex);
            }
            
        }
Example #3
0
 public int Delete(Channel ch)
 {
     try
     {
         strSql = string.Format("delete channel where channel_id = '{0}'", ch.channel_id);
         return _accessMySql.execCommand(strSql);
     }
     catch (Exception ex)
     {
         throw new Exception("ChannelDao-->Delete-->" + ex.Message, ex);
     }
     
 }
Example #4
0
 public DataTable GetAmountDetial(OrderDetailQuery query,out int totalCount)
 {
     totalCount = 0;
     DataTable dt = new DataTable();
     try
     {
         dt = _orderDetailDao.GetAmountDetial(query, out totalCount);
         if (dt != null && dt.Rows.Count > 0)
         {                   
             List<Parametersrc> parameterList = _parametersrcDao.SearchParameters("payment", "order_status", "product_mode");
             foreach (DataRow dr in dt.Rows)
             {
                 var alist = parameterList.Find(m => m.ParameterType == "payment" && m.ParameterCode == dr["order_payment"].ToString());
                 var blist = parameterList.Find(m => m.ParameterType == "order_status" && m.ParameterCode == dr["slave_status"].ToString());
                
                 if (alist != null)
                 {
                     dr["payment_name"] = alist.parameterName;
                 }
                 if (blist != null)
                 {
                     dr["slave_status_name"] = blist.remark;
                 }
                 int channel = dr["channel"].ToString() == "" ? 0 : Convert.ToInt32(dr["channel"].ToString());
                 Channel clist = new Channel();
                 if (channel == 0)
                 {
                     dr["channel_name_simple"] = "";
                 }
                 else
                 {
                     clist = _channelDao.getSingleObj(channel);
                 }
                 if (clist != null)
                 {
                     dr["channel_name_simple"] = clist.channel_name_simple;
                 }
                 if (dr["order_createdate"] != null)
                 {
                     dr["order_createdate_format"] = CommonFunction.DateTimeToString(CommonFunction.GetNetTime(Convert.ToInt32(dr["order_createdate"].ToString())));
                 }
                 if (dr["deduct_bonus"] != null)
                 {
                     dr["deducts"] = Convert.ToInt32(dr["deduct_bonus"].ToString());
                 }
                 if (dr["money"] != null)
                 {
                     dr["amount"] = Convert.ToInt32(dr["money"].ToString());
                 }
             }
         }
         return dt;
     }
     catch (Exception ex)
     {
        throw new Exception("OrderMasterMgr-->GetAmountDetial-->" + ex.Message, ex);
     }
 }
Example #5
0
        public int Save(Channel ch)
        {
            ch.Replace4MySQL();
            StringBuilder sbCloum = new StringBuilder();
            StringBuilder sbValue = new StringBuilder();
            try
            {
                if (ch.contract_createdate != DateTime.MinValue)
                {
                    sbCloum.Append("contract_createdate,");
                    sbValue.Append("'" + ch.contract_createdate.ToString("yyyy/MM/dd") + "',");
                }
                if (ch.contract_start != DateTime.MinValue)
                {
                    sbCloum.Append("contract_start,");
                    sbValue.Append("'" + ch.contract_start.ToString("yyyy/MM/dd") + "',");
                }
                if (ch.contract_end != DateTime.MinValue)
                {
                    sbCloum.Append("contract_end,");
                    sbValue.Append("'" + ch.contract_end.ToString("yyyy/MM/dd") + "',");
                }
                //add by xiangwang0413w 2014/06/26 增加 ERP客戶代號(erp_id)
                strSql = string.Format(@"insert into channel(channel_status,channel_name_full,channel_name_simple,channel_invoice,channel_email,company_phone,
                company_fax,company_zip,company_address,invoice_title,invoice_zip,invoice_address,{0} annaul_fee,renew_fee,channel_type,user_id,model_in,notify_sms,erp_id) 
                values ('{1}','{2}','{3}','{4}','{5}','{6}','{7}',{8},'{9}','{10}','{11}','{12}',{13} {14},{15},'{16}','{17}','{18}','{19}','{20}');select @@identity",
                    sbCloum.ToString(),
                    ch.channel_status, ch.channel_name_full, ch.channel_name_simple, ch.channel_invoice, ch.channel_email, ch.company_phone, ch.company_fax,
                    ch.company_zip == 0 ? "null" : ch.company_zip.ToString(),
                    ch.company_address, ch.invoice_title, ch.invoice_zip, ch.invoice_address,
                    sbValue.ToString(),
                    ch.annaul_fee == 0 ? "null" : ch.annaul_fee.ToString(),
                    ch.renew_fee == 0 ? "null" : ch.renew_fee.ToString(),
                    ch.channel_type, ch.user_id, ch.model_in, ch.notify_sms, ch.erp_id);

                return Int32.Parse(_accessMySql.getDataTable(strSql).Rows[0][0].ToString());
            }
            catch (Exception ex)
            {
                throw new Exception("ChannelDao-->Save-->" + ex.Message, ex);
            }
          
        }
Example #6
0
        public int Delete(Channel ch)
        {
            try
            {
                return _chDao.Delete(ch);
            }
            catch (Exception ex)
            {
                throw new Exception("ChannelMgr-->Delete-->" + ex.Message, ex);
            }

        }
Example #7
0
        public int SaveOther(Channel ch)
        {

            try
            {
                return _chDao.SaveOther(ch);
            }
            catch (Exception ex)
            {
                throw new Exception("ChannelMgr-->SaveOther-->" + ex.Message, ex);
            }
        }
Example #8
0
        public int Edit(Channel ch)
        {

            try
            {
                return _chDao.Edit(ch);
            }
            catch (Exception ex)
            {
                throw new Exception("ChannelMgr-->Edit-->" + ex.Message, ex);
            }
        }
Example #9
0
        public int Save(Channel ch)
        {

            try
            {
                return _chDao.Save(ch);
            }
            catch (Exception ex)
            {
                throw new Exception("ChannelMgr-->SingleCompareSave-->" + ex.Message, ex);
            }
        }
Example #10
0
 public List<Channel> GetChannelList(Channel query)
 {
     StringBuilder sql = new StringBuilder();
     try
     {
         sql.AppendFormat(@"SELECT c.channel_id,c.channel_name_simple,c.channel_name_full FROM channel c");
         return _dbAccess.getDataTableForObj<Channel>(sql.ToString());
     }
     catch (Exception ex)
     {
         throw new Exception("OrderMasterDao-->GetChannelList -->" + ex.Message + sql.ToString(), ex);
     }
 }
        /// <summary>
        /// 獲取賣場列表
        /// </summary>
        /// <returns></returns>
        public HttpResponseBase GetChannel()
        {
            string json = String.Empty;
            List<Channel> store = new List<Channel>();

            try
            {
                Channel channel = new Channel();
                _channelMgr = new ChannelMgr(mySqlConnectionString);
                store = _channelMgr.QueryList(0);
                channel.channel_id = 0;
                channel.channel_name_simple = "全部";
                store.Insert(0, channel);
                IsoDateTimeConverter timeConverter = new IsoDateTimeConverter();
                //这里使用自定义日期格式,如果不使用的话,默认是ISO8601格式     
                timeConverter.DateTimeFormat = "yyyy-MM-dd";
                json = "{success:true,data:" + JsonConvert.SerializeObject(store, Formatting.Indented, timeConverter) + "}";//返回json數據
            }
            catch (Exception ex)
            {
                Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage();
                logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message);
                logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
                log.Error(logMessage);
                json = "{success:false,data:[]}";
            }
            this.Response.Clear();
            this.Response.Write(json);
            this.Response.End();
            return this.Response;
        }
Example #12
0
        public List<Channel> GetChannelList(Channel query)
        {
            try
            {
                return _orderMasterDao.GetChannelList(query);
            }
            catch (Exception ex)
            {

                throw new Exception("OrderMasterMgr-->GetChannelList-->" + ex.Message, ex);
            }
        }