public JsonResult GetUserInfo()
        {
            try
            {
                UsersMgr _userMgr = new UsersMgr(mySqlConnectionString);
                BLL.gigade.Model.Custom.Users userQuery = new BLL.gigade.Model.Custom.Users();
                if (!string.IsNullOrEmpty(Request.Params["name"].ToString()))
                {
                    userQuery.user_name = Request.Params["name"].ToString();

                    List<UserQuery> store = _userMgr.Query(userQuery);

                    return Json(store);
                }
                else
                {
                    return 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);
                return Json("[]");
            }

        }
        public HttpResponseBase SaveChannel()
        {
            zMgr = new ZipMgr(connectString);
            chMgr = new ChannelMgr(connectString);
            uMgr = new UsersMgr(connectString);

            string json = string.Empty;
            bool result = false;
            string channel_id = Request.Form["channel_id"] ?? string.Empty;
            try
            {
                if (!string.IsNullOrEmpty(Request.Form["channel_status"]))
                {
                    ch.channel_status = Int32.Parse(Request.Form["channel_status"].ToString());
                }

                if (!string.IsNullOrEmpty(Request.Form["channel_type"]))
                {
                    ch.channel_type = Int32.Parse(Request.Form["channel_type"].ToString());
                }

                if (!string.IsNullOrEmpty(Request.Form["channel_name_full"]))
                {
                    ch.channel_name_full = Request.Form["channel_name_full"].ToString();
                    u.user_name = Request.Form["channel_name_full"].ToString();
                    List<Channel> channel = chMgr.QueryC(" and channel_name_full='" + Request.Form["channel_name_full"] + "'");
                    if (channel != null && channel.Count > 0 && channel.Where(m => m.channel_id == int.Parse(string.IsNullOrEmpty(channel_id) ? "0" : channel_id)).Count() == 0)
                    {
                        json = "{success:true,msg:\""+Resources.Channel.CHANNEL_HAS_EXIST+"。\",channelId:\"" + channel_id + "\"}";

                        this.Response.Clear();
                        this.Response.Write(json);
                        this.Response.End();
                        return this.Response;
                    }
                }

                if (!string.IsNullOrEmpty(Request.Form["channel_name_simple"]))
                {
                    ch.channel_name_simple = Request.Form["channel_name_simple"].ToString();
                }

                if (!string.IsNullOrEmpty(Request.Form["channel_invoice"]))
                {
                    ch.channel_invoice = Request.Form["channel_invoice"].ToString();
                    u.user_password = Request.Form["channel_invoice"].ToString();
                }

                if (!string.IsNullOrEmpty(Request.Form["channel_email"]))
                {
                    ch.channel_email = Request.Form["channel_email"].ToString();
                }
                else
                {
                    ch.channel_email = "";
                }

                if (!string.IsNullOrEmpty(Request.Form["company_cphonenum"]))
                {
                    ch.company_phone = Request.Form["company_cphone"].ToString() +Request.Form["company_cphonenum"].ToString();
                }
                else
                {
                    ch.company_phone = "";
                }

                if (!string.IsNullOrEmpty(Request.Form["company_cfaxnum"]))
                {
                    ch.company_fax = Request.Form["company_cfax"].ToString() +Request.Form["company_cfaxnum"].ToString();
                }
                else
                {
                    ch.company_fax = "";
                }

                if (!string.IsNullOrEmpty(Request.Form["company_zip"]))
                {
                    ch.company_zip = Int32.Parse(Request.Form["company_zip"].ToString());
                }
                else
                {
                    ch.company_zip = 0;
                }

                if (!string.IsNullOrEmpty(Request.Form["company_address"]))
                {
                    ch.company_address = Request.Form["company_address"].ToString();
                }
                else
                {
                    ch.company_address = "";
                }

                if (!string.IsNullOrEmpty(Request.Form["invoice_title"]))
                {
                    ch.invoice_title = Request.Form["invoice_title"].ToString();
                }

                if (!string.IsNullOrEmpty(Request.Form["invoice_zip"]))
                {
                    ch.invoice_zip = Int32.Parse(Request.Form["invoice_zip"].ToString());
                }

                if (!string.IsNullOrEmpty(Request.Form["invoice_address"]))
                {
                    ch.invoice_address = Request.Form["invoice_address"].ToString();
                }

                if (!string.IsNullOrEmpty(Request.Form["contract_createdate"]))
                {
                    ch.contract_createdate = DateTime.Parse(Request.Form["contract_createdate"].ToString());
                }
                else
                {
                    ch.contract_createdate = DateTime.MinValue;
                }

                if (!string.IsNullOrEmpty(Request.Form["contract_start"]))
                {
                    ch.contract_start = DateTime.Parse(Request.Form["contract_start"].ToString());
                }
                else
                {
                    ch.contract_start = DateTime.MinValue;
                }

                if (!string.IsNullOrEmpty(Request.Form["contract_end"]))
                {
                    ch.contract_end = DateTime.Parse(Request.Form["contract_end"].ToString());
                }
                else
                {
                    ch.contract_end = DateTime.MinValue;
                }

                if (!string.IsNullOrEmpty(Request.Form["annaul_fee"]))
                {
                    ch.annaul_fee = Decimal.Parse(Request.Form["annaul_fee"].ToString());
                }
                else
                {
                    ch.annaul_fee = 0;
                }

                if (!string.IsNullOrEmpty(Request.Form["renew_fee"]))
                {
                    ch.renew_fee = Decimal.Parse(Request.Form["renew_fee"].ToString());
                }
                else
                {
                    ch.renew_fee = 0;
                }

                if (!string.IsNullOrEmpty(Request.Form["model_in"]))
                {
                    ch.model_in = Request.Form["model_in"].ToString();
                }
                else
                {
                    ch.model_in = "1";
                }

                if (!string.IsNullOrEmpty(Request.Form["notify_sms"]))
                {
                    ch.notify_sms = Int32.Parse(Request.Form["notify_sms"].ToString());
                }
                else
                {
                    ch.notify_sms = 0;
                }

                //add by xiangwang0413w 2014/06/26 增加 ERP客戶代號
                if (!string.IsNullOrEmpty(Request.Form["erp_id"]))
                {
                    ch.erp_id = Request.Form["erp_id"];
                }

                DataTable dtUsers = uMgr.Query(Request.Form["manager_Email"].ToString());
                if (dtUsers.Rows.Count > 0)//會員信箱已存在
                {
                    DataTable dtUserId = chMgr.QueryUser(dtUsers.Rows[0]["user_id"].ToString());
                    if (string.IsNullOrEmpty(channel_id))//新增
                    {                        
                        if (dtUserId.Rows.Count > 0)//是否被外站使用
                        {
                            json = "{success:true,msg:\""+Resources.Channel.MAIL_WAS_USED+"。\",channelId:\"" + channel_id + "\"}";

                            this.Response.Clear();
                            this.Response.Write(json);
                            this.Response.End();
                            return this.Response;
                        }
                        else
                        {
                            ch.user_id = Int32.Parse(dtUsers.Rows[0]["user_id"].ToString());
                            channel_id = chMgr.Save(ch).ToString();
                            result = Int32.Parse(channel_id) > 0;
                        }
                    }                    
                    else
                    {
                        //修改
                        if (dtUserId.Rows.Count > 0)
                        {
                            if (dtUserId.Rows[0]["channel_id"].ToString() != channel_id)
                            {
                                json = "{success:true,msg:\"" + Resources.Channel.MAIL_WAS_USED + "。\",channelId:\"" + channel_id + "\"}";

                                this.Response.Clear();
                                this.Response.Write(json);
                                this.Response.End();
                                return this.Response;
                            }
                            else
                            {
                                ch.user_id = Int32.Parse(dtUsers.Rows[0]["user_id"].ToString());
                            }
                        }
                        else
                        {
                            ch.user_id = Int32.Parse(dtUsers.Rows[0]["user_id"].ToString());
                        }

                        ch.channel_id = Int32.Parse(channel_id);

                        result = chMgr.Edit(ch) > 0;
                    }
                }
                else
                {
                    //會員信箱不存在
                    u.user_email = Request.Form["manager_Email"].ToString();
                    u.user_name = Request.Form["channel_name_full"].ToString();

                    BLL.gigade.Common.HashEncrypt hash = new BLL.gigade.Common.HashEncrypt();
                    u.user_password = hash.SHA256Encrypt(Request.Form["invoice_title"].ToString());

                    u.user_mobile = "0227833183";
                    u.user_phone = "0227833183";
                    u.user_zip = 115;
                    u.user_address = Resources.Channel.USER_ADDRESS;
                    u.user_status = 1;
                    u.user_reg_date = (int)BLL.gigade.Common.CommonFunction.GetPHPTime();
                    u.user_updatedate = (int)BLL.gigade.Common.CommonFunction.GetPHPTime();
                    u.user_birthday_year = 1900;
                    u.user_birthday_month = 01;
                    u.user_birthday_day = 01;

                    if (uMgr.SelSaveID(u) > 0)
                    {
                        ch.user_id = Convert.ToInt32(u.user_id);
                    }
                    if (string.IsNullOrEmpty(channel_id))
                    {
                        channel_id=chMgr.Save(ch).ToString();
                        /**
                         *如果外站類型是gigade,則將參數表中type=deliver_store(即所有物流方式)全部插入channel_shipping表中
                         ***/
                        if (ch.channel_type == 2)
                        {
                            paraMgr = new ParameterMgr(connectString);
                            chsMgr = new ChannelShippingMgr(connectString);
                            List<Parametersrc> Deliver_result = paraMgr.QueryUsed(new Parametersrc { ParameterType = "deliver_store", Used = 1 });
                            foreach (Parametersrc item in Deliver_result)
                            {
                                chs.channel_id = int.Parse(channel_id);
                                chs.shipping_carrior = int.Parse(item.ParameterCode);
                                chs.shipco = item.parameterName;
                                chsMgr.Save(chs);
                            }

                        }
                        /*
                         end by zhongyu0304w at 2013/10/10
                         */
                        result = Int32.Parse(channel_id) > 0;
                    }
                    else
                    {
                        ch.channel_id = int.Parse(channel_id);
                        result = chMgr.Edit(ch) > 0;
                    }
                }

                
                if (result)
                {
                    
                    json = "{success:true,msg:\""+Resources.Channel.SUCCESS+"。\",channelId:\"" + channel_id + "\"}";
                }
                else
                {
                    json = "{success:true,msg:\""+Resources.Channel.FAILED+"\",channelId:\"" + channel_id + "\"}";
                }
            }
            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:true,msg:\"" + Resources.Channel.FAILED + "\",channelId:\"" + channel_id + "\"}";
            }

            this.Response.Clear();
            this.Response.Write(json);
            this.Response.End();
            return this.Response;
        }