Пример #1
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="query"></param>
        /// <param name="totalCount"></param>
        /// <returns></returns>
        public List<OrderQuestionQuery> GetOrderQuestionList(OrderQuestionQuery query, out int totalCount)
        {
            try
            {
                List<OrderQuestionQuery> _list = _oqdao.GetOrderQuestionList(query, out totalCount);
                if (_list.Count > 0)
                {
                    ParametersrcDao _parameterDao = new Dao.ParametersrcDao(connStr);
                    List<Parametersrc> parameterList = _parameterDao.QueryParametersrcByTypes("Question_Status", "problem_category");
                    foreach (OrderQuestionQuery dr in _list)
                    {
                        //求參數
                        var alist = parameterList.Find(m => m.ParameterType == "Question_Status" && m.ParameterCode == dr.question_status.ToString());
                        var clist = parameterList.Find(m => m.ParameterType == "problem_category" && m.ParameterCode == dr.question_type.ToString());
                        if (alist != null)
                        {
                            dr.question_status_name = alist.parameterName;
                        }
                        if (clist != null)
                        {
                            dr.question_type_name = clist.parameterName;
                        }
                    }
                }
                return _list;

            }
            catch (Exception ex)
            {
                throw new Exception("OrderQuestionMgr-->GetOrderQuestionList-->" + ex.Message, ex);
            }
        }
Пример #2
0
        /// <summary>
        /// 獲取ShippingCarrior表的list
        /// </summary>
        /// <param name="sc">查詢條件</param>
        /// <param name="totalCount">頁數</param>
        /// <returns></returns>
        public System.Data.DataTable GetShippingCarriorList(Model.Query.ShippingCarriorQuery sc, out int totalCount)
        {
            try
            {
                DataTable _list = _shippingCarriorDao.GetShippingCarriorList(sc, out totalCount);

                if (_list.Rows.Count > 0)
                {
                    _list.Columns.Add("freight_big_area_name");
                    _list.Columns.Add("freight_type_name");
                    _list.Columns.Add("delivery_store_name");
                    ParametersrcDao _parameterDao = new Dao.ParametersrcDao(connStr);
                    List<Parametersrc> parameterList = _parameterDao.QueryParametersrcByTypes("freight_big_area", "freight_type", "Deliver_Store");
                    foreach (DataRow dr in _list.Rows)
                    {
                        //求參數
                        var alist = parameterList.Find(m => m.ParameterType == "freight_big_area" && m.ParameterCode == dr["freight_big_area"].ToString());
                        var blist = parameterList.Find(m => m.ParameterType == "freight_type" && m.ParameterCode == dr["freight_type"].ToString());
                        var clist = parameterList.Find(m => m.ParameterType == "Deliver_Store" && m.ParameterCode == dr["delivery_store_id"].ToString());
                        if (alist != null)
                        {
                            dr["freight_big_area_name"] = alist.parameterName;
                        }
                        if (blist != null)
                        {
                            dr["freight_type_name"] = blist.parameterName;
                        }
                        if (clist != null)
                        {
                            dr["delivery_store_name"] = clist.parameterName;
                        }
                    }
                }
                return _list;
            }
            catch (Exception ex)
            {
                throw new Exception("ShippingCarriorMgr-->GetShippingCarriorList-->" + ex.Message, ex);
            }
        }
Пример #3
0
 public DataTable GetOrderQuestionExcel(OrderQuestionQuery o)
 {
     try
     {
         DataTable _list = _oqdao.GetOrderQuestionExcel(o);
         if (_list.Rows.Count > 0)
         {
             ParametersrcDao _parameterDao = new Dao.ParametersrcDao(connStr);
             List<Parametersrc> parameterList = _parameterDao.QueryParametersrcByTypes("Question_Status", "problem_category");
             _list.Columns.Add("question_status_name");
             _list.Columns.Add("question_type_name");
             foreach (DataRow dr in _list.Rows)
             {
                 //求參數
                 var alist = parameterList.Find(m => m.ParameterType == "Question_Status" && m.ParameterCode == dr["question_status"].ToString());
                 var clist = parameterList.Find(m => m.ParameterType == "problem_category" && m.ParameterCode == dr["question_type"].ToString());
                 if (alist != null)
                 {
                     dr["question_status_name"] = alist.parameterName;
                 }
                 if (clist != null)
                 {
                     dr["question_type_name"] = clist.parameterName;
                 }
             }
         }
         return _list;
     }
     catch (Exception ex)
     {
         throw new Exception("OrderQuestionMgr-->GetOrderQuestionExcel-->" + ex.Message, ex);
     }
 }
Пример #4
0
        public Model.Custom.TableChangeLogCustom GetVendorChangeDetail(TableChangeLogQuery query)
        {
            try
            {
                DataTable _dt = _tclDao.GetVendorChangeDetail(query);
                Model.Custom.TableChangeLogCustom _model = new Model.Custom.TableChangeLogCustom();
                if (_dt.Rows.Count > 0)
                {
                    Dao.ParametersrcDao _pDao = new Dao.ParametersrcDao(connStr);
                    List<Model.Parametersrc> _pModel = _pDao.Query(new Model.Parametersrc { ParameterType = "ColumnChange", ParameterCode = "vendor" });
                    List<Model.Parametersrc> _slist = _pDao.QueryParametersrcByTypes("vendor_type");
                    if (_pModel.Count > 0)
                    {
                        _model.vendor_id = Convert.ToInt32(_dt.Rows[0]["vendor_id"].ToString());
                        _model.vendor_name_full = _dt.Rows[0]["vendor_name_full"].ToString();
                        List<Model.TableChangeLog> _list = new List<Model.TableChangeLog>();
                        foreach (DataRow dr in _dt.Rows)
                        {
                            Model.TableChangeLog _log = new Model.TableChangeLog();
                            _log.change_field = dr["change_field"].ToString();
                            if (_log.change_field == "vendor_status")
                            {
                                string[] status_str = { "", "啟用", "停用", "失格" };

                                _log.old_value = status_str[Convert.ToInt32(dr["old_value"].ToString())].ToString();
                                _log.new_value = status_str[Convert.ToInt32(dr["new_value"].ToString())].ToString();


                            }
                            else if (_log.change_field == "product_manage")
                            {

                                ManageUserMgr mu = new ManageUserMgr(connStr);
                                List<ManageUser> o_mlist = mu.GetManageUser(new ManageUser { user_id = Convert.ToUInt32(dr["old_value"].ToString()) });
                                List<ManageUser> n_mlist = mu.GetManageUser(new ManageUser { user_id = Convert.ToUInt32(dr["new_value"].ToString()) });
                                if (o_mlist.Count > 0)
                                {
                                    _log.old_value = o_mlist[0].user_username;
                                }
                                if (n_mlist.Count > 0)
                                {
                                    _log.new_value = n_mlist[0].user_username;
                                }
                            }
                            else if (_log.change_field.IndexOf("contact_type") > -1)
                            {
                                string[] type_str = { "", "負責人", "業務窗口", "圖/文窗口", "出貨負責窗口", "帳務連絡窗口", "客服窗口", "刪除" };

                                _log.old_value = type_str[Convert.ToInt32(dr["old_value"].ToString())].ToString();
                                if (dr["new_value"].ToString() != "")
                                {
                                    _log.new_value = type_str[Convert.ToInt32(dr["new_value"].ToString())].ToString();
                                }
                                else
                                {
                                    _log.new_value = type_str[0].ToString();
                                }
                            }
                            else if (_log.change_field == "vendor_type")//供應商類型
                            {
                                if (_slist.Count > 0)
                                {
                                    var a_o = dr["old_value"].ToString().Split(',');
                                    var a_n = dr["new_value"].ToString().Split(',');
                                    string l_o = ""; string l_n = "";
                                    for (int i = 0; i < a_o.Length; i++)
                                    {
                                        if (!string.IsNullOrEmpty(a_o[i].ToString()))
                                        {
                                            l_o = l_o + _slist.Find(m => m.ParameterCode == a_o[i].ToString()).parameterName + ",";
                                        }
                                    }
                                    for (int i = 0; i < a_n.Length; i++)
                                    {
                                        if (!string.IsNullOrEmpty(a_n[i].ToString()))
                                        {
                                            l_n = l_n + _slist.Find(m => m.ParameterCode == a_n[i].ToString()).parameterName + ",";

                                        }
                                    }
                                    _log.old_value = l_o.TrimEnd(',');
                                    _log.new_value = l_n.TrimEnd(',');
                                }
                            }
                            else if (_log.change_field == "company_address" || _log.change_field == "invoice_address")//公司地址或發票地址
                            {
                                string o_zip = dr["old_value"].ToString().Split('&')[0];
                                string o_adress = dr["old_value"].ToString().Substring(dr["old_value"].ToString().IndexOf('&') + 1);
                                string n_zip = dr["new_value"].ToString().Split('&')[0];
                                string n_adress = dr["new_value"].ToString().Substring(dr["new_value"].ToString().IndexOf('&') + 1);
                                ZipMgr zip = new ZipMgr(connStr);
                                _log.old_value = zip.Getaddress(Convert.ToInt32(o_zip)) + o_adress;
                                _log.new_value = zip.Getaddress(Convert.ToInt32(n_zip)) + n_adress;
                            }
                            else
                            {
                                _log.old_value = dr["old_value"].ToString();
                                _log.new_value = dr["new_value"].ToString();
                            }
                            if (!string.IsNullOrEmpty(dr["field_ch_name"].ToString()))
                            {
                                _log.field_ch_name = dr["field_ch_name"].ToString();
                            }
                            else
                            {
                                _log.field_ch_name = _pModel.Find(m => m.parameterName == _log.change_field).remark;
                            }

                            _list.Add(_log);

                        }
                        _model.tclModel = _list;
                    }
                }
                return _model;
            }
            catch (Exception ex)
            {
                throw new Exception("TableChangeLogMgr-->GetVendorChangeDetail-->" + ex.Message, ex);
            }
        }