public HttpResponseBase GetVipLevel()
        {
            DataTable _dt = new DataTable();
            string json = string.Empty;
            try
            {
                _memberMgr = new MemberLevelMgr(mySqlConnectionString);
                _dt = _memberMgr.GetLevel();
                VipUserGroup Dmodel = new VipUserGroup();
                json = "{success:true,data:" + JsonConvert.SerializeObject(_dt) + "}";//返回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:true,totalCount:0,data:[]}";
            }
            this.Response.Clear();
            this.Response.Write(json);
            this.Response.End();
            return this.Response;
        }
Esempio n. 2
0
 public List<VipUserGroup> QueryAll(VipUserGroup query)
 {
     List<VipUserGroup> list = new List<VipUserGroup>();
     StringBuilder sb = new StringBuilder();
     sb.Append(@"select  group_id,group_name,domain,tax_id,image_name,gift_bonus,createdate,group_category,bonus_rate,bonus_expire_day,eng_name,check_iden from vip_user_group");
     return _accessMySql.getDataTableForObj<VipUserGroup>(sb.ToString());
 }
Esempio n. 3
0
 /// <summary>
 /// vip_user_group數據增加
 /// </summary>
 /// <param name="userGroup"></param>
 /// <returns></returns>
 public int Insert(VipUserGroup userGroup)
 {
     try
     {
         return _vipUserGroup.Insert(userGroup);
     }
     catch (Exception ex)
     {
         throw new Exception("VipUserGroupMgr.Insert-->" + ex.Message, ex);
     }
 }
Esempio n. 4
0
 public string GetVuserCount(VipUserGroup query)
 {
     try
     {
         return _vipUserGroup.GetVuserCount(query);
     }
     catch (Exception ex)
     {
         throw new Exception("VipUserGroupMgr.GetVuserCount-->" + ex.Message, ex);
     }
 }
        /// <summary>
        /// 獲取會員分組
        /// </summary>
        /// <returns></returns>
        public HttpResponseBase GetVipGroup()
        {
            List<VipUserGroup> stores = new List<VipUserGroup>();
            string json = string.Empty;
            try
            {
                int totalCount = 0;
                stores = _vipGroupMgr.GetAllUserGroup();
                VipUserGroup Dmodel = new VipUserGroup();
                Dmodel.group_id = 0;
                Dmodel.group_name = "不分";
                stores.Insert(0, Dmodel);//使會員群組的第一行為不分
                json = "{success:true,totalCount:" + totalCount + ",data:" + JsonConvert.SerializeObject(stores) + "}";//返回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:true,totalCount:0,data:[]}";
            }
            this.Response.Clear();
            this.Response.Write(json);
            this.Response.End();
            return this.Response;
        }
 public HttpResponseBase GetVipUserGroup()
 {
     string json = string.Empty;
     List<VipUserGroup> store = new List<VipUserGroup>();
     VipUserGroup vu = new VipUserGroup();
     try
     {
         _IOrderUserMgr = new OrderUserReduceMgr(mySqlConnectionString);
         store = _IOrderUserMgr.GetVipUserGroupStore();
         vu.group_id = 0;
         vu.group_name = "所有群組會員";
         store.Insert(0, vu);
         json = "{success:true,data:" + JsonConvert.SerializeObject(store, 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 = "{success:true,totalCount:0,data:[]}";
     }
     this.Response.Clear();
     this.Response.Write(json);
     this.Response.End();
     return this.Response;
 }
Esempio n. 7
0
 /// <summary>
 /// vip_user_group數據的編輯更新
 /// </summary>
 /// <param name="userGroup"></param>
 /// <returns></returns>
 public int Update(VipUserGroup userGroup)
 {
     try
     {
         return _vipUserGroup.Update(userGroup);
     }
     catch (Exception ex)
     {
         throw new Exception("VipUserGroupMgr.Update-->" + ex.Message, ex);
     }
 }
Esempio n. 8
0
        //  [HttpPost]
        public HttpResponseBase SaveVipUserGroup()
        {
            NameValueCollection param = Request.Params;
            VipUserGroup userGroup = new VipUserGroup();
            string json = string.Empty;
            bool size = true;
            Serial serial = new Serial();
            _userGroupMgr = new VipUserGroupMgr(mySqlConnectionString);
            _ISerImplMgr = new SerialMgr(mySqlConnectionString);
            serial = _ISerImplMgr.GetSerialById(72);
            string path = Server.MapPath(xmlPath);
            SiteConfigMgr _siteConfigMgr = new SiteConfigMgr(path);
            SiteConfig extention_config = _siteConfigMgr.GetConfigByName("PIC_Extention_Format");
            SiteConfig minValue_config = _siteConfigMgr.GetConfigByName("PIC_Length_MinValue");
            SiteConfig maxValue_config = _siteConfigMgr.GetConfigByName("PIC_Length_MaxValue");
            SiteConfig admin_userName = _siteConfigMgr.GetConfigByName("ADMIN_USERNAME");
            SiteConfig admin_passwd = _siteConfigMgr.GetConfigByName("ADMIN_PASSWD");
            //擴展名、最小值、最大值
            string extention = extention_config.Value == "" ? extention_config.DefaultValue : extention_config.Value;
            string minValue = minValue_config.Value == "" ? minValue_config.DefaultValue : minValue_config.Value;
            string maxValue = maxValue_config.Value == "" ? maxValue_config.DefaultValue : maxValue_config.Value;
            string localPromoPath = imgLocalPath + promoPath;//圖片存儲地址
            Random rand = new Random();
            int newRand = rand.Next(1000, 9999);

            string NewName = string.Empty;//當前文件名
            string fileExtention = string.Empty;//當前文件的擴展名
            string NewFileName = string.Empty;
            FileManagement fileLoad = new FileManagement();
            try
            {
                #region 新增
                if (String.IsNullOrEmpty(param["group_id"]))
                {
                    if (!string.IsNullOrEmpty(Request.Form["group_name"]))
                    {
                        userGroup.group_name = Request.Form["group_name"].ToString();
                    }
                    if (!string.IsNullOrEmpty(Request.Form["tax_id"]))
                    {
                        userGroup.tax_id = Request.Form["tax_id"].ToString();
                    }
                    if (!string.IsNullOrEmpty(Request.Form["eng_name"]))
                    {
                        userGroup.eng_name = Request.Form["eng_name"].ToString();
                    }
                    if (!string.IsNullOrEmpty(Request.Form["gift_bonus"]))
                    {
                        userGroup.gift_bonus = Convert.ToUInt32(Request.Form["gift_bonus"]);
                    }
                    if (!string.IsNullOrEmpty(Request.Form["group_category"]))
                    {
                        userGroup.group_category = Convert.ToUInt32(Request.Form["group_category"]);
                    }

                    siteConfigMgr = new SiteConfigMgr(Server.MapPath(xmlPath));
                    try
                    {
                        if (Request.Files["image_name"] != null && Request.Files["image_name"].ContentLength > 0)
                        {
                            HttpPostedFileBase file = Request.Files["image_name"];
                            if (file.ContentLength > int.Parse(minValue) * 1024 && file.ContentLength < int.Parse(maxValue) * 1024)
                            {
                                NewName = Path.GetFileName(file.FileName);
                                bool result = false;
                                //獲得文件的後綴名
                                fileExtention = NewName.Substring(NewName.LastIndexOf(".")).ToLower();
                                //新的文件名是隨機數字
                                BLL.gigade.Common.HashEncrypt hash = new BLL.gigade.Common.HashEncrypt();
                                NewFileName = hash.Md5Encrypt(newRand.ToString(), "32") + fileExtention;
                                NewName = NewFileName;
                                string ServerPath = string.Empty;
                                //判斷目錄是否存在,不存在則創建
                                string[] mapPath = new string[1];
                                mapPath[0] = promoPath.Substring(1, promoPath.Length - 2);
                                string jian = localPromoPath.Substring(0, localPromoPath.Length - promoPath.Length + 1);
                                CreateFolder(localPromoPath.Substring(0, localPromoPath.Length - promoPath.Length + 1), mapPath);
                                NewFileName = localPromoPath + NewFileName;//絕對路徑
                                ServerPath = Server.MapPath(imgLocalServerPath + promoPath);
                                string ErrorMsg = string.Empty;
                                //上傳
                                result = fileLoad.UpLoadFile(file, ServerPath, NewFileName, extention, int.Parse(maxValue), int.Parse(minValue), ref ErrorMsg, ftpuser, ftppwd);
                                if (result)
                                {
                                    userGroup.image_name = NewName;
                                }

                            }
                            else
                            {
                                size = false;
                            }
                        }

                    }

                    catch (Exception)
                    {
                        userGroup.image_name = string.Empty;
                    }
                    if (!string.IsNullOrEmpty(Request.Params["check_iden"]))
                    {
                        userGroup.check_iden = int.Parse(Request.Params["check_iden"]);
                    }
                    userGroup.createdate = (uint)CommonFunction.GetPHPTime(DateTime.Now.ToString());
                    userGroup.group_id = uint.Parse((serial.Serial_Value + 1).ToString());
                    if (_userGroupMgr.Insert(userGroup) > 0)
                    {
                        serial.Serial_Value = serial.Serial_Value + 1;/*所在操作表的列增加*/
                        _ISerImplMgr.Update(serial);/*修改所在的表的列對應的值*/
                        if (size)
                        {
                            json = "{success:true,msg:\"" + "" + "\"}";
                        }
                        else
                        {
                            json = "{success:true,msg:\"" + " 文件大小應大於1KB小於100KB!" + "\"}";
                        }
                    }
                    else
                    {
                        json = "{success:false,msg:\"" + "新增失敗!" + "\"}";
                    }

                }
                #endregion
                #region 編輯
                else
                {
                    _userGroupMgr = new VipUserGroupMgr(mySqlConnectionString);
                    userGroup.group_id = Convert.ToUInt32(param["group_id"]);
                    VipUserGroup oldUserGroup = _userGroupMgr.GetModelById(userGroup.group_id);
                    if (!string.IsNullOrEmpty(Request.Form["group_name"]))
                    {
                        userGroup.group_name = Request.Form["group_name"].ToString();
                    }
                    if (!string.IsNullOrEmpty(Request.Form["tax_id"]))
                    {
                        userGroup.tax_id = Request.Form["tax_id"].ToString();
                    }

                    if (!string.IsNullOrEmpty(Request.Form["eng_name"]))
                    {
                        userGroup.eng_name = Request.Form["eng_name"].ToString();
                    }
                    if (!string.IsNullOrEmpty(Request.Form["gift_bonus"]))
                    {
                        userGroup.gift_bonus = Convert.ToUInt32(Request.Form["gift_bonus"]);
                    }
                    if (!string.IsNullOrEmpty(Request.Form["group_category"]))
                    {
                        userGroup.group_category = Convert.ToUInt32(Request.Form["group_category"]);
                    }
                    try
                    {
                        //如果圖片沒有改變
                        if (Request.Form["image_name"] == oldUserGroup.image_name)
                        {
                            userGroup.image_name = Request.Form["image_name"];
                        }
                        else
                        {
                            //圖片改變了
                            if (Request.Files["image_name"] != null && Request.Files["image_name"].ContentLength > 0)
                            {
                                HttpPostedFileBase file = Request.Files["image_name"];
                                if (file.ContentLength > int.Parse(minValue) * 1024 && file.ContentLength < int.Parse(maxValue) * 1024)
                                {
                                    NewName = Path.GetFileName(file.FileName);
                                    bool result = false;

                                    //獲得文件的後綴名
                                    fileExtention = NewName.Substring(NewName.LastIndexOf(".")).ToLower();
                                    //新的文件名是隨機數字
                                    BLL.gigade.Common.HashEncrypt hash = new BLL.gigade.Common.HashEncrypt();
                                    NewFileName = hash.Md5Encrypt(newRand.ToString(), "32") + fileExtention;
                                    NewName = NewFileName;
                                    string ServerPath = string.Empty;
                                    //判斷目錄是否存在,不存在則創建
                                    string[] mapPath = new string[1];
                                    mapPath[0] = promoPath.Substring(1, promoPath.Length - 2);
                                    string jian = localPromoPath.Substring(0, localPromoPath.Length - promoPath.Length + 1);
                                    CreateFolder(localPromoPath.Substring(0, localPromoPath.Length - promoPath.Length + 1), mapPath);
                                    //  returnName += promoPath + NewFileName;
                                    NewFileName = localPromoPath + NewFileName;//絕對路徑
                                    ServerPath = Server.MapPath(imgLocalServerPath + promoPath);
                                    string ErrorMsg = string.Empty;
                                    //上傳之前刪除已有的圖片
                                    string oldFileName = oldUserGroup.image_name;
                                    //FTP ftp = new FTP(localPromoPath, ftpuser, ftppwd);
                                    //List<string> tem = ftp.GetFileList();
                                    //上傳
                                    result = fileLoad.UpLoadFile(file, ServerPath, NewFileName, extention, int.Parse(maxValue), int.Parse(minValue), ref ErrorMsg, ftpuser, ftppwd);
                                    if (result)
                                    {
                                        userGroup.image_name = NewName;

                                        if (System.IO.File.Exists(ServerPath + oldFileName))
                                        {
                                            FTP ftps = new FTP(localPromoPath + oldFileName, ftpuser, ftppwd);
                                            if (System.IO.File.Exists(localPromoPath + oldFileName))
                                            {
                                                ftps.DeleteFile(localPromoPath + oldFileName);//刪除ftp:71.159上的舊圖片
                                            }
                                            DeletePicFile(ServerPath + oldFileName);//刪除本地圖片
                                        }
                                    }
                                    else
                                    {
                                        userGroup.image_name = oldUserGroup.image_name;
                                    }
                                }
                                else
                                {
                                    size = false;
                                    userGroup.image_name = oldUserGroup.image_name;
                                }
                            }
                        }
                    }

                    catch (Exception)
                    {
                        userGroup.image_name = oldUserGroup.image_name;
                    }
                    try
                    {
                        userGroup.check_iden = int.Parse(Request.Params["check_iden"]);
                    }
                    catch (Exception)
                    {
                        userGroup.check_iden = 0;
                    }
                    if (_userGroupMgr.Update(userGroup) > 0)
                    {
                        if (size)
                        {
                            json = "{success:true,msg:\"" + "" + "\"}";
                        }
                        else
                        {
                            json = "{success:true,msg:\"" + " 文件大小應大於1KB小於100KB!" + "\"}";
                        }
                    }
                    else
                    {
                        json = "{success:false,msg:\"" + "修改失敗!" + "\"}";
                    }

                }
                #endregion
            }
            catch (Exception ex)
            {
                json = "{success:false,msg:\"" + "異常" + "\"}";
                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);

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

        }
Esempio n. 9
0
        /// <summary>
        /// 名單數
        /// </summary>
        /// <param name="query">根據group_id查詢</param>
        /// <returns></returns>
        public string GetVuserCount(VipUserGroup query)
        {
            string sql = string.Format("select count(v_id) as search_total from vip_user where 1=1 and group_id={0}", query.group_id);
            try
            {
                DataTable vuser = _accessMySql.getDataTable(sql);
                if (vuser.Rows.Count > 0)
                {
                    return vuser.Rows[0]["search_total"].ToString();
                }
                else
                {
                    return "";
                }
            }
            catch (Exception ex)
            {
                throw new Exception("VipUserGroupDao.GetVuserCount-->" + ex.Message + sql, ex);
            }

        }
Esempio n. 10
0
 /// <summary>
 /// 更新vip_user_group表中的數據
 /// </summary>
 /// <param name="userGroup"></param>
 /// <returns></returns>
 public int Update(VipUserGroup userGroup)
 {
     StringBuilder sql = new StringBuilder();
     try
     {
         sql.AppendFormat(@"update vip_user_group set group_name='{0}',tax_id='{1}',image_name='{2}',", userGroup.group_name, userGroup.tax_id, userGroup.image_name);
         sql.AppendFormat(@"gift_bonus={0},group_category={1},eng_name='{2}',", userGroup.gift_bonus, userGroup.group_category, userGroup.eng_name);
         sql.AppendFormat(@"check_iden={0} where 1=1 and group_id={1}", userGroup.check_iden, userGroup.group_id);
         return _accessMySql.execCommand(sql.ToString());
     }
     catch (Exception ex)
     {
         throw new Exception("VipUserGroupDao.Update-->" + ex.Message + sql.ToString(), ex);
     }
 }
Esempio n. 11
0
 /// <summary>
 /// 向vip_user_group表中插入數據
 /// </summary>
 /// <param name="userGroup"></param>
 /// <returns></returns>
 public int Insert(VipUserGroup userGroup)
 {
     StringBuilder sql = new StringBuilder();
     try
     {
         sql.AppendFormat(@"insert into vip_user_group(group_id,group_name,tax_id,image_name,gift_bonus,group_category,eng_name,check_iden,createdate) ");
         sql.AppendFormat(@"values({0},'{1}','{2}',", userGroup.group_id, userGroup.group_name, userGroup.tax_id);
         sql.AppendFormat(@"'{0}',{1},{2},", userGroup.image_name, userGroup.gift_bonus, userGroup.group_category);
         sql.AppendFormat(@"'{0}',{1},{2} )", userGroup.eng_name, userGroup.check_iden, userGroup.createdate);
         return _accessMySql.execCommand(sql.ToString());
     }
     catch (Exception ex)
     {
         throw new Exception("VipUserGroupDao.Insert-->" + ex.Message + sql.ToString(), ex);
     }
 }