コード例 #1
0
        public string CeliName(string Name, string Language)
        {
            if (Session[Util.ProjectConfig.ADMINUSER] == null)
            {
                return("");
            }

            return(RateManager.CeliName(Name, Language).ToString());
        }
コード例 #2
0
        public string UpdateRate(string Id, string Name, string uName, string Rate, string Language)
        {
            if (Session[Util.ProjectConfig.ADMINUSER] == null)
            {
                return("");
            }

            string json = "";

            if (Name != uName)
            {
                if (RateManager.CeliName(Name, Language))
                {
                    json = "stop";
                }
            }
            if (json != "stop")
            {
                Model.Rate rate = new Model.Rate();
                if (Language == "cn")
                {
                    rate.Name_cn = Name;
                }
                if (Language == "tw")
                {
                    rate.Name_tw = Name;
                }
                if (Language == "en")
                {
                    rate.Name_en = Name;
                }
                if (Language == "th")
                {
                    rate.Name_th = Name;
                }
                if (Language == "vn")
                {
                    rate.Name_vn = Name;
                }
                rate.Id       = Convert.ToInt32(Id);
                rate.Rate1    = Convert.ToDecimal(Rate);
                rate.Lasttime = DateTime.Now;
                Model.Manager m = Session[ProjectConfig.ADMINUSER] as Model.Manager;
                rate.Operator = m.ManagerId;
                string strHostName = Dns.GetHostName();
                System.Net.IPAddress[] addressList = Dns.GetHostByName(Dns.GetHostName()).AddressList;
                rate.Ip = addressList[0].ToString();
                bool reval = BLL.RateManager.UpdateRate(rate);

                if (reval)
                {
                    bool ret = BLL.RatehistoryManager.AddRatehistory(rate);
                    if (ret)
                    {
                        Rates rates = new Rates();
                        rates.Name     = Name;
                        rates.Rate     = Convert.ToDecimal(Rate);
                        rates.Lasttime = DateTime.Now;
                        rates.Operator = m.ManagerId;
                        rates.Ip       = addressList[0].ToString();
                        json           = DAL.ObjectToJson.ObjectsToJson <Rates>(rates);
                    }
                    else
                    {
                        json = "none";
                    }
                }
            }

            return(json);
        }