Example #1
0
 public HttpResponseBase GetQuestionTypeList()
 {
     IParametersrcImplMgr parametersrcMgr = new BLL.gigade.Mgr.ParameterMgr(mySqlConnectionString);
     List<Parametersrc> parametersrclist = new List<Parametersrc>();
     string json = string.Empty;
     try
     {
         string type = "problem_category";
         parametersrclist = parametersrcMgr.GetElementType(type);
         json = "{success:true,data:" + JsonConvert.SerializeObject(parametersrclist) + "}";//返回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}";
     }
     this.Response.Clear();
     this.Response.Write(json);
     this.Response.End();
     return this.Response;
 }
Example #2
0
        public HttpResponseBase GetVendorType()
        {
            string vendorType = "";
            if (!string.IsNullOrEmpty(Request.Params["VendorType"]))
            {
                vendorType = Request.Params["VendorType"];
            }
            List<Parametersrc> list = new List<Parametersrc>();
            paraMgr = new ParameterMgr(connectionString);
            string types = "vendor_type";
            list = paraMgr.GetElementType(types);
            string VendorTypeName = "";



            string jsonStr = string.Empty;
            try
            {
                if (!string.IsNullOrEmpty(vendorType))
                {
                    string[] vendor_types = vendorType.Split(',');
                    for (int i = 0; i < vendor_types.Length; i++)
                    {
                        for (int j = 0; j < list.Count; j++)
                        {
                            if (list[j].ParameterCode == vendor_types[i].ToString())
                            {
                                VendorTypeName += list[j].parameterName + ",";
                            }
                        }

                    }
                    VendorTypeName = VendorTypeName.Substring(0, VendorTypeName.Length - 1);
                }

                jsonStr = "{success:true,msg:\"" + VendorTypeName + "\"}";

            }
            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);
                jsonStr = "{success:false}";
            }
            this.Response.Clear();
            this.Response.Write(jsonStr);
            this.Response.End();
            return this.Response;
        }
Example #3
0
        public HttpResponseBase GetVendorTypeStore()
        {
            paraMgr = new ParameterMgr(connectionString);
            List<Parametersrc> store = new List<Parametersrc>();
            string json = string.Empty;
            List<VendorQuery> query = new List<VendorQuery>();
            try
            {
                string type = "vendor_type";
                store = paraMgr.GetElementType(type);
                for (int i = 0; i < store.Count; i++)
                {
                    VendorQuery vendor = new VendorQuery();
                    vendor.vendor_type = store[i].ParameterCode.ToString();
                    vendor.vendor_type_name = store[i].parameterName.ToString();
                    query.Add(vendor);

                }
                json = "{success:true,data:" + JsonConvert.SerializeObject(query, Formatting.Indented) + "}";
            }
            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 = "無預覽信息";
            }
            this.Response.Clear();
            this.Response.Write(json);
            this.Response.End();
            return this.Response;
        }
Example #4
0
        /// <summary>
        /// 獲取供應商列表數據
        /// </summary>
        /// <returns></returns>
        public HttpResponseBase GetVendorList()
        {
            List<VendorQuery> stores = new List<VendorQuery>();
            string json = string.Empty;

            try
            {
                _vendorMgr = new VendorMgr(connectionString);
                #region 搜索條件
                VendorQuery query = new VendorQuery();
                query.Start = Convert.ToInt32(Request.Params["start"] ?? "0");//用於分頁的變量
                query.Limit = Convert.ToInt32(Request.Params["limit"] ?? "25");//用於分頁的變量


                if (!string.IsNullOrEmpty(Request.Params["relation_id"]))
                {
                    query.vendor_id = Convert.ToUInt32(Request.Params["relation_id"].ToString());
                }
                if (!string.IsNullOrEmpty(Request.Params["VendorId"]))
                {
                    query.vendor_id = Convert.ToUInt32(Request.Params["VendorId"].ToString());
                }
                string type = string.Empty;
                string con = string.Empty;

                if (!string.IsNullOrEmpty(Request.Params["dateType"]))
                {
                    type = Request.Params["dateType"].ToString();
                }
                if (!string.IsNullOrEmpty(Request.Params["dateCon"]))
                {
                    con = Request.Params["dateCon"].ToString();
                }
                int totalCount = 0;
                if (!string.IsNullOrEmpty(type) && !string.IsNullOrEmpty(con) && type != "0")
                {//當查詢條件和查詢內容都有值時執行
                    switch (type)
                    {
                        case "0":
                            break;
                        case "1":
                            query.searchEmail = con.ToLower();
                            break;
                        case "2":
                            query.searchName = con;
                            break;
                        case "3":
                            query.vendor_name_full = con;
                            break;
                        case "4":
                            query.searchInvoice = con;
                            break;
                        case "5":
                            query.erp_id = con;
                            break;
                        case "6":
                            uint isTranUint = 0;
                            if (uint.TryParse(con, out isTranUint))
                            {
                                query.vendor_id = Convert.ToUInt32(con);
                            }
                            break;
                        case "7":
                            query.vendor_code = con;
                            break;
                    }
                    if (!string.IsNullOrEmpty(Request.Params["vendortype"]))//供应商类型
                    {
                        query.vendor_type = Request.Params["vendortype"].ToString();
                        query.vendor_type = query.vendor_type.TrimEnd(',');
                    }
                    if (!string.IsNullOrEmpty(Request.Params["dateOne"]))
                    {
                        // query.create_dateOne = (uint)CommonFunction.GetPHPTime(Convert.ToDateTime(Request.Params["dateOne"]).ToString("yyyy-MM-dd 00:00:00"));
                        query.create_dateOne = (uint)CommonFunction.GetPHPTime(Request.Params["dateOne"]);
                    }
                    if (!string.IsNullOrEmpty(Request.Params["dateTwo"]))
                    {
                        //query.create_dateTwo = (uint)CommonFunction.GetPHPTime(Convert.ToDateTime(Request.Params["dateTwo"]).ToString("yyyy-MM-dd 23:59:59"));
                        query.create_dateTwo = (uint)CommonFunction.GetPHPTime(Request.Params["dateTwo"]);
                    }
                    stores = _vendorMgr.Query(query, ref totalCount);
                }
                else
                { //當查詢條件和查詢內容都沒有值時執行
                    if (!string.IsNullOrEmpty(Request.Params["vendortype"]))//供应商类型
                    {
                        query.vendor_type = Request.Params["vendortype"].ToString();
                        query.vendor_type = query.vendor_type.TrimEnd(',');
                    }
                    if (!string.IsNullOrEmpty(Request.Params["dateOne"]))
                    {
                        //query.create_dateOne = (uint)CommonFunction.GetPHPTime(Convert.ToDateTime(Request.Params["dateOne"]).ToString("yyyy-MM-dd 00:00:00"));
                        query.create_dateOne = (uint)CommonFunction.GetPHPTime(Request.Params["dateOne"]);
                    }
                    if (!string.IsNullOrEmpty(Request.Params["dateTwo"]))
                    {
                        //query.create_dateTwo = (uint)CommonFunction.GetPHPTime(Convert.ToDateTime(Request.Params["dateTwo"]).ToString("yyyy-MM-dd 23:59:59"));
                        query.create_dateTwo = (uint)CommonFunction.GetPHPTime(Request.Params["dateTwo"]);
                    }
                    stores = _vendorMgr.Query(query, ref totalCount);
                }
                #endregion
                #region 供應商類型參數
                List<Parametersrc> list = new List<Parametersrc>();
                paraMgr = new ParameterMgr(connectionString);
                string types = "vendor_type";
                list = paraMgr.GetElementType(types);
                #endregion


                foreach (var item in stores)
                {
                    item.vendor_name_full = Server.HtmlDecode(Server.HtmlDecode(item.vendor_name_full));
                    item.vendor_name_simple = Server.HtmlDecode(Server.HtmlDecode(item.vendor_name_simple));
                    string temp = string.Empty;

                    #region 供應商類型關聯參數表
                    if (!string.IsNullOrEmpty(item.vendor_type) && item.vendor_type != null)
                    {
                        string[] vendor_types = item.vendor_type.Split(',');
                        for (int i = 0; i < vendor_types.Length; i++)
                        {
                            for (int j = 0; j < list.Count; j++)
                            {
                                if (list[j].ParameterCode == vendor_types[i].ToString())
                                {
                                    item.vendor_type_name += list[j].parameterName + ",";
                                }
                            }

                        }
                        item.vendor_type_name = item.vendor_type_name.Substring(0, item.vendor_type_name.Length - 1);
                    }
                    #endregion
                    if (item.self_send_days == 0)
                    {
                        if (item.stuff_ware_days == 0)
                        {
                            if (item.dispatch_days == 0)
                            {
                                temp = "";
                            }
                            else
                            {
                                temp = "調度";
                            }
                        }
                        else
                        {
                            if (item.dispatch_days == 0)
                            {
                                temp = "寄倉";
                            }
                            else
                            {
                                temp = "寄倉,調度";
                            }
                        }
                    }
                    else
                    {
                        if (item.stuff_ware_days == 0)
                        {
                            if (item.dispatch_days == 0)
                            {
                                temp = "自出";
                            }
                            else
                            {
                                temp = "自出,調度";
                            }
                        }
                        else
                        {
                            if (item.dispatch_days == 0)
                            {
                                temp = "自出,寄倉";
                            }
                            else
                            {
                                temp = "自出,寄倉,調度";
                            }
                        }
                    }
                    item.vendor_mode = temp;

                    if (Convert.ToBoolean(Request.Params["isSecret"]))
                    {

                        if (!string.IsNullOrEmpty(item.vendor_name_full))
                        {
                            item.vendor_name_full = item.vendor_name_full.Substring(0, 1) + "**";
                        }
                        //
                        if (!string.IsNullOrEmpty(item.vendor_name_simple))
                        {
                            item.vendor_name_simple = item.vendor_name_simple.Substring(0, 1) + "**";
                        }//vendor_company_address
                        if (item.vendor_company_address.ToString().Length > 3)
                        {
                            item.vendor_company_address = item.vendor_company_address.Substring(0, 3) + "***";
                        }
                        else
                        {
                            item.vendor_company_address = item.vendor_company_address + "***";
                        }
                        if (!string.IsNullOrEmpty(item.contact_email_1))
                        {
                            item.contact_email_1 = item.contact_email_1.Split('@')[0] + "@***";
                        }
                        if (!string.IsNullOrEmpty(item.contact_email_2))
                        {
                            item.contact_email_2 = item.contact_email_2.Split('@')[0] + "@***";
                        }
                        if (!string.IsNullOrEmpty(item.contact_email_3))
                        {
                            item.contact_email_3 = item.contact_email_3.Split('@')[0] + "@***";
                        }
                        if (!string.IsNullOrEmpty(item.contact_email_4))
                        {
                            item.contact_email_4 = item.contact_email_4.Split('@')[0] + "@***";
                        }
                        if (!string.IsNullOrEmpty(item.contact_email_5))
                        {
                            item.contact_email_5 = item.contact_email_5.Split('@')[0] + "@***";
                        }


                        if (item.contact_mobile_1.ToString().Length > 3)
                        {
                            item.contact_mobile_1 = item.contact_mobile_1.Substring(0, 3) + "***";
                        }
                        else
                        {
                            item.contact_mobile_1 = item.contact_mobile_1 + "***";
                        }
                        if (item.contact_mobile_2.ToString().Length > 3)
                        {
                            item.contact_mobile_2 = item.contact_mobile_2.Substring(0, 3) + "***";
                        }
                        else
                        {
                            item.contact_mobile_2 = item.contact_mobile_2 + "***";
                        }
                        if (item.contact_mobile_3.ToString().Length > 3)
                        {
                            item.contact_mobile_3 = item.contact_mobile_3.Substring(0, 3) + "***";
                        }
                        else
                        {
                            item.contact_mobile_3 = item.contact_mobile_3 + "***";
                        }
                        if (item.contact_mobile_4.ToString().Length > 3)
                        {
                            item.contact_mobile_4 = item.contact_mobile_4.Substring(0, 3) + "***";
                        }
                        else
                        {
                            item.contact_mobile_4 = item.contact_mobile_4 + "***";
                        }
                        if (item.contact_mobile_5.ToString().Length > 3)
                        {
                            item.contact_mobile_5 = item.contact_mobile_5.Substring(0, 3) + "***";
                        }
                        else
                        {
                            item.contact_mobile_5 = item.contact_mobile_5 + "***";
                        }

                        if (item.contact_phone_1_1.ToString().Length > 3)
                        {
                            item.contact_phone_1_1 = item.contact_phone_1_1.Substring(0, 3) + "***";
                        }
                        else
                        {
                            item.contact_phone_1_1 = item.contact_phone_1_1 + "***";
                        }
                        if (item.contact_phone_1_2.ToString().Length > 3)
                        {
                            item.contact_phone_1_2 = item.contact_phone_1_2.Substring(0, 3) + "***";
                        }
                        else
                        {
                            item.contact_phone_1_2 = item.contact_phone_1_2 + "***";
                        }
                        if (item.contact_phone_1_3.ToString().Length > 3)
                        {
                            item.contact_phone_1_3 = item.contact_phone_1_3.Substring(0, 3) + "***";
                        }
                        else
                        {
                            item.contact_phone_1_3 = item.contact_phone_1_3 + "***";
                        }
                        if (item.contact_phone_1_4.ToString().Length > 3)
                        {
                            item.contact_phone_1_4 = item.contact_phone_1_4.Substring(0, 3) + "***";
                        }
                        else
                        {
                            item.contact_phone_1_4 = item.contact_phone_1_4 + "***";
                        }
                        if (item.contact_phone_1_5.ToString().Length > 3)
                        {
                            item.contact_phone_1_5 = item.contact_phone_1_5.Substring(0, 3) + "***";
                        }
                        else
                        {
                            item.contact_phone_1_5 = item.contact_phone_1_5 + "***";
                        }


                        if (item.contact_phone_2_1.ToString().Length > 3)
                        {
                            item.contact_phone_2_1 = item.contact_phone_2_1.Substring(0, 3) + "***";
                        }
                        else
                        {
                            item.contact_phone_2_1 = item.contact_phone_2_1 + "***";
                        }
                        if (item.contact_phone_2_2.ToString().Length > 3)
                        {
                            item.contact_phone_2_2 = item.contact_phone_2_2.Substring(0, 3) + "***";
                        }
                        else
                        {
                            item.contact_phone_2_2 = item.contact_phone_2_2 + "***";
                        }
                        if (item.contact_phone_2_3.ToString().Length > 3)
                        {
                            item.contact_phone_2_3 = item.contact_phone_2_3.Substring(0, 3) + "***";
                        }
                        else
                        {
                            item.contact_phone_2_3 = item.contact_phone_2_3 + "***";
                        }
                        if (item.contact_phone_2_4.ToString().Length > 3)
                        {
                            item.contact_phone_2_4 = item.contact_phone_2_4.Substring(0, 3) + "***";
                        }
                        else
                        {
                            item.contact_phone_2_4 = item.contact_phone_2_4 + "***";
                        }
                        if (item.contact_phone_2_5.ToString().Length > 3)
                        {
                            item.contact_phone_2_5 = item.contact_phone_2_5.Substring(0, 3) + "***";
                        }
                        else
                        {
                            item.contact_phone_2_5 = item.contact_phone_2_5 + "***";
                        }

                        if (!string.IsNullOrEmpty(item.contact_name_1))
                        {
                            item.contact_name_1 = item.contact_name_1.Substring(0, 1) + "**";
                        }
                        if (!string.IsNullOrEmpty(item.contact_name_2))
                        {
                            item.contact_name_2 = item.contact_name_2.Substring(0, 1) + "**";
                        }
                        if (!string.IsNullOrEmpty(item.contact_name_3))
                        {
                            item.contact_name_3 = item.contact_name_3.Substring(0, 1) + "**";
                        }
                        if (!string.IsNullOrEmpty(item.contact_name_4))
                        {
                            item.contact_name_4 = item.contact_name_4.Substring(0, 1) + "**";
                        }
                        if (!string.IsNullOrEmpty(item.contact_name_5))
                        {
                            item.contact_name_5 = item.contact_name_5.Substring(0, 1) + "**";
                        }

                        if (!string.IsNullOrEmpty(item.manage_name))
                        {
                            item.manage_name = item.manage_name.Substring(0, 1) + "**";
                        }
                        if (!string.IsNullOrEmpty(item.manage_email))
                        {
                            item.manage_email = item.manage_email.Split('@')[0] + "@***";
                        }
                        if (!string.IsNullOrEmpty(item.vendor_email))
                        {
                            item.vendor_email = item.vendor_email.Split('@')[0] + "@***";
                        }
                        if (!string.IsNullOrEmpty(item.company_person))
                        {
                            item.company_person = item.company_person.Substring(0, 1) + "**";
                        }
                        if (item.company_address.ToString().Length > 3)
                        {
                            item.company_address = item.company_address.Substring(0, 3) + "***";
                        }
                        else
                        {
                            item.company_address = item.company_address + "***";
                        }
                        if (item.invoice_address.ToString().Length > 3)
                        {
                            item.invoice_address = item.invoice_address.Substring(0, 3) + "***";
                        }
                        else
                        {
                            item.invoice_address = item.invoice_address + "***";
                        }
                    }
                }
                IsoDateTimeConverter timeConverter = new IsoDateTimeConverter();
                //这里使用自定义日期格式,如果不使用的话,默认是ISO8601格式     
                timeConverter.DateTimeFormat = "yyyy-MM-dd HH:mm:ss";
                json = "{success:true,totalCount:" + totalCount + ",data:" + JsonConvert.SerializeObject(stores, 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,totalCount:0,data:[]}";
            }
            this.Response.Clear();
            this.Response.Write(json);
            this.Response.End();
            return this.Response;
        }