Пример #1
1
 /// <summary>
 /// 分配角色模块菜单权限
 /// </summary>
 /// <param name="KeyValue">主键值</param>
 /// <param name="RoleId">角色主键</param>
 /// <param name="CreateUserId">操作用户主键</param>
 /// <param name="CreateUserName">操作用户</param>
 /// <returns></returns>
 public bool AddModulePermission(string[] KeyValue, string RoleId, string CreateUserId, string CreateUserName)
 {
     //return dal.AddModulePermission(KeyValue, RoleId, CreateUserId, CreateUserName) >= 0 ? true : false;
     StringBuilder[] sqls = new StringBuilder[KeyValue.Length + 1];
     object[] objs = new object[KeyValue.Length + 1];
     sqls[0] = SqlParamHelper.DeleteSql("AMS_RoleMenu", "RoleId");
     objs[0] = new SqlParam[] { new SqlParam("@RoleId", RoleId) };
     int index = 1;
     foreach (string item in KeyValue)
     {
         if (item.Length > 0)
         {
             AMS_RoleMenu entity = new AMS_RoleMenu();
             entity.RoleMenuId = CommonHelper.GetGuid;
             entity.RoleId = RoleId;
             entity.MenuId = item;
             entity.CreateUserId = CreateUserId;
             entity.CreateUserName = CreateUserName;
             sqls[index] = SqlParamHelper.InsertSql(entity);
             objs[index] = SqlParamHelper.GetParameter(entity);
             index++;
         }
     }
     int IsOK = DbHelper.BatchExecuteBySql(sqls, objs);
     return IsOK >= 0 ? true : false;
 }
Пример #2
0
 /// <summary>
 /// 设批量添加,菜单导航操作按钮关系
 /// </summary>
 /// <param name="KeyValue">主键值</param>
 /// <param name="MenuId">模块菜单主键</param>
 /// <param name="CreateUserId">操作用户主键</param>
 /// <param name="CreateUserName">操作用户</param>
 /// <returns></returns>
 public bool BatchAddMenuButton(string[] KeyValue, string MenuId, string CreateUserId, string CreateUserName)
 {
     //return dal.BatchAddMenuButton(KeyValue, MenuId, CreateUserId, CreateUserName) >= 0 ? true : false;
     StringBuilder[] sqls = new StringBuilder[KeyValue.Length + 1];
     object[] objs = new object[KeyValue.Length + 1];
     sqls[0] = SqlParamHelper.DeleteSql("AMS_SysMenuButton", "MenuId");
     objs[0] = new SqlParam[] { new SqlParam("@MenuId", MenuId) };
     int index = 1;
     foreach (string item in KeyValue)
     {
         if (item.Length > 0)
         {
             AMS_SysMenuButton entity = new AMS_SysMenuButton();
             entity.SysMenuButtonId = CommonHelper.GetGuid;
             entity.MenuId = MenuId;
             entity.ButtonId = item;
             entity.SortCode = index;
             entity.CreateUserId = CreateUserId;
             entity.CreateUserName = CreateUserName;
             sqls[index] = SqlParamHelper.InsertSql(entity);
             objs[index] = SqlParamHelper.GetParameter(entity);
             index++;
         }
     }
     int IsOK = DbHelper.BatchExecuteBySql(sqls, objs);
     return IsOK >= 0 ? true : false;
 }
Пример #3
0
 /// <summary>
 /// 获得数据列表(带条件)
 /// </summary>
 /// <param name="where">条件</param>
 /// <param name="param">参数化</param>
 /// <returns></returns>
 public IList GetListWhere(StringBuilder where, SqlParam[] param)
 {
     StringBuilder strSql = new StringBuilder();
     strSql.Append("SELECT * FROM AMS_ItemDetails WHERE 1=1");
     strSql.Append(where);
     strSql.Append(" Order BY SortCode");
     return DbHelper.GetDataListBySQL<AMS_ItemDetails>(strSql, param);
 }
Пример #4
0
 /// <summary>
 /// 自动补全(显示20行)
 /// </summary>
 /// <param name="where">条件</param>
 /// <param name="param">参数化</param>
 /// <returns></returns>
 public IList AutoComplete(StringBuilder where, SqlParam[] param)
 {
     StringBuilder strSql = new StringBuilder();
     strSql.Append(@"SELECT Account,RealName FROM AMS_User WHERE 1=1");
     strSql.Append(where);
     strSql.Append(DataPermission.Instance.User);
     strSql.Append(" ORDER BY CreateDate limit 0,10");
     return DbHelper.GetDataListBySQL<AMS_User>(strSql, param);
 }
Пример #5
0
 /// <summary>
 /// 自动补全(显示20行)
 /// </summary>
 /// <param name="where">条件</param>
 /// <param name="param">参数化</param>
 /// <returns></returns>
 public IList AutoComplete(StringBuilder where, SqlParam[] param)
 {
     StringBuilder strSql = new StringBuilder();
     strSql.Append(@"SELECT  UserId,RealName,Code FROM BASE_USER WHERE 1=1");
     strSql.Append(where);
     strSql.Append(DataPermission.Instance.User);
     strSql.Append(" ORDER BY CreateDate");
     return DbHelper.GetDataListBySQL<BASE_USER>(strSql, param);
 }
Пример #6
0
 /// <summary>
 /// 获得数据列表(带条件)
 /// </summary>
 /// <param name="where">条件</param>
 /// <param name="param">参数化</param>
 /// <returns></returns>
 public IList GetListWhere(StringBuilder where, SqlParam[] param)
 {
     StringBuilder strSql = new StringBuilder();
     strSql.Append("SELECT * FROM AMS_Organization WHERE 1=1");
     strSql.Append(where);
     strSql.Append(DataPermission.Instance.Organization);
     strSql.Append(" Order BY SortCode");
     return DbHelper.GetDataListBySQL<AMS_Organization>(strSql, param);
 }
Пример #7
0
 /// <summary>
 /// 获得数据列表(带条件)
 /// </summary>
 /// <param name="where">条件</param>
 /// <param name="param">参数化</param>
 /// <returns></returns>
 public IList GetListWhere(StringBuilder where, SqlParam[] param)
 {
     //return dal.GetListWhere(where, param);
     StringBuilder strSql = new StringBuilder();
     strSql.Append("SELECT * FROM BASE_COMPANY WHERE 1=1");
     //strSql.Append(where);
     //strSql.Append(DataPermission.Instance.Organization);
     strSql.Append(" Order BY SortCode");
     return DbHelper.GetDataListBySQL<BASE_COMPANY>(strSql, param);
 }
Пример #8
0
 /// <summary>
 /// 获得数据列表(带条件)
 /// </summary>
 /// <param name="where">条件</param>
 /// <param name="param">参数化</param>
 /// <returns></returns>
 public IList GetListWhere(StringBuilder where, SqlParam[] param)
 {
     StringBuilder strSql = new StringBuilder();
     strSql.Append(@"SELECT  M.*
                     FROM  BASE_MODULE M
                     WHERE 1=1");
     strSql.Append(where);
     strSql.Append(" Order BY SortCode");
     return DbHelper.GetDataListBySQL<BASE_MODULE>(strSql, param);
 }
Пример #9
0
    protected void OnSelectedIndexChanged_data_cardsale(object sender, EventArgs e)
    {
        RadioButtonList downlist = (RadioButtonList)sender;
        ListViewDataItem o = downlist.Parent as ListViewDataItem;

        int status = int.Parse(downlist.SelectedValue);
        int id = int.Parse((o.FindControl("idLabel") as Label).Text);

        String sql = "UPDATE [data_cardsale] SET [status] = @status WHERE [id] = @id";
        SqlParam data = new SqlParam { { "@id", id }, { "@status", status } };

        Database db = new Database();
        db.Exec(sql, data);
        db.Close();
    }
Пример #10
0
    protected void OnSelectedIndexChanged_data_notice(object sender, EventArgs e)
    {
        DropDownList n = (DropDownList)sender;
        ListViewDataItem o = n.Parent as ListViewDataItem;

        int status = int.Parse(n.SelectedValue);
        int id = int.Parse((o.FindControl("idLabel") as Label).Text);

        SqlParam data = new SqlParam { { "@id", id }, { "@status", status } };
        string sql = "UPDATE [data_notice] SET [status] = @status WHERE [id] = @id";

        Database db = new Database();
        db.Exec(sql, data);
        db.Close();
    }
Пример #11
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 /// <param name="KeyValue">主键</param>
 /// <returns></returns>
 public AMS_DataPermission GetEntity(StringBuilder where, SqlParam[] param)
 {
     AMS_DataPermission entity = new AMS_DataPermission();
     StringBuilder strSql = new StringBuilder();
     strSql.Append("SELECT  * FROM AMS_DataPermission WHERE 1=1");
     strSql.Append(where);
     DataTable dt = DbHelper.GetDataTableBySQL(strSql, param);
     if (dt.Rows.Count > 0)
     {
         return DbReader.ReaderToModel<AMS_DataPermission>(dt.Rows[0]);
     }
     else
     {
         return entity;
     }
 }
Пример #12
0
        /// <summary>
        /// 获取用户名
        /// </summary>
        /// <returns></returns>
        public static string GetName()
        {
            string sql = "SELECT username FROM userinfo WHERE id=@id";
            SqlParam data = new SqlParam { { "@id", GetId() } };
            Database db = new Database();
            SqlDataReader reader = db.Query(sql, data);
            string name = null;

            if (reader.Read()) {
                name = (string)reader["username"];
            }

            reader.Close();
            db.Close();

            return name;
        }
Пример #13
0
 /// <summary>
 /// 获得数据列表(带条件)
 /// </summary>
 /// <param name="where">条件</param>
 /// <param name="param">参数化</param>
 /// <returns></returns>
 public IList GetListWhere(StringBuilder where, SqlParam[] param)
 {
     StringBuilder strSql = new StringBuilder();
     strSql.Append(@"SELECT  * FROM
                     ( SELECT    R.RoleId ,
                                 R.Code ,
                                 R.OrganizationId,
                                 R.FullName ,
                                 I.ItemName AS Category ,
                                 R.Description ,
                                 R.AllowEdit ,
                                 R.AllowDelete ,
                                 R.Enabled
                       FROM      AMS_Roles R
                                 LEFT JOIN AMS_ItemDetails I ON R.Category = I.ItemCode
                       WHERE     I.ItemsId = '5fed1313-7355-4cc4-a7ec-73211a361fa6'
                     )A WHERE 1=1");
     strSql.Append(where);
     return DbHelper.GetDataListBySQL<AMS_Roles>(strSql, param);
 }
Пример #14
0
 /// <summary>
 /// 获得数据列表(带条件)
 /// </summary>
 /// <param name="where">条件</param>
 /// <param name="param">参数化</param>
 /// <returns></returns>
 public IList GetListWhere(StringBuilder where, SqlParam[] param)
 {
     StringBuilder strSql = new StringBuilder();
     strSql.Append(@"SELECT  M.MenuId ,
                         M.ParentId ,
                         M.Code ,
                         M.FullName ,
                         M.FullName_EN,
                         M.Description ,
                         M.Img ,
                         M.NavigateUrl ,
                         M.FormName ,
                         M.Target ,
                         M.IsUnfold ,
                         M.Enabled ,
                         M.SortCode ,
                         MA.FullName AS Category
                 FROM    AMS_SysMenu M
                         LEFT JOIN AMS_SysMenu MA ON MA.MenuId = M.ParentId WHERE 1=1");
     strSql.Append(where);
     strSql.Append(" Order BY SortCode");
     return DbHelper.GetDataListBySQL<AMS_SysMenu>(strSql, param);
 }
Пример #15
0
 // Token: 0x06000053 RID: 83 RVA: 0x00007374 File Offset: 0x00005574
 protected override void View()
 {
     if (this.ispost)
     {
         if (!this.isperm)
         {
             this.ShowErr("对不起,您没有权限操作。");
             return;
         }
         int     @int    = FPRequest.GetInt("appid");
         AppInfo appInfo = DbHelper.ExecuteModel <AppInfo>(@int);
         string  mapPath = FPUtils.GetMapPath(this.webpath + appInfo.installpath);
         if (this.action == "delete")
         {
             if (DbHelper.ExecuteDelete <AppInfo>(@int) > 0)
             {
                 foreach (string text in FPUtils.SplitString(appInfo.files))
                 {
                     if (text.StartsWith("bin/"))
                     {
                         if (File.Exists(FPUtils.GetMapPath(WebConfig.WebPath + text)))
                         {
                             File.Delete(FPUtils.GetMapPath(WebConfig.WebPath + text));
                         }
                     }
                     if (File.Exists(mapPath + "/" + text))
                     {
                         if (text.EndsWith(".sql"))
                         {
                             if (text.ToLower().EndsWith("access_un.sql") && DbConfigs.DbType == DbType.Access)
                             {
                                 string sqlstring = FPFile.ReadFile(mapPath + "/" + text);
                                 DbHelper.ExecuteSql(sqlstring);
                             }
                             else if (text.ToLower().EndsWith("sqlserver_un.sql") && DbConfigs.DbType == DbType.SqlServer)
                             {
                                 string sqlstring = FPFile.ReadFile(mapPath + "/" + text);
                                 DbHelper.ExecuteSql(sqlstring);
                             }
                         }
                         File.Delete(mapPath + "/" + text);
                     }
                 }
                 if (Directory.Exists(mapPath))
                 {
                     DirectoryInfo directoryInfo = new DirectoryInfo(mapPath);
                     if (directoryInfo.GetFiles().Length == 0)
                     {
                         directoryInfo.Delete(true);
                     }
                 }
                 SqlParam sqlParam = DbHelper.MakeAndWhere("appid", @int);
                 DbHelper.ExecuteDelete <SortAppInfo>(new SqlParam[]
                 {
                     sqlParam
                 });
             }
             FPCache.Remove("FP_SORTTREE");
             base.Response.Redirect("appmanage.aspx");
         }
     }
     this.applist = DbHelper.ExecuteList <AppInfo>(OrderBy.ASC);
     base.SaveRightURL();
 }
Пример #16
0
 // Token: 0x06000042 RID: 66 RVA: 0x000064B8 File Offset: 0x000046B8
 protected override void View()
 {
     this.examinfo = DbHelper.ExecuteModel <ExamInfo>(this.examid);
     if (this.examinfo.id == 0)
     {
         this.ShowErr("对不起,该试卷不存在或已被删除。");
     }
     else
     {
         this.sortid   = this.examinfo.sortid;
         this.sortinfo = SortBll.GetSortInfo(this.sortid);
         if (this.ispost)
         {
             if (this.action == "delete")
             {
                 string @string = FPRequest.GetString("chkid");
                 if (DbHelper.ExecuteDelete <ExamResult>(@string) > 0)
                 {
                     SqlParam sqlParam = DbHelper.MakeAndWhere("resultid", WhereType.In, @string);
                     DbHelper.ExecuteDelete <ExamResultTopic>(new SqlParam[]
                     {
                         sqlParam
                     });
                 }
             }
         }
         if (this.examinfo.examdeparts == "" && this.examinfo.examuser == "" && this.examinfo.examroles == "")
         {
             List <SqlParam> list = new List <SqlParam>();
             list.Add(DbHelper.MakeAndWhere("examid", this.examid));
             if (this.keyword != "")
             {
                 string          text      = "0";
                 SqlParam        sqlParam2 = DbHelper.MakeAndWhere(string.Format("([username] LIKE '%{0}%' OR [realname] LIKE '%{0}%')", this.keyword), WhereType.Custom, "");
                 List <UserInfo> list2     = DbHelper.ExecuteList <UserInfo>(new SqlParam[]
                 {
                     sqlParam2
                 });
                 foreach (UserInfo userInfo in list2)
                 {
                     if (text != "")
                     {
                         text += ",";
                     }
                     text += userInfo.id;
                 }
                 list.Add(DbHelper.MakeAndWhere("uid", WhereType.In, text));
             }
             if (this.action == "export")
             {
                 OrderByParam[] orderbys = new OrderByParam[]
                 {
                     DbHelper.MakeOrderBy("score", OrderBy.DESC),
                     DbHelper.MakeOrderBy("id", OrderBy.ASC)
                 };
                 this.examresultlist = DbHelper.ExecuteList <ExamResult>(orderbys, list.ToArray());
             }
             else
             {
                 this.examresultlist = DbHelper.ExecuteList <ExamResult>(this.pager, list.ToArray());
             }
         }
         else
         {
             string text = "";
             if (this.examinfo.examroles != "")
             {
                 SqlParam        sqlParam2 = DbHelper.MakeAndWhere("roleid", WhereType.In, this.examinfo.examroles);
                 List <UserInfo> list2     = DbHelper.ExecuteList <UserInfo>(new SqlParam[]
                 {
                     sqlParam2
                 });
                 foreach (UserInfo userInfo in list2)
                 {
                     if (!FPUtils.InArray(userInfo.id, text))
                     {
                         ExamResult examResult = new ExamResult();
                         examResult.uid    = userInfo.id;
                         examResult.examid = this.examid;
                         examResult.status = -1;
                         this.examresultlist.Add(examResult);
                         if (text != "")
                         {
                             text += ",";
                         }
                         text += userInfo.id;
                     }
                 }
             }
             if (this.examinfo.examdeparts != "")
             {
                 SqlParam        sqlParam2 = DbHelper.MakeAndWhere("departid", WhereType.In, this.examinfo.examdeparts);
                 List <UserInfo> list2     = DbHelper.ExecuteList <UserInfo>(new SqlParam[]
                 {
                     sqlParam2
                 });
                 foreach (UserInfo userInfo in list2)
                 {
                     if (!FPUtils.InArray(userInfo.id, text))
                     {
                         ExamResult examResult = new ExamResult();
                         examResult.uid    = userInfo.id;
                         examResult.examid = this.examid;
                         examResult.status = -1;
                         this.examresultlist.Add(examResult);
                         if (text != "")
                         {
                             text += ",";
                         }
                         text += userInfo.id;
                     }
                 }
             }
             if (this.examinfo.examuser != "")
             {
                 SqlParam        sqlParam2 = DbHelper.MakeAndWhere("id", WhereType.In, this.examinfo.examuser);
                 List <UserInfo> list2     = DbHelper.ExecuteList <UserInfo>(new SqlParam[]
                 {
                     sqlParam2
                 });
                 foreach (UserInfo userInfo in list2)
                 {
                     if (!FPUtils.InArray(userInfo.id, text))
                     {
                         ExamResult examResult = new ExamResult();
                         examResult.uid    = userInfo.id;
                         examResult.examid = this.examid;
                         examResult.status = -1;
                         this.examresultlist.Add(examResult);
                         if (text != "")
                         {
                             text += ",";
                         }
                         text += userInfo.id;
                     }
                 }
             }
             SqlParam          sqlParam3 = DbHelper.MakeAndWhere("examid", this.examid);
             OrderByParam      orderby   = DbHelper.MakeOrderBy("id", OrderBy.ASC);
             List <ExamResult> list3     = DbHelper.ExecuteList <ExamResult>(orderby, new SqlParam[]
             {
                 sqlParam3
             });
             int num = 0;
             foreach (ExamResult examResult2 in this.examresultlist)
             {
                 foreach (ExamResult examResult3 in list3)
                 {
                     if (examResult3.uid == examResult2.uid)
                     {
                         this.examresultlist[num].id           = examResult3.id;
                         this.examresultlist[num].score        = examResult3.score;
                         this.examresultlist[num].starttime    = examResult3.starttime;
                         this.examresultlist[num].examdatetime = examResult3.examdatetime;
                         this.examresultlist[num].utime        = examResult3.utime;
                         this.examresultlist[num].status       = examResult3.status;
                         this.examresultlist[num].questions++;
                         this.examresultlist[num].ip = examResult3.ip;
                     }
                 }
                 num++;
             }
             if (this.keyword != "")
             {
                 list3 = new List <ExamResult>();
                 foreach (ExamResult examResult2 in this.examresultlist)
                 {
                     if (examResult2.IUser.username.Contains(this.keyword) || examResult2.IUser.realname.Contains(this.keyword))
                     {
                         list3.Add(examResult2);
                     }
                 }
                 this.examresultlist = new List <ExamResult>();
                 foreach (ExamResult examResult2 in list3)
                 {
                     this.examresultlist.Add(examResult2);
                 }
             }
             if (this.action != "export" && this.action != "report")
             {
                 this.pager.total = this.examresultlist.Count;
                 int num2  = (this.pager.pageindex - 1) * this.pager.pagesize;
                 int count = this.pager.pagesize;
                 if (num2 + this.pager.pagesize > this.pager.total)
                 {
                     count = this.pager.total - num2;
                 }
                 this.examresultlist = this.examresultlist.GetRange(num2, count);
             }
         }
         if (this.ispost)
         {
             if (this.action == "export")
             {
                 HSSFWorkbook  hssfworkbook  = new HSSFWorkbook();
                 HSSFSheet     hssfsheet     = hssfworkbook.CreateSheet("Sheet1");
                 HSSFCellStyle hssfcellStyle = hssfworkbook.CreateCellStyle();
                 hssfcellStyle.Alignment         = CellHorizontalAlignment.CENTER;
                 hssfcellStyle.VerticalAlignment = CellVerticalAlignment.CENTER;
                 hssfcellStyle.BorderTop         = CellBorderType.THIN;
                 hssfcellStyle.BorderRight       = CellBorderType.THIN;
                 hssfcellStyle.BorderLeft        = CellBorderType.THIN;
                 hssfcellStyle.BorderBottom      = CellBorderType.THIN;
                 hssfcellStyle.DataFormat        = 0;
                 HSSFFont hssffont = hssfworkbook.CreateFont();
                 hssffont.Boldweight = short.MaxValue;
                 hssfcellStyle.SetFont(hssffont);
                 HSSFRow hssfrow = hssfsheet.CreateRow(0);
                 hssfrow.CreateCell(0).SetCellValue("用户名");
                 hssfrow.CreateCell(1).SetCellValue("姓名");
                 hssfrow.CreateCell(2).SetCellValue("所在部门");
                 hssfrow.CreateCell(3).SetCellValue("考试得分");
                 hssfrow.CreateCell(4).SetCellValue("开始时间");
                 hssfrow.CreateCell(5).SetCellValue("考试用时");
                 hssfrow.CreateCell(6).SetCellValue("考试状态");
                 hssfrow.CreateCell(7).SetCellValue("");
                 hssfrow.Height = 400;
                 hssfsheet.SetColumnWidth(2, 6000);
                 hssfsheet.SetColumnWidth(4, 6000);
                 for (int i = 0; i < 7; i++)
                 {
                     hssfrow.Cells[i].CellStyle = hssfcellStyle;
                 }
                 HSSFCellStyle hssfcellStyle2 = hssfworkbook.CreateCellStyle();
                 hssfcellStyle2.Alignment         = CellHorizontalAlignment.CENTER;
                 hssfcellStyle2.VerticalAlignment = CellVerticalAlignment.CENTER;
                 hssfcellStyle2.BorderTop         = CellBorderType.THIN;
                 hssfcellStyle2.BorderRight       = CellBorderType.THIN;
                 hssfcellStyle2.BorderLeft        = CellBorderType.THIN;
                 hssfcellStyle2.BorderBottom      = CellBorderType.THIN;
                 hssfcellStyle2.DataFormat        = 0;
                 int num3 = 1;
                 foreach (ExamResult examResult2 in this.examresultlist)
                 {
                     HSSFRow hssfrow2 = hssfsheet.CreateRow(num3);
                     hssfrow2.Height = 300;
                     hssfrow2.CreateCell(0).SetCellValue(examResult2.IUser.username);
                     hssfrow2.CreateCell(1).SetCellValue(examResult2.IUser.realname);
                     hssfrow2.CreateCell(2).SetCellValue(examResult2.IUser.Department.name);
                     hssfrow2.CreateCell(3).SetCellValue(examResult2.score.ToString());
                     if (examResult2.status >= 0)
                     {
                         hssfrow2.CreateCell(4).SetCellValue(examResult2.examdatetime.ToString("yyyy-MM-dd HH:mm:dd"));
                         hssfrow2.CreateCell(5).SetCellValue((examResult2.utime / 60 + 1).ToString() + "分钟");
                     }
                     else
                     {
                         hssfrow2.CreateCell(4).SetCellValue("");
                         hssfrow2.CreateCell(5).SetCellValue("");
                     }
                     if (examResult2.status == 1)
                     {
                         hssfrow2.CreateCell(6).SetCellValue("已交卷");
                     }
                     else if (examResult2.status == 2)
                     {
                         hssfrow2.CreateCell(6).SetCellValue("已阅卷");
                     }
                     else if (examResult2.status == 0)
                     {
                         hssfrow2.CreateCell(6).SetCellValue("未交卷");
                     }
                     else
                     {
                         hssfrow2.CreateCell(6).SetCellValue("缺考");
                     }
                     hssfrow2.CreateCell(7).SetCellValue("");
                     for (int i = 0; i < 7; i++)
                     {
                         hssfrow2.Cells[i].CellStyle = hssfcellStyle2;
                     }
                     num3++;
                 }
                 using (MemoryStream memoryStream = new MemoryStream())
                 {
                     hssfworkbook.Write(memoryStream);
                     memoryStream.Flush();
                     memoryStream.Position = 0L;
                     hssfsheet.Dispose();
                     hssfworkbook.Dispose();
                     base.Response.ContentType     = "application/vnd.ms-excel";
                     base.Response.ContentEncoding = Encoding.UTF8;
                     base.Response.Charset         = "";
                     base.Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(this.examinfo.name + "成绩表.xls"));
                     base.Response.BinaryWrite(memoryStream.GetBuffer());
                     base.Response.Flush();
                     base.Response.End();
                 }
             }
             else if (this.action == "report")
             {
                 AsposeWordApp asposeWordApp = new AsposeWordApp();
                 asposeWordApp.Open(FPUtils.GetMapPath("images\\examreport.doc"));
                 asposeWordApp.InsertText("examtitle", this.examinfo.name);
                 asposeWordApp.InsertText("username", this.user.realname);
                 asposeWordApp.InsertText("total", this.examinfo.total.ToString() + "分");
                 if (this.examinfo.islimit == 1)
                 {
                     asposeWordApp.InsertText("examtime", this.examinfo.starttime.ToString("yyyy-MM-dd HH:mm"));
                 }
                 else
                 {
                     asposeWordApp.InsertText("examtime", "不限制");
                 }
                 asposeWordApp.InsertText("exampass", (this.examinfo.passmark * this.examinfo.total / 100.0).ToString() + "分");
                 asposeWordApp.InsertText("qtime", this.examinfo.examtime.ToString() + "分钟");
                 asposeWordApp.InsertText("examuser", this.examinfo.exams.ToString() + "人");
                 if (this.examinfo.exams > 0)
                 {
                     asposeWordApp.InsertText("examavg", (this.examinfo.score / (double)this.examinfo.exams).ToString("0.0"));
                 }
                 else
                 {
                     asposeWordApp.InsertText("examavg", "0");
                 }
                 int[] array = new int[5];
                 foreach (ExamResult examResult2 in this.examresultlist)
                 {
                     if (examResult2.score < 60.0)
                     {
                         array[0]++;
                     }
                     else if (examResult2.score >= 60.0 && examResult2.score < 70.0)
                     {
                         array[1]++;
                     }
                     else if (examResult2.score >= 70.0 && examResult2.score < 80.0)
                     {
                         array[2]++;
                     }
                     else if (examResult2.score >= 80.0 && examResult2.score < 90.0)
                     {
                         array[3]++;
                     }
                     else if (examResult2.score >= 90.0)
                     {
                         array[4]++;
                     }
                 }
                 int i = 1;
                 foreach (int num4 in array)
                 {
                     asposeWordApp.InsertText("s" + i, num4.ToString() + "人");
                     asposeWordApp.InsertText("p" + i, (num4 / this.examinfo.exams * 100).ToString("0.0") + "%");
                     i++;
                 }
                 asposeWordApp.Save(base.Response, this.examinfo.name + "_考试分析报告.doc");
             }
         }
         base.SaveRightURL();
     }
 }
Пример #17
0
    /// <summary>
    /// 生成预定每日房价 - 国光
    /// </summary>
    /// <param name="adminHotelId"></param>
    /// <param name="hotelId"></param>
    /// <param name="orderNumber"></param>
    /// <param name="payType"></param>
    /// <param name="yddh"></param>
    /// <param name="yhje"></param>
    public static void SetDayPrice(string adminHotelId, string hotelId, string orderNumber, string payType, string yddh, string yhje)
    {
        double        yhMoney = CommonHelper.GetDouble(yhje);
        StringBuilder sb      = new StringBuilder();

        sb.Append("Select * From ReservationPriceDetail Where OrderNum = @OrderNum ");
        SqlParam[] parm = new SqlParam[] {
            new SqlParam("@OrderNum", orderNumber)
        };
        DataTable dt = DataFactory.SqlDataBase().GetDataTableBySQL(sb, parm);

        if (dt != null && dt.Rows.Count > 0)
        {
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                DateTime rq = CommonHelper.GetDateTime(dt.Rows[i]["DateRange"].ToString());
                double   fj = CommonHelper.GetDouble(dt.Rows[i]["Price"].ToString());
                string   bz = "";
                switch (payType)
                {
                case "1":
                    if (i == 0 && yhMoney > 0)
                    {
                        fj = fj - yhMoney;
                        bz = "优惠券抵扣" + yhMoney;
                    }
                    break;

                case "2":
                    fj = 0;
                    bz = "积分兑换";
                    break;

                case "3":
                    if (i == 0 && yhMoney > 0)
                    {
                        fj = fj - yhMoney;
                    }
                    bz = "会员卡支付";
                    break;

                case "4":
                    if (i == 0 && yhMoney > 0)
                    {
                        fj = fj - yhMoney;
                        bz = "优惠券抵扣" + yhMoney;
                    }
                    break;

                case "5":
                    fj = 0;
                    bz = "免费入住券";
                    break;

                case "6":
                    fj = 0;
                    bz = "预售券支付";
                    break;

                default:
                    break;
                }
                if (fj < 0)
                {
                    fj = 0;
                }
                Hashtable ht_mrfj = new Hashtable();
                ht_mrfj["yddh"] = yddh; //预订单号
                ht_mrfj["rq"]   = rq;   //日期
                ht_mrfj["fj"]   = fj;   //房价
                ht_mrfj["bz"]   = bz;   //备注
                DataFactory.SqlDataBase(adminHotelId, hotelId).InsertByHashtable("XX_yddhrqfj", ht_mrfj);
            }
        }
    }
Пример #18
0
 /// <summary>
 /// 获取记录总数(带条件)
 /// </summary>
 /// <param name="where">条件</param>
 /// <param name="param">参数化</param>
 /// <returns></returns>
 public int GetRecordCount(StringBuilder where, SqlParam[] param)
 {
     return DbUtils.RecordCount("BASE_USER", where, param);
 }
Пример #19
0
        public bool add_ItemForm(string[] item_value, string user_id)
        {
            bool result;

            try
            {
                StringBuilder[] sqls         = new StringBuilder[item_value.Length + 4];
                object[]        objs         = new object[item_value.Length + 4];
                StringBuilder   sbDelete_org = new StringBuilder();
                sbDelete_org.Append("Delete From Base_StaffOrganize Where User_ID =@User_ID");
                SqlParam[] parm_org = new SqlParam[]
                {
                    new SqlParam("@User_ID", user_id)
                };
                sqls[0] = sbDelete_org;
                objs[0] = parm_org;
                StringBuilder sbDelete_Role = new StringBuilder();
                sbDelete_Role.Append("Delete From Base_UserRole Where User_ID =@User_ID");
                SqlParam[] parm_Role = new SqlParam[]
                {
                    new SqlParam("@User_ID", user_id)
                };
                sqls[1] = sbDelete_Role;
                objs[1] = parm_Role;
                StringBuilder sbDelete_UserGroup = new StringBuilder();
                sbDelete_UserGroup.Append("Delete From Base_UserInfoUserGroup Where User_ID =@User_ID");
                SqlParam[] parm_UserGroup = new SqlParam[]
                {
                    new SqlParam("@User_ID", user_id)
                };
                sqls[2] = sbDelete_UserGroup;
                objs[2] = parm_UserGroup;
                StringBuilder sbDelete_Right = new StringBuilder();
                sbDelete_Right.Append("Delete From Base_UserRight Where User_ID =@User_ID");
                SqlParam[] parm_Right = new SqlParam[]
                {
                    new SqlParam("@User_ID", user_id)
                };
                sqls[3] = sbDelete_Right;
                objs[3] = parm_Right;
                int index = 4;
                for (int i = 0; i < item_value.Length; i++)
                {
                    string item = item_value[i];
                    if (item.Length > 0)
                    {
                        string[] str_item = item.Split(new char[]
                        {
                            '|'
                        });
                        string key  = str_item[0];
                        string type = str_item[1];
                        if (type == "所属部门")
                        {
                            StringBuilder sbadd = new StringBuilder();
                            sbadd.Append("Insert into Base_StaffOrganize(");
                            sbadd.Append("StaffOrganize_Id,Organization_ID,User_ID,CreateUserId,CreateUserName");
                            sbadd.Append(")Values(");
                            sbadd.Append("@StaffOrganize_Id,@Organization_ID,@User_ID,@CreateUserId,@CreateUserName)");
                            SqlParam[] parmAdd = new SqlParam[]
                            {
                                new SqlParam("@StaffOrganize_Id", CommonHelper.GetGuid),
                                new SqlParam("@Organization_ID", key),
                                new SqlParam("@User_ID", user_id),
                                new SqlParam("@CreateUserId", RequestSession.GetSessionUser().UserId),
                                new SqlParam("@CreateUserName", RequestSession.GetSessionUser().UserName)
                            };
                            sqls[index] = sbadd;
                            objs[index] = parmAdd;
                        }
                        else
                        {
                            if (type == "所属角色")
                            {
                                StringBuilder sbadd = new StringBuilder();
                                sbadd.Append("Insert into Base_UserRole(");
                                sbadd.Append("UserRole_ID,User_ID,Roles_ID,CreateUserId,CreateUserName");
                                sbadd.Append(")Values(");
                                sbadd.Append("@UserRole_ID,@User_ID,@Roles_ID,@CreateUserId,@CreateUserName)");
                                SqlParam[] parmAdd = new SqlParam[]
                                {
                                    new SqlParam("@UserRole_ID", CommonHelper.GetGuid),
                                    new SqlParam("@User_ID", user_id),
                                    new SqlParam("@Roles_ID", key),
                                    new SqlParam("@CreateUserId", RequestSession.GetSessionUser().UserId),
                                    new SqlParam("@CreateUserName", RequestSession.GetSessionUser().UserName)
                                };
                                sqls[index] = sbadd;
                                objs[index] = parmAdd;
                            }
                            else
                            {
                                if (type == "用户工作组")
                                {
                                    StringBuilder sbadd = new StringBuilder();
                                    sbadd.Append("Insert into Base_UserInfoUserGroup(");
                                    sbadd.Append("UserInfoUserGroup_ID,User_ID,UserGroup_ID,CreateUserId,CreateUserName");
                                    sbadd.Append(")Values(");
                                    sbadd.Append("@UserInfoUserGroup_ID,@User_ID,@UserGroup_ID,@CreateUserId,@CreateUserName)");
                                    SqlParam[] parmAdd = new SqlParam[]
                                    {
                                        new SqlParam("@UserInfoUserGroup_ID", CommonHelper.GetGuid),
                                        new SqlParam("@User_ID", user_id),
                                        new SqlParam("@UserGroup_ID", key),
                                        new SqlParam("@CreateUserId", RequestSession.GetSessionUser().UserId),
                                        new SqlParam("@CreateUserName", RequestSession.GetSessionUser().UserName)
                                    };
                                    sqls[index] = sbadd;
                                    objs[index] = parmAdd;
                                }
                                else
                                {
                                    if (type == "用户权限")
                                    {
                                        StringBuilder sbadd = new StringBuilder();
                                        sbadd.Append("Insert into Base_UserRight(");
                                        sbadd.Append("UserRight_ID,User_ID,Menu_Id,CreateUserId,CreateUserName");
                                        sbadd.Append(")Values(");
                                        sbadd.Append("@UserRight_ID,@User_ID,@Menu_Id,@CreateUserId,@CreateUserName)");
                                        SqlParam[] parmAdd = new SqlParam[]
                                        {
                                            new SqlParam("@UserRight_ID", CommonHelper.GetGuid),
                                            new SqlParam("@User_ID", user_id),
                                            new SqlParam("@Menu_Id", key),
                                            new SqlParam("@CreateUserId", RequestSession.GetSessionUser().UserId),
                                            new SqlParam("@CreateUserName", RequestSession.GetSessionUser().UserName)
                                        };
                                        sqls[index] = sbadd;
                                        objs[index] = parmAdd;
                                    }
                                }
                            }
                        }
                        index++;
                    }
                }
                result = (DataFactory.SqlDataBase().BatchExecuteBySql(sqls, objs) >= 0);
            }
            catch
            {
                result = false;
            }
            return(result);
        }
Пример #20
0
        private void downloadurl(HttpContext context)
        {
            if (DateTime.Now.Hour < 10)
            {
                return;
            }
            DateTime bill_date = DateTime.Now.AddDays(-1);

            if (!string.IsNullOrEmpty(context.Request["bill_date"]))
            {
                bill_date = CommonHelper.GetDateTime(context.Request["bill_date"]); //指定日期
            }
            else
            {
                StringBuilder sb_ck = new StringBuilder();
                sb_ck.Append(@"
                    SELECT TOP 1 Bill_Date
                    FROM    dbo.Hotel_Bill_Total
                    WHERE Bill_Date = @Bill_Date AND PaySource = 2 
                    ");
                SqlParam[] param_ck = new SqlParam[] {
                    new SqlParam("@Bill_Date", bill_date.ToString("yyyy-MM-dd"))
                };
                DataTable dt_ck = DataFactory.SqlDataBase().GetDataTableBySQL(sb_ck, param_ck);
                if (dt_ck != null && dt_ck.Rows.Count > 0)
                {
                    return;
                }
            }

            string     app_id               = Config.appId;
            string     serverUrl            = Config.serverUrl;
            string     merchant_private_key = Config.merchant_private_key;
            string     format               = "json";
            string     version              = Config.version;
            string     signType             = Config.signtype;
            string     alipay_public_key    = Config.alipay_public_key;
            string     charset              = Config.charset;
            IAopClient client               = new DefaultAopClient(serverUrl, app_id, merchant_private_key, format, version, signType, alipay_public_key, charset, false);

            StringBuilder sb = new StringBuilder();

            sb.Append(@"
            SELECT  *
            FROM    dbo.Alipay_PlatformUser
            WHERE   HotelId > 0
            ");
            DataTable dt = DataFactory.SqlDataBase().GetDataTableBySQL(sb);

            AlipayDataDataserviceBillDownloadurlQueryRequest request = new AlipayDataDataserviceBillDownloadurlQueryRequest();

            request.BizContent = "{" +
                                 "\"bill_type\":\"trade\"," +
                                 "\"bill_date\":\"" + bill_date.ToString("yyyy-MM-dd") + "\"" +
                                 "  }";
            if (dt != null && dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    string AdminHotelid = dt.Rows[i]["AdminHotelid"].ToString();      //集团ID
                    int    hotelid      = CommonHelper.GetInt(dt.Rows[i]["hotelid"]); //酒店ID
                    string appAuthToken = dt.Rows[i]["AppAuthToken"].ToString();      //集团ID
                    BillDownloadurl(context, client, AdminHotelid, hotelid, bill_date, appAuthToken, request);
                }
            }
            context.Response.Write("success");
        }
Пример #21
0
    protected void SelectedIndexChanged_datasettlement(object sender, EventArgs e)
    {
        DropDownList n = (DropDownList)sender;
        ListViewDataItem o = n.Parent as ListViewDataItem;

        int status = int.Parse(n.SelectedValue);
        int id = int.Parse((o.FindControl("idLabel") as Label).Text);
        /***
                Dictionary<int, int> a = new Dictionary<int, int>();
                a.Add(1, 100);
                a.Add(5, 800);

                Dictionary<int, int> b = new Dictionary<int, int> { { 1, 100 }, { 5, 800 } };

        */
        SqlParam data = new SqlParam { { "@id", id }, { "@status", status } };
        string sql = "UPDATE [data_settlement] SET [status] = @status WHERE [id] = @id";

        Database db = new Database();
        db.Exec(sql, data);
        db.Close();
    }
Пример #22
0
        public void login(HttpContext context)
        {
            string user_Account = context.Request["user_Account"]; //账户
            string userPwd      = context.Request["userPwd"];      //密码
            string jizhu        = context.Request["jizhu"];        //是否记住密码
            string fhz          = "5";
            string sql          = string.Format(@"SELECT id,User_Account,User_Pwd,User_Name,User_ID FROM dbo.ABase_UserInfo WHERE DeleteMark=1 and User_Account=@User_Account and  User_Pwd=@User_Pwd");

            SqlParam[] pamm = new SqlParam[] {
                new SqlParam("@User_Account", user_Account),
                new SqlParam("@User_Pwd", Md5Helper.MD5(userPwd, 32))
            };
            DataTable ds = DataFactory.SqlDataBase().GetDataTableBySQL(new StringBuilder(sql), pamm);

            if (ds != null)
            {
                if (ds.Rows.Count > 0)
                {
                    RequestSession.ClearAllSession();
                    IPScanerHelper objScan = new IPScanerHelper();
                    objScan.DataPath = context.Server.MapPath("/Themes/IPScaner/QQWry.Dat");
                    objScan.IP       = RequestHelper.GetIP();
                    Hashtable hs = new Hashtable();
                    hs["SYS_LOGINLOG_IP"]     = RequestHelper.GetIP();
                    hs["SYS_LOGINLOG_TIME"]   = DateTime.Now;
                    hs["User_Account"]        = user_Account;
                    hs["SYS_LOGINLOG_STATUS"] = 1;
                    hs["OWNER_address"]       = objScan.IPLocation();
                    hs["Base_UserInfo_ID"]    = ds.Rows[0]["User_ID"].ToString();
                    DataFactory.SqlDataBase().InsertByHashtable("ABase_SysLoginlog", hs);

                    HttpCookie cookie = new HttpCookie("admin_cookie");
                    cookie.Expires = DateTime.Now.AddDays(30);
                    if (jizhu == "1")
                    {
                        cookie.Values.Add("UserName", user_Account);
                        cookie.Values.Add("PassWord", userPwd);
                        context.Response.AppendCookie(cookie);
                    }
                    else
                    {
                        cookie.Values.Clear();
                    }

                    HttpCookie cookies = new HttpCookie("dladmin_COOKIE");
                    cookies.Expires = DateTime.Now.AddDays(1);
                    cookies.Values.Add("User_ID", ds.Rows[0]["User_ID"].ToString());
                    cookies.Values.Add("User_Account", user_Account);
                    cookies.Values.Add("User_Name", ds.Rows[0]["User_Name"].ToString());
                    cookies.Values.Add("User_Pwd", ds.Rows[0]["User_Pwd"].ToString());
                    context.Response.AppendCookie(cookies);
                    fhz = "3";
                }
                else
                {
                    fhz = "4";//账户或者密码有错误!
                }
            }
            else
            {
                fhz = "5";
            }

            context.Response.Write(fhz);//服务连接不上!
        }
Пример #23
0
        /// <summary>
        /// 保存事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Button1_Click(object sender, EventArgs e)
        {
            if (FileUpload1.HasFile == false)//HasFile用来检查FileUpload是否有指定文件
            {
                Response.Write("<script>alert('请您选择Excel文件')</script> ");
                return;//当无文件时,返回
            }
            string FileNameLength = FileUpload1.FileName.ToString();

            if (FileNameLength.Length > 30)//HasFile用来检查FileUpload是否有指定文件
            {
                Response.Write("<script>alert('请您修改Excel文件名和工作表名称的长度')</script> ");
                return;                                                                            //当无文件时,返回
            }
            string IsXls = System.IO.Path.GetExtension(FileUpload1.FileName).ToString().ToLower(); //System.IO.Path.GetExtension获得文件的扩展名

            System.IO.Path.GetExtension(FileUpload1.FileName).ToString().ToLower();                //
            if (IsXls != ".xls" && IsXls != ".xlsx" && IsXls != ".csv")                            //
            {
                Response.Write("<script>alert('只可以选择Excel文件')</script>");
                return;//当选择的不是Excel文件时,返回
            }

            DataTable dt = ExcelDataSource();

            //拼接字段
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                StringBuilder sb_user = new StringBuilder();
                sb_user.Append("SELECT User_ID FROM Base_UserInfo WHERE User_Account= @User_Account and  hotelid = @hotelid ");
                SqlParam[] parm_user = new SqlParam[] {
                    new SqlParam("@User_Account", dt.Rows[i]["手机号码"].ToString()),
                    new SqlParam("@hotelid", 97)
                };

                DataTable dt_user = DataFactory.SqlDataBase().GetDataTableBySQL(sb_user, parm_user);


                StringBuilder sb_org = new StringBuilder();
                sb_org.Append(@"
                 SELECT    Organization_ID
                                          FROM      dbo.Base_Organization
                                          WHERE     Organization_Name = @bumen

                ");
                SqlParam[] parm_org = new SqlParam[] {
                    new SqlParam("@bumen", dt.Rows[i]["部门"].ToString())
                };

                DataTable dt_org = DataFactory.SqlDataBase().GetDataTableBySQL(sb_org, parm_org);

                string org_id = "";
                if (dt_org != null && dt_org.Rows.Count > 0)
                {
                    org_id = dt_org.Rows[0]["Organization_ID"].ToString();
                }


                sb_org = new StringBuilder();
                sb_org.Append(@"
                SELECT  Organization_ID
                FROM    dbo.Base_Organization
                WHERE   Organization_Name = @zhiwei
                        AND ParentId IN ( SELECT    Organization_ID
                                          FROM      dbo.Base_Organization
                                          WHERE     Organization_ID = @org_id )

                ");
                parm_org = new SqlParam[] {
                    new SqlParam("@zhiwei", dt.Rows[i]["职位"].ToString()),
                    new SqlParam("@org_id", org_id)
                };

                dt_org = DataFactory.SqlDataBase().GetDataTableBySQL(sb_org, parm_org);

                if (dt_org != null && dt_org.Rows.Count > 0)
                {
                    org_id = dt_org.Rows[0]["Organization_ID"].ToString();
                }


                if (dt_user != null && dt_user.Rows.Count > 0)
                {
                    Hashtable ht = new Hashtable();
                    ht["Organization_ID"] = org_id;
                    string User_ID = dt_user.Rows[0]["User_ID"].ToString();
                    bool   IsOk    = DataFactory.SqlDataBase().Submit_AddOrEdit("Base_UserInfo", "User_ID", User_ID, ht);
                }
                else
                {
                    string    guid = CommonHelper.GetGuid;
                    Hashtable ht   = new Hashtable();
                    ht["IsAdmin"]      = 2;
                    ht["User_Name"]    = dt.Rows[i]["姓名"].ToString();
                    ht["User_Account"] = dt.Rows[i]["手机号码"].ToString();
                    ht["User_Pwd"]     = Md5Helper.MD5("123456", 32);
                    if (dt.Rows[i]["性别"].ToString() == "男")
                    {
                        ht["User_Sex"] = 1;
                    }
                    else
                    {
                        ht["User_Sex"] = 2;
                    }

                    ht["Email"]        = dt.Rows[i]["手机号码"].ToString();
                    ht["Title"]        = "";
                    ht["Theme"]        = "";   //电子邮箱
                    ht["User_Remark"]  = "导入"; //备注
                    ht["hotelid"]      = 97;
                    ht["HotelListId"]  = 97;
                    ht["AdminHotelid"] = "1001587";

                    ht["User_ID"]         = guid;
                    ht["CreateUserId"]    = "2E0CA5B1252F1F6B1E0AC91BE7E7219E";
                    ht["CreateUserName"]  = "******";
                    ht["CreateDate"]      = DateTime.Now;
                    ht["DeleteMark"]      = 1;
                    ht["Organization_ID"] = org_id;

                    //c7b1c600-52b3-4789-be30-89855d3c1411  --酒店员工
                    //bd9653be-3151-4b81-a54a-cac3714f79ef  --酒店财务
                    //cb4ee06b-0591-48b4-8d59-c51677dca8f2  --酒店经理
                    //f727621e-5775-4f74-a551-e73532b3901b  --酒店管理员

                    string zw = dt.Rows[i]["职位"].ToString();

                    string Roles_ID = "c7b1c600-52b3-4789-be30-89855d3c1411";
                    if (zw.IndexOf("管理员") > -1)
                    {
                        Roles_ID = "f727621e-5775-4f74-a551-e73532b3901b";
                    }
                    else if (zw.IndexOf("经理") > -1)
                    {
                        Roles_ID = "cb4ee06b-0591-48b4-8d59-c51677dca8f2";
                    }
                    else if (dt.Rows[i]["部门"].ToString() == "财务部")
                    {
                        Roles_ID = "bd9653be-3151-4b81-a54a-cac3714f79ef";
                    }

                    bool IsOk;
                    IsOk = DataFactory.SqlDataBase().Submit_AddOrEdit("Base_UserInfo", "User_ID", "", ht);
                    if (IsOk)
                    {
                        #region  ** 角色 **

                        DataFactory.SqlDataBase().DeleteData("Base_UserRole", "User_ID", guid);//删除角色
                        Hashtable htRole = new Hashtable();
                        htRole["UserRole_ID"] = CommonHelper.GetGuid;
                        htRole["User_ID"]     = guid;
                        htRole["Roles_ID"]    = Roles_ID;
                        DataFactory.SqlDataBase().Submit_AddOrEdit("Base_UserRole", "User_ID", "", htRole);//重新添加角色

                        #endregion
                    }
                }
            }
        }
Пример #24
0
        private void DefaultRole(HttpContext context)
        {
            string adminHotelid = context.Request["AdminHotelid"];

            if (string.IsNullOrEmpty(adminHotelid))
            {
                return;
            }
            string hotelId = context.Request["HotelId"];

            if (string.IsNullOrEmpty(hotelId) || hotelId == "-1")
            {
                return;
            }

            HttpContext rq  = HttpContext.Current;
            object      obj = rq.Session["DefaultRole" + hotelId];

            if (obj != null)
            {
                return;
            }
            StringBuilder sb = new StringBuilder("SELECT Roles_ID FROM Base_Roles WHERE Hotel_Id = @Hotel_Id");

            SqlParam[] parm = new SqlParam[] { new SqlParam("@Hotel_Id", hotelId) };
            DataTable  dt   = DataFactory.SqlDataBase().GetDataTableBySQL(sb, parm);

            if (dt != null && dt.Rows.Count > 0)
            {
                rq.Session["DefaultRole" + hotelId] = dt.Rows.Count;
                return;
            }


            sb   = new StringBuilder(@"
            INSERT  INTO dbo.Base_Roles
                    ( Roles_ID ,
                      AdminHotelid ,
                      Hotel_Id ,
                      ParentId ,
                      Roles_Name ,
                      Role_Restriction ,
                      Roles_Remark ,
                      AllowEdit ,
                      AllowDelete ,
                      SortCode ,
                      DeleteMark ,
                      CreateDate ,
                      CreateUserId ,
                      CreateUserName ,
                      ModifyDate ,
                      ModifyUserId ,
                      ModifyUserName
                    )
                    SELECT  LOWER(NEWID()) ,
                            @AdminHotelid ,
                            @Hotel_Id ,
                            ParentId ,
                            Roles_Name ,
                            Role_Restriction ,
                            Roles_Remark ,
                            AllowEdit ,
                            AllowDelete ,
                            SortCode ,
                            DeleteMark ,
                            GETDATE() ,
                            CreateUserId ,
                            CreateUserName ,
                            GETDATE() ,
                            '' ,
                            ''
                    FROM    dbo.Base_Roles
                    WHERE   Hotel_Id = 16
            ");
            parm = new SqlParam[] {
                new SqlParam("@AdminHotelid", adminHotelid),
                new SqlParam("@Hotel_Id", hotelId)
            };
            int sl = DataFactory.SqlDataBase().ExecuteBySql(sb, parm);

            if (sl > 0)
            {
                sb   = new StringBuilder("SELECT Roles_ID,(SELECT Roles_ID FROM Base_Roles WHERE Hotel_Id = 16 AND Roles_Name = br.Roles_Name) OldID FROM Base_Roles br WHERE Hotel_Id = @Hotel_Id");
                parm = new SqlParam[] { new SqlParam("@Hotel_Id", hotelId) };

                dt = DataFactory.SqlDataBase().GetDataTableBySQL(sb, parm);
                if (dt != null && dt.Rows.Count > 0)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        string Roles_ID = dt.Rows[i]["Roles_ID"].ToString();
                        string OldID    = dt.Rows[i]["OldID"].ToString();
                        sb   = new StringBuilder(@"
                        INSERT  INTO dbo.Base_RolesMenuGroup
                                ( RoleRight_ID ,
                                  Roles_ID ,
                                  MenuGroup_ID ,
                                  CreateDate ,
                                  CreateUserId ,
                                  CreateUserName
                                )
                                SELECT  LOWER(NEWID()) ,
                                        @NewRoles_ID ,
                                        MenuGroup_ID ,
                                        GETDATE() ,
                                        CreateUserId ,
                                        CreateUserName
                                FROM    dbo.Base_RolesMenuGroup
                                WHERE   Roles_ID = @OldID
                                    ");
                        parm = new SqlParam[] {
                            new SqlParam("@NewRoles_ID", Roles_ID),
                            new SqlParam("@OldID", OldID)
                        };
                        sl = DataFactory.SqlDataBase().ExecuteBySql(sb, parm);
                    }
                }
            }
        }
Пример #25
0
        /// <summary>
        /// 用户预订车辆(提前扣款)
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public bool OrderVehicle2(Hashtable param)
        {
            StringBuilder[] sqls = new StringBuilder[6];
            object[]        objs = new object[6];

            //更新车辆状态
            StringBuilder sql_upvechicle = new StringBuilder();

            sql_upvechicle.Append("UPDATE yr_vehicles SET USESTATE=").Append(VehicleUseState.Order.GetHashCode().ToString()).Append(" WHERE USESTATE=").Append(VehicleUseState.Free.GetHashCode().ToString()).Append(" AND VEHICLESTATE=").Append(VehicleState.Use.GetHashCode().ToString()).Append(" AND ID=@ID");
            SqlParam[] parm_upvechicle = new SqlParam[] { new SqlParam("@ID", param["VID"]) };
            sqls[0] = sql_upvechicle;
            objs[0] = parm_upvechicle;

            //添加订单
            StringBuilder sql_addorder = new StringBuilder();

            sql_addorder.Append(@"INSERT INTO [dbo].[YR_Orders]([ID],[OrderNum],[UserID],[VehicleID],[KMPrice],[MinutesPrice],[Mileage],[Minutes],[UserPrivilegeRatio],[RaiseCommissionRatio],[PayMoney],[PayTime],[PayState],[OrderState],[CreateTime],[OrderRemark],TotalMoney,SettlementMoney,RaiseCommissionMoney,RentType,RentDuration)
     VALUES
           (@ID,@OrderNum,@UserID,@VehicleID,@KMPrice,@MinutesPrice,@Mileage,@Minutes,@UserPrivilegeRatio,@RaiseCommissionRatio,@PayMoney,@PayTime,@PayState,@OrderState,@CreateTime,@OrderRemark,@TotalMoney,@SettlementMoney,@RaiseCommissionMoney,@RentType,@RentDuration)");
            SqlParam[] param_addordeer = new SqlParam[] { new SqlParam("@ID", param["OID"]),
                                                          new SqlParam("@OrderNum", param["OrderNum"]),
                                                          new SqlParam("@UserID", param["UserID"]),
                                                          new SqlParam("@VehicleID", param["VehicleID"]),
                                                          new SqlParam("@KMPrice", param["KMPrice"]),
                                                          new SqlParam("@MinutesPrice", param["MinutesPrice"]),
                                                          new SqlParam("@Mileage", param["Mileage"]),
                                                          new SqlParam("@Minutes", param["Minutes"]),
                                                          new SqlParam("@UserPrivilegeRatio", param["UserPrivilegeRatio"]),
                                                          new SqlParam("@RaiseCommissionRatio", param["RaiseCommissionRatio"]),
                                                          new SqlParam("@PayMoney", param["PayMoney"]),
                                                          new SqlParam("@PayTime", param["PayTime"]),
                                                          new SqlParam("@PayState", param["PayState"]),
                                                          new SqlParam("@OrderState", param["OrderState"]),
                                                          new SqlParam("@CreateTime", param["CreateTime"]),
                                                          new SqlParam("@OrderRemark", param["OrderRemark"]),
                                                          new SqlParam("@TotalMoney", param["TotalMoney"]),
                                                          new SqlParam("@SettlementMoney", param["SettlementMoney"]),
                                                          new SqlParam("@RaiseCommissionMoney", param["RaiseCommissionMoney"]),
                                                          new SqlParam("@RentType", param["RentType"]),
                                                          new SqlParam("@RentDuration", param["RentDuration"]) };
            sqls[1] = sql_addorder;
            objs[1] = param_addordeer;

            UserInfoManager um = new UserInfoManager();
            Hashtable       userinfo = um.GetUserInfoByUserID(SiteHelper.GetHashTableValueByKey(param, "UserID"));
            decimal         balance = 0.00m, balance2 = 0.00m, raiseBalance = 0.00m;

            decimal.TryParse(SiteHelper.GetHashTableValueByKey(userinfo, "Balance"), out balance);
            decimal.TryParse(SiteHelper.GetHashTableValueByKey(userinfo, "Balance2"), out balance2);
            decimal.TryParse(SiteHelper.GetHashTableValueByKey(userinfo, "RaiseBalance"), out raiseBalance);

            RechargeCardManager rcm         = new RechargeCardManager();
            decimal             cardBalance = rcm.GetBalance(SiteHelper.GetHashTableValueByKey(param, "UserID"));

            // 更新用户余额
            StringBuilder sbUpdateUserInfo = new StringBuilder();
            decimal       changesAmount    = 0.00m;

            decimal.TryParse(param["ChangesAmount"].ToString(), out changesAmount);
            changesAmount = Math.Abs(changesAmount);
            if (cardBalance > 0)
            {
                StringBuilder sbUpdateCard = new StringBuilder();
                Hashtable     cardht       = rcm.GetUserEnableCard(SiteHelper.GetHashTableValueByKey(param, "UserID"));
                string        cardid       = cardht["id"].ToString();
                if (changesAmount <= cardBalance)
                {
                    sbUpdateCard.Append("update YR_RechargeCard set Balance=Balance-@ChangesAmount Where ID =@CardID");
                    SqlParam[] parm = new SqlParam[] { new SqlParam("@ChangesAmount", changesAmount), new SqlParam("@CardID", cardid) };
                    sqls[2] = sbUpdateCard;
                    objs[2] = parm;
                }
                else
                {
                    sbUpdateCard.Append("update YR_RechargeCard set Balance=0,CardState=0 Where ID =@CardID");
                    SqlParam[] parm = new SqlParam[] { new SqlParam("@CardID", cardid) };
                    sqls[2] = sbUpdateCard;
                    objs[2] = parm;
                }
                changesAmount -= cardBalance;
            }


            if (changesAmount <= balance)
            {
                sbUpdateUserInfo.Append("update YR_UserInfo set Balance=Balance-@ChangesAmount Where ID =@UserID");
                SqlParam[] parm = new SqlParam[] { new SqlParam("@ChangesAmount", changesAmount), new SqlParam("@UserID", param["UserID"]) };
                sqls[3] = sbUpdateUserInfo;
                objs[3] = parm;
            }
            else
            {
                decimal b2 = changesAmount - balance;
                sbUpdateUserInfo.Append("update YR_UserInfo set Balance=0,Balance2=Balanc2e-@ChangesAmount Where ID =@UserID");
                SqlParam[] parm = new SqlParam[] { new SqlParam("@ChangesAmount", b2), new SqlParam("@UserID", param["UserID"]) };
                sqls[3] = sbUpdateUserInfo;
                objs[3] = parm;
            }

            // 增加财务信息
            StringBuilder balanceAdd = new StringBuilder();

            balanceAdd.Append("Insert into YR_UserFinancial(");
            balanceAdd.Append("ID,UserID,ChangesAmount,ChangesTime,ChangesType,OrderNum,Remark,Operator,OperatorType,OperatorWay,CurrentBalance,state) ");
            balanceAdd.Append("Select @ID,@UserID,@ChangesAmount,@ChangesTime,@ChangesType,@OrderID,@Remark,@Operator,@OperatorType,@OperatorWay,isnull(SUM(ChangesAmount),0)+CONVERT(DECIMAL(18,2),@ChangesAmount),@State from YR_UserFinancial WITH(NOLOCK) where UserID=@UserID and State=" + UserFinancialState.Effect.GetHashCode());
            SqlParam[] parmBalanceAdd = new SqlParam[] {
                new SqlParam("@ID", param["UserFinancialID"]),
                new SqlParam("@UserID", param["UserID"]),
                new SqlParam("@ChangesAmount", param["ChangesAmount"]),
                new SqlParam("@ChangesTime", param["ChangesTime"]),
                new SqlParam("@ChangesType", param["ChangesType"]),
                new SqlParam("@OrderID", param["OID"]),
                new SqlParam("@Remark", param["Remark"]),
                new SqlParam("@Operator", param["Operator"]),
                new SqlParam("@OperatorType", param["OperatorType"]),
                new SqlParam("@OperatorWay", param["OperatorWay"]),
                new SqlParam("@State", param["State"])
            };
            sqls[4] = balanceAdd;
            objs[4] = parmBalanceAdd;

            // 发送短消息

            StringBuilder msgAdd = new StringBuilder();

            msgAdd.Append("Insert into YR_Messages(");
            msgAdd.Append("ID,OperatorID,UserID,MessageTitle,MessageContent,MessageType,ModuleType,ReleaseTime,state) ");
            msgAdd.Append(" values(@ID,@OperatorID,@UserID,@MessageTitle,@MessageContent,@MessageType,@ModuleType,@ReleaseTime,@State)");
            StringBuilder sbMsg = new StringBuilder();

            sbMsg.Append("订单:").Append(param["OrderNum"].ToString()).Append(" 消费 ").Append(param["SettlementMoney"].ToString()).Append("元");
            SqlParam[] parmMsgAdd = new SqlParam[] {
                new SqlParam("@ID", param["MessageID"]),
                new SqlParam("@OperatorID", param["Operator"]),
                new SqlParam("@UserID", param["UserID"]),
                new SqlParam("@MessageTitle", "订单消费通知"),
                new SqlParam("@MessageContent", sbMsg.ToString()),
                new SqlParam("@MessageType", MessageType.System.GetHashCode()),
                new SqlParam("@ModuleType", MessageModuleType.UseVehicle.GetHashCode()),
                new SqlParam("@ReleaseTime", SiteHelper.GetWebServerCurrentTime()),
                new SqlParam("@State", MessageState.Enable.GetHashCode())
            };
            sqls[5] = msgAdd;
            objs[5] = parmMsgAdd;

            return(DataFactory.SqlDataBase().BatchExecuteBySqlWithTrans(sqls, objs));
        }
Пример #26
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //SessionUser user = new SessionUser();
                //user.AdminHotelid = "1";
                //RequestSession.AddSessionUser(user);


                string sql1 = string.Format(@"select REPLACE(hylxcode, ' ', '')  hylxcode,hylxname from hy_hylxbmb where AdminHotelid='{0}' ", RequestSession.GetSessionUser().AdminHotelid.ToString());
                hyjb.DataSource     = DataFactory.SqlDataBase(RequestSession.GetSessionUser().AdminHotelid.ToString()).GetDataTableBySQL(new StringBuilder(sql1));
                hyjb.DataTextField  = "hylxname";
                hyjb.DataValueField = "hylxcode";
                hyjb.DataBind();

                StringBuilder sb = new StringBuilder();
                sb.Append("select ID,CouponName from V_coupon where TypeName='单次充值赠送' AND isend='未过期' ");
                if (RequestSession.GetSessionUser().AdminHotelid != null)
                {
                    sb.Append(" and AdminHotelid='" + RequestSession.GetSessionUser().AdminHotelid + "' ");
                }

                yhq.DataSource     = DataFactory.SqlDataBase().GetDataTableBySQL(sb);
                yhq.DataTextField  = "CouponName";
                yhq.DataValueField = "ID";
                yhq.DataBind();


                StringBuilder sb_hotel = new StringBuilder();
                sb_hotel.Append(string.Format(" SELECT ID,name FROM Hotel WHERE    AdminHotelid IN ( SELECT  AdminHotelid FROM Hotel_Admin WHERE AdminHotelid=@AdminHotelid ) "));
                List <SqlParam> listStr = new List <SqlParam>();
                listStr.Add(new SqlParam("@AdminHotelid", RequestSession.GetSessionUser().AdminHotelid));
                sb_hotel.Append("  ORDER BY ID DESC");
                DataTable dt = DataFactory.SqlDataBase().GetDataTableBySQL(sb_hotel, listStr.ToArray());
                if (dt != null && dt.Rows.Count > 0)
                {
                    this.ddlHotel.DataSource     = dt;
                    this.ddlHotel.DataTextField  = "name";
                    this.ddlHotel.DataValueField = "ID";
                    this.ddlHotel.DataBind();
                }



                if (Request["id"] != null)
                {
                    string     sql      = string.Format(@"select id,moneys,zsmoneys,REPLACE(hylxcode, ' ', '') hylxcode,zsjf,bz,iszsmoneys,iszsjf,ishylxcode,iscouponid,couponid,HotelId from CardRecharge where id=@id");
                    SqlParam[] parmAdd2 = new SqlParam[] {
                        new SqlParam("@id", Request["id"])
                    };
                    DataTable ds = DataFactory.SqlDataBase().GetDataTableBySQL(new StringBuilder(sql), parmAdd2);
                    if (ds != null && ds.Rows.Count > 0)
                    {
                        czje.Text = ds.Rows[0]["moneys"].ToString();
                        zsje.Text = ds.Rows[0]["zsmoneys"].ToString();
                        zsjf.Text = ds.Rows[0]["zsjf"].ToString();
                        //yhq.SelectedValue = ds.Rows[0]["couponid"].ToString();
                        couponids.Value    = ds.Rows[0]["couponid"].ToString() + ",";
                        hyjb.SelectedValue = ds.Rows[0]["hylxcode"].ToString();
                        txtInfo.Value      = ds.Rows[0]["bz"].ToString();
                        iszsmoneys.Value   = ds.Rows[0]["iszsmoneys"].ToString();
                        iszsjf.Value       = ds.Rows[0]["iszsjf"].ToString();
                        ishylxcode.Value   = ds.Rows[0]["ishylxcode"].ToString();
                        iscouponid.Value   = ds.Rows[0]["iscouponid"].ToString();
                        if (ds.Rows[0]["HotelId"] != null && ds.Rows[0]["HotelId"].ToString() != "")
                        {
                            ddlHotel.SelectedValue = ds.Rows[0]["HotelId"].ToString();
                        }
                    }
                }
                else
                {
                    btnSubmit.Text = "添加";
                }
            }
        }
Пример #27
0
        /// <summary>
        /// 32位MD5加密
        /// </summary>
        /// <param name="input">原始内容</param>
        /// <returns>md5值</returns>
        /// <links>http://blog.163.com/m13864039250_1/blog/static/21386524820150231533602/</links>
        private static string HashPassword(string input)
        {
            /*MD5CryptoServiceProvider md5Hasher = new MD5CryptoServiceProvider();
            byte[] data = md5Hasher.ComputeHash(Encoding.Default.GetBytes(input));
            StringBuilder sBuilder = new StringBuilder();
            for (int i = 0; i < data.Length; i++)
            {
                sBuilder.Append(data[i].ToString("x2"));
            }
            return sBuilder.ToString();*/

            // 放弃原始算法,改为调用数据库的运算结果

            string md5sum = "";
            string sql = "select right(sys.fn_VarBinToHexStr(hashbytes('MD5', @input)),32) as md5sum";
            SqlParam data = new SqlParam { { "@input", input } };
            Database db = new Database();
            SqlDataReader reader = db.Query(sql, data);

            if (reader.Read()) {
                md5sum = (string)reader["md5sum"];
            }

            reader.Close();
            db.Close();

            return md5sum;
        }
Пример #28
0
 // Token: 0x060000D9 RID: 217 RVA: 0x000155E0 File Offset: 0x000137E0
 protected override void View()
 {
     this.examconfig = ExamConifgs.GetExamConfig();
     this.sortinfo   = SortBll.GetSortInfo(this.sortid);
     if (this.sortinfo.id == 0)
     {
         this.ShowErr("对不起,该题库不存在或已被删除。");
     }
     else
     {
         SqlParam[] sqlparams = new SqlParam[]
         {
             DbHelper.MakeAndWhere("sortid", this.sortid),
             DbHelper.MakeAndWhere("uid", this.userid)
         };
         this.examloginfo = DbHelper.ExecuteModel <ExamLogInfo>(sqlparams);
         if (this.examloginfo.sortid != 0)
         {
             this.channelid             = this.examloginfo.channelid;
             this.examloginfo.questions = this.sortinfo.posts;
             this.examloglist           = ExamBll.GetExamLogList(this.channelid, this.userid);
             string text = "";
             if (this.action == "wrong")
             {
                 this.pagenav = string.Concat(new object[]
                 {
                     "错题(",
                     this.sortinfo.name,
                     ")共",
                     this.examloginfo.wrongs,
                     "道题目"
                 });
                 text = this.examloginfo.wronglist;
             }
             else if (this.action == "note")
             {
                 this.pagenav = string.Concat(new object[]
                 {
                     "笔记(",
                     this.sortinfo.name,
                     ")共",
                     this.examloginfo.notes,
                     "道题目"
                 });
                 text = this.examloginfo.notelist;
             }
             else if (this.action == "fav")
             {
                 this.pagenav = string.Concat(new object[]
                 {
                     "收藏(",
                     this.sortinfo.name,
                     ")共",
                     this.examloginfo.favs,
                     "道题目"
                 });
                 text = this.examloginfo.favlist;
             }
             if (text != "")
             {
                 SqlParam     sqlParam = DbHelper.MakeAndWhere("id", WhereType.In, text);
                 OrderByParam orderby  = DbHelper.MakeOrderBy("type", OrderBy.ASC);
                 this.questionlist = DbHelper.ExecuteList <ExamQuestion>(orderby, new SqlParam[]
                 {
                     sqlParam
                 });
                 SqlParam[] sqlparams2 = new SqlParam[]
                 {
                     DbHelper.MakeAndWhere("qid", WhereType.In, text),
                     DbHelper.MakeAndWhere("uid", this.userid)
                 };
                 List <ExamNote> list = DbHelper.ExecuteList <ExamNote>(sqlparams2);
                 for (int i = 0; i < this.questionlist.Count; i++)
                 {
                     if (FPUtils.InArray(this.questionlist[i].id, this.examloginfo.favlist))
                     {
                         this.questionlist[i].isfav = 1;
                     }
                     foreach (ExamNote examNote in list)
                     {
                         if (examNote.qid == this.questionlist[i].id)
                         {
                             this.questionlist[i].note = examNote.note;
                         }
                     }
                     if (this.examloglist.ContainsKey(this.questionlist[i].sortid))
                     {
                         ExamLogInfo examLogInfo = this.examloglist[this.questionlist[i].sortid];
                         if (FPUtils.InArray(this.questionlist[i].id, examLogInfo.qidlist))
                         {
                             int[]    array  = FPUtils.SplitInt(examLogInfo.qidlist);
                             string[] array2 = FPUtils.SplitString(examLogInfo.optionlist, "|", array.Length);
                             string[] array3 = FPUtils.SplitString(examLogInfo.answerlist, "§", array.Length);
                             for (int j = 0; j < array.Length; j++)
                             {
                                 if (array[j] == this.questionlist[i].id)
                                 {
                                     this.questionlist[i].useranswer = array3[j];
                                     this.questionlist[i].optionlist = array2[j];
                                     this.questionlist[i].answer     = this.OptionAnswer(array2[j], this.questionlist[i].answer);
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
Пример #29
0
        /// <summary>
        /// 获取权限
        /// </summary>
        /// <returns>用户权限</returns>
        public static int GetPermission()
        {
            string sql = "SELECT permission FROM userinfo WHERE id=@id";
            SqlParam data = new SqlParam { { "@id", GetId() } };
            Database db = new Database();
            SqlDataReader reader = db.Query(sql, data);
            int permission = 0;

            if (reader.Read())
            {
                permission = (int)reader["permission"];
            }

            reader.Close();
            db.Close();

            return permission;
        }
Пример #30
0
        public override void Validate(Kingdee.BOS.Core.ExtendedDataEntity[] dataEntities, ValidateContext validateContext, Kingdee.BOS.Context ctx)
        {
            Field billNoField = validateContext.BusinessInfo.GetBillNoField();

            if (dataEntities == null || dataEntities.Count() <= 0)
            {
                return;
            }

            List <long> lstFids = new List <long>();

            foreach (var data in dataEntities)
            {
                lstFids.Add(Convert.ToInt64(data.DataEntity["ID"]));
            }

            if (lstFids.Count() <= 0)
            {
                return;
            }

            SqlParam param = new SqlParam("@FID", KDDbType.udt_inttable, lstFids.ToArray());

            string sql = string.Format(@"
                select a.FID,b.FEntryID,b.FSeq
                from JN_T_SAL_GiftReq a
                inner join TABLE(fn_StrSplit(@FID,',',1)) tb on a.Fid=tb.Fid
                inner join JN_T_SAL_GiftReqEntry b on a.FID=b.FID 
                inner join t_BD_Stock d on b.FStockId=d.FStockId
                where not exists (select 1 from JN_T_SAL_ForecastBack c where a.FSALEORGID=c.FSALEORGID and c.FSALERID=a.FSalesManId 
                                                                        and a.FSaleDeptId=c.FSALEDEPTID  and a.FSaleGroupId=c.FSALEGROUPID
                                                                        and b.FMATERIALID=c.FMATERIALID and b.FAUXPROPID=c.FAUXPROPID 
                                                                        and b.FBaseUnitID=c.FUnitID)
                and d.FMasterId in (100313,100328)
                union all
                select b.Fid,c.FEntryID,c.FSeq
                from JN_T_SAL_ForecastBack a
                inner join JN_T_SAL_GiftReq b on a.FSALEORGID=b.FSALEORGID and a.FSALERID=b.FSalesManId 
                and a.FSaleDeptId=b.FSALEDEPTID  and a.FSaleGroupId=b.FSALEGROUPID
                inner join TABLE(fn_StrSplit(@FID,',',1)) tb on b.Fid=tb.Fid
                inner join JN_T_SAL_GiftReqEntry c on b.FID=c.FID and a.FMATERIALID=c.FMATERIALID 
                and a.FAUXPROPID=c.FAUXPROPID and c.FBaseUnitID=a.FUnitID
                inner join t_BD_Stock d on c.FStockId=d.FStockId
                where a.FQTY-c.FBaseUnitQty<0 and d.FMasterId in (100313,100328) ");

            DynamicObjectCollection docChecks = DBUtils.ExecuteDynamicObject(this.Context, sql, null, null, CommandType.Text, new SqlParam[] { param });

            if (docChecks == null || docChecks.Count() <= 0)
            {
                return;
            }

            foreach (var data in dataEntities)
            {
                List <DynamicObject> docSelect = docChecks.Where(p => Convert.ToInt64(data.DataEntity["ID"]) == Convert.ToInt64(p["FID"])).ToList();

                if (docSelect == null || docSelect.Count() <= 0)
                {
                    continue;
                }

                foreach (var item in docSelect)
                {
                    AddMsg(validateContext, data, billNoField.Key
                           , string.Format(@"第{0}行的结余数出现操作结果小于0,不能审核,请先做销售预测变更单进行调整结余数!", item["FSeq"]));
                }
            }
        }
Пример #31
0
 /// <summary>
 /// 获得数据列表(带条件)
 /// </summary>
 /// <param name="where">条件</param>
 /// <param name="param">参数化</param>
 /// <returns></returns>
 public IList GetListWhere(StringBuilder where, SqlParam[] param)
 {
     StringBuilder strSql = new StringBuilder();
     strSql.Append("SELECT * FROM BASE_USER WHERE 1=1");
     strSql.Append(where);
     strSql.Append(DataPermission.Instance.User);
     return DbHelper.GetDataListBySQL<BASE_USER>(strSql, param);
 }
Пример #32
0
        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="context"></param>
        private void GetSubmit(HttpContext context)
        {
            string        a            = "0";
            string        AdminHotelid = context.Request["AdminHotelid"];
            string        HotelId      = context.Request["HotelId"]; //分店ID
            string        IsNetwork    = context.Request["IsNetwork"];
            string        NetworkImg   = context.Request["NetworkImg"];
            string        NetworkType  = context.Request["NetworkType"];
            string        NetworkDay   = context.Request["NetworkDay"];
            string        NetworkName  = context.Request["NetworkName"];
            string        NetworkInfo  = context.Request["NetworkInfo"];
            string        IsRoom       = context.Request["IsRoom"];
            string        RoomImg      = context.Request["RoomImg"];
            string        RoomType     = context.Request["RoomType"];
            string        RoomDay      = context.Request["RoomDay"];
            string        RoomName     = context.Request["RoomName"];
            string        RoomInfo     = context.Request["RoomInfo"];
            string        IsCenter     = context.Request["IsCenter"];
            string        CenterImg    = context.Request["CenterImg"];
            string        CenterType   = context.Request["CenterType"];
            string        CenterDay    = context.Request["CenterDay"];
            string        CenterName   = context.Request["CenterName"];
            string        CenterInfo   = context.Request["CenterInfo"];
            string        IsBook       = context.Request["IsBook"];
            string        BookImg      = context.Request["BookImg"];
            string        BookType     = context.Request["BookType"];
            string        BookDay      = context.Request["BookDay"];
            string        BookName     = context.Request["BookName"];
            string        BookInfo     = context.Request["BookInfo"];
            StringBuilder sb           = new StringBuilder();

            sb.Append("SELECT ID FROM TipsInfo where  AdminHotelid=@AdminHotelid ");
            SqlParam[] param = new SqlParam[] {
                new SqlParam("@AdminHotelid", AdminHotelid)
            };
            DataTable dstrs = DataFactory.SqlDataBase().GetDataTableBySQL(sb, param);

            if (dstrs != null && dstrs.Rows.Count > 0)
            {
                Hashtable hs = new Hashtable();
                hs["IsNetwork"]   = IsNetwork;
                hs["NetworkImg"]  = NetworkImg;
                hs["NetworkType"] = NetworkType;
                hs["NetworkDay"]  = NetworkDay;
                hs["NetworkName"] = NetworkName;
                hs["NetworkInfo"] = NetworkInfo;
                hs["IsRoom"]      = IsRoom;
                hs["RoomImg"]     = RoomImg;
                hs["RoomType"]    = RoomType;
                hs["RoomDay"]     = RoomDay;
                hs["RoomName"]    = RoomName;
                hs["RoomInfo"]    = RoomInfo;
                hs["IsCenter"]    = IsCenter;
                hs["CenterImg"]   = CenterImg;
                hs["CenterType"]  = CenterType;
                hs["CenterDay"]   = CenterDay;
                hs["CenterName"]  = CenterName;
                hs["CenterInfo"]  = CenterInfo;
                hs["IsBook"]      = IsBook;
                hs["BookImg"]     = BookImg;
                hs["BookType"]    = BookType;
                hs["BookDay"]     = BookDay;
                hs["BookName"]    = BookName;
                hs["BookInfo"]    = BookInfo;
                int b = DataFactory.SqlDataBase().UpdateByHashtable("TipsInfo", "ID", dstrs.Rows[0]["ID"].ToString(), hs);
                if (b > 0)
                {
                    a = "1";
                }
            }
            else
            {
                Hashtable ht = new Hashtable();
                ht["IsNetwork"]    = IsNetwork;
                ht["NetworkImg"]   = NetworkImg;
                ht["NetworkType"]  = NetworkType;
                ht["NetworkDay"]   = NetworkDay;
                ht["NetworkName"]  = NetworkName;
                ht["NetworkInfo"]  = NetworkInfo;
                ht["IsRoom"]       = IsRoom;
                ht["RoomImg"]      = RoomImg;
                ht["RoomType"]     = RoomType;
                ht["RoomDay"]      = RoomDay;
                ht["RoomName"]     = RoomName;
                ht["RoomInfo"]     = RoomInfo;
                ht["IsCenter"]     = IsCenter;
                ht["CenterImg"]    = CenterImg;
                ht["CenterType"]   = CenterType;
                ht["CenterDay"]    = CenterDay;
                ht["CenterName"]   = CenterName;
                ht["CenterInfo"]   = CenterInfo;
                ht["IsBook"]       = IsBook;
                ht["BookImg"]      = BookImg;
                ht["BookType"]     = BookType;
                ht["BookDay"]      = BookDay;
                ht["BookName"]     = BookName;
                ht["BookInfo"]     = BookInfo;
                ht["AdminHotelid"] = AdminHotelid;
                ht["HotelId"]      = HotelId;
                int b = DataFactory.SqlDataBase().InsertByHashtable("TipsInfo", ht);
                if (b > 0)
                {
                    a = "1";
                }
            }
            context.Response.Write(a);
        }
Пример #33
0
 /// <summary>
 /// 分页获取数据列表(带条件)
 /// </summary>
 /// <param name="where">条件</param>
 /// <param name="param">参数化</param>
 /// <param name="orderField">排序字段</param>
 /// <param name="orderType">排序类型</param>
 /// <param name="pageIndex">当前页</param>
 /// <param name="pageSize">页大小</param>
 /// <param name="count">总条数</param>
 /// <returns></returns>
 public IList GetPageListWhere(StringBuilder where, SqlParam[] param, string orderField, string orderType, int pageIndex, int pageSize, ref int count)
 {
     StringBuilder strSql = new StringBuilder();
     strSql.Append("SELECT * FROM BASE_MODULE WHERE 1=1");
     strSql.Append(where);
     return DbHelper.GetPageList<BASE_MODULE>(strSql.ToString(), param, CommonHelper.ToOrderField("SortCode", orderField), orderType, pageIndex, pageSize, ref count);
 }
Пример #34
0
 // Token: 0x06000046 RID: 70 RVA: 0x000078E4 File Offset: 0x00005AE4
 protected override void View()
 {
     this.examconfig = ExamConifgs.GetExamConfig();
     if (this.id > 0)
     {
         this.examtopic = DbHelper.ExecuteModel <ExamTopic>(this.id);
         if (this.examtopic.id == 0)
         {
             this.ShowErr("对不起,该试卷大题不存在或已被删除。");
             return;
         }
         this.examid = this.examtopic.examid;
         this.paper  = this.examtopic.paper;
     }
     else
     {
         SqlParam[] sqlparams = new SqlParam[]
         {
             DbHelper.MakeAndWhere("examid", this.examid),
             DbHelper.MakeAndWhere("paper", this.paper)
         };
         this.examtopic.display = FPRequest.GetInt(DbHelper.ExecuteMax <ExamTopic>("display", sqlparams).ToString()) + 1;
     }
     this.examinfo = DbHelper.ExecuteModel <ExamInfo>(this.examid);
     this.sortinfo = SortBll.GetSortInfo(this.examinfo.sortid);
     if (this.ispost)
     {
         double num       = this.examtopic.perscore * (double)this.examtopic.questions;
         int    questions = this.examtopic.questions;
         this.examtopic = FPRequest.GetModel <ExamTopic>(this.examtopic);
         if (this.examtopic.questions < this.examtopic.curquestions + this.examtopic.randoms)
         {
             this.ShowErr("设定的总题目数不能小于当前手工选题和随机选题之和。");
             return;
         }
         if (this.examtopic.id > 0)
         {
             if (DbHelper.ExecuteUpdate <ExamTopic>(this.examtopic) > 0)
             {
                 if (this.paper == 1)
                 {
                     StringBuilder stringBuilder = new StringBuilder();
                     stringBuilder.AppendFormat("UPDATE [{0}Exam_ExamInfo] SET [total]=[total]-{1},[questions]=[questions]-{2} WHERE [id]={3}|", new object[]
                     {
                         DbConfigs.Prefix,
                         num,
                         questions,
                         this.examid
                     });
                     stringBuilder.AppendFormat("UPDATE [{0}Exam_ExamInfo] SET [total]=[total]+{1},[questions]=[questions]+{2} WHERE [id]={3}", new object[]
                     {
                         DbConfigs.Prefix,
                         this.examtopic.perscore * (double)this.examtopic.questions,
                         this.examtopic.questions,
                         this.examid
                     });
                     DbHelper.ExecuteSql(stringBuilder.ToString());
                 }
             }
         }
         else if (DbHelper.ExecuteInsert <ExamTopic>(this.examtopic) > 0)
         {
             if (this.paper == 1)
             {
                 StringBuilder stringBuilder = new StringBuilder();
                 stringBuilder.AppendFormat("UPDATE [{0}Exam_ExamInfo] SET [total]=[total]+{1},[questions]=[questions]+{2} WHERE [id]={3}", new object[]
                 {
                     DbConfigs.Prefix,
                     this.examtopic.perscore * (double)this.examtopic.questions,
                     this.examtopic.questions,
                     this.examid
                 });
                 DbHelper.ExecuteSql(stringBuilder.ToString());
             }
         }
         base.Response.Redirect(string.Concat(new object[]
         {
             "examtopicmanage.aspx?examid=",
             this.examid,
             "&paper=",
             this.paper
         }));
     }
     base.SaveRightURL();
 }
Пример #35
0
        /// <summary>
        /// 保存事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Save_Click(object sender, EventArgs e)
        {
            string    guid = CommonHelper.GetGuid;
            Hashtable ht   = new Hashtable();

            ht["User_Name"]    = User_Name.Value;
            ht["User_Account"] = User_Account.Value;
            if (User_Pwd.Value != "*************")
            {
                ht["User_Pwd"] = Md5Helper.MD5(User_Pwd.Value, 32);
            }
            ht["User_Sex"]    = User_Sex.Value;
            ht["Email"]       = Email.Value;
            ht["Title"]       = Title.Value;
            ht["Theme"]       = Theme.Value;
            ht["User_Remark"] = User_Remark.Value;
            if (DropDownList1.SelectedValue != "所有酒店" && DropDownList1.SelectedValue != "0")
            {
                ht["hotelid"] = DropDownList1.SelectedValue;
            }
            else
            {
                ht["hotelid"] = "";
            }
            ht["AdminHotelid"] = HotelAdmin.Value;


            if (!string.IsNullOrEmpty(_key))
            {
                guid                 = _key;
                ht["ModifyDate"]     = DateTime.Now;
                ht["ModifyUserId"]   = RequestSession.GetSessionUser().UserId;
                ht["ModifyUserName"] = RequestSession.GetSessionUser().UserName;
            }
            else
            {
                StringBuilder sbPR = new StringBuilder();
                sbPR.Append("SELECT User_Account FROM dbo.Base_UserInfo WHERE User_Account= @User_Account and AdminHotelid=@AdminHotelid and DeleteMark=1");
                SqlParam[] parmAdd = new SqlParam[] {
                    new SqlParam("@User_Account", User_Account.Value),
                    new SqlParam("@AdminHotelid", HotelAdmin.Value)
                };
                DataTable dt = DataFactory.SqlDataBase().GetDataTableBySQL(sbPR, parmAdd);
                if (dt != null && dt.Rows.Count > 0)
                {
                    ShowMsgHelper.Alert_Error("操作失败!用户名已存在");
                    return;
                }
                ht["User_ID"]        = guid;
                ht["CreateUserId"]   = RequestSession.GetSessionUser().UserId;
                ht["CreateUserName"] = RequestSession.GetSessionUser().UserName;
            }

            ht["CreateDate"] = DateTime.Now;
            ht["ModifyDate"] = DateTime.Now;
            ht["DeleteMark"] = 1;

            bool IsOk = DataFactory.SqlDataBase().Submit_AddOrEdit("Base_UserInfo", "User_ID", _key, ht);

            if (IsOk)
            {
                IsOk = this.add_ItemForm(checkbox_value.Value.Split(','), guid);
            }
            if (IsOk)
            {
                ShowMsgHelper.ParmAlertMsgS("操作成功!");
            }
            else
            {
                ShowMsgHelper.Alert_Error("操作失败!");
            }
        }
Пример #36
0
        // Token: 0x060000A2 RID: 162 RVA: 0x0000F548 File Offset: 0x0000D748
        protected string GetChildSort(int channelid, int parentid, int level)
        {
            SqlParam[] sqlparams = new SqlParam[]
            {
                DbHelper.MakeAndWhere("parentid", parentid),
                DbHelper.MakeAndWhere("channelid", channelid),
                DbHelper.MakeAndWhere("appid", WhereType.In, this.sortappidlist),
                DbHelper.MakeAndWhere("hidden", 0)
            };
            OrderByParam    orderby       = DbHelper.MakeOrderBy("display", OrderBy.ASC);
            List <SortInfo> list          = DbHelper.ExecuteList <SortInfo>(orderby, sqlparams);
            StringBuilder   stringBuilder = new StringBuilder();

            foreach (SortInfo sortInfo in list)
            {
                ExamLogInfo examLogInfo;
                if (this.userexamlog.ContainsKey(sortInfo.id))
                {
                    examLogInfo = this.userexamlog[sortInfo.id];
                }
                else
                {
                    examLogInfo        = new ExamLogInfo();
                    examLogInfo.sortid = sortInfo.id;
                }
                stringBuilder.AppendFormat("<tr class=\"keypoint keypoint-level-{0} child_row_{1}\">\r\n", level, sortInfo.parentid);
                if (sortInfo.subcounts > 0)
                {
                    if (examLogInfo.notes > 0)
                    {
                        stringBuilder.AppendFormat("<td class=\"name-col\"><span class=\"text toggle-expand\"><span id=\"row_{0}\" class=\"sprite sprite-expand i-20\"></span>\r\n", sortInfo.id);
                        stringBuilder.AppendFormat("<a href=\"questionview.aspx?sortid={0}&action=note\" target=\"_blank\" class=\"btn btn-link link-button\">{1}(共{2}道笔记)</a>\r\n", sortInfo.id, sortInfo.name, examLogInfo.notes);
                        stringBuilder.AppendFormat("</span></td>\r\n", new object[0]);
                    }
                    else
                    {
                        stringBuilder.AppendFormat("<td class=\"name-col\"><span class=\"text toggle-expand\"><span id=\"row_{1}\" class=\"sprite sprite-expand i-20\"></span>{0}(共{2}道笔记)</span></td>\r\n", sortInfo.name, sortInfo.id, examLogInfo.notes);
                    }
                }
                else if (examLogInfo.notes > 0)
                {
                    stringBuilder.AppendFormat("<td class=\"name-col\"><span class=\"text\"><span class=\"sprite sprite-expand-holder i-20\"></span>\r\n", new object[0]);
                    stringBuilder.AppendFormat("<a href=\"questionview.aspx?sortid={0}&action=note\" target=\"_blank\" class=\"btn btn-link link-button\">{1}(共{2}道笔记)</a>\r\n", sortInfo.id, sortInfo.name, examLogInfo.notes);
                    stringBuilder.AppendFormat("</span></td>\r\n", new object[0]);
                }
                else
                {
                    stringBuilder.AppendFormat("<td class=\"name-col\"><span class=\"text\"><span class=\"sprite sprite-expand-holder i-20\"></span>{0}(共{1}道笔记)</span></td>\r\n", sortInfo.name, examLogInfo.notes);
                }
                stringBuilder.AppendFormat("<td class=\"button-col\">", new object[0]);
                if (examLogInfo.notes > 0)
                {
                    stringBuilder.AppendFormat("<a href=\"questionview.aspx?sortid={0}&action=note\" target=\"_blank\" class=\"btn btn-link link-button\"><span class=\"btn-inner\">查看题目</span></a>", sortInfo.id);
                }
                else
                {
                    stringBuilder.AppendFormat("<span class=\"btn-inner\">查看题目</span>", new object[0]);
                }
                stringBuilder.Append("</td></tr>\r\n");
                if (sortInfo.subcounts > 0)
                {
                    stringBuilder.Append(this.GetChildSort(channelid, sortInfo.id, level + 1));
                }
            }
            return(stringBuilder.ToString());
        }
Пример #37
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(Request["AdminHotelid"]) && !string.IsNullOrEmpty(Request["User_ID"]))
            {
                Hdhoteladmin.Value = Request["AdminHotelid"].ToString();
                HdUser_ID.Value    = Request["User_ID"].ToString();
                StringBuilder sql = new StringBuilder();
                sql.Append(@"SELECT  * FROM  V_Base_UserInfoRoles WHERE   1 = 1  and IsAdmin = '2'  and AdminHotelid = @AdminHotelid  and User_ID = @User_ID   and DeleteMark = '1' and User_Account!='sewa' ");
                SqlParam[] param = new SqlParam[] {
                    new SqlParam("@AdminHotelid", Hdhoteladmin.Value),
                    new SqlParam("@User_ID", HdUser_ID.Value)
                };
                DataTable dt = DataFactory.SqlDataBase().GetDataTableBySQL(sql, param);

                //查询生成当前酒店用户二维码
                if (dt != null && dt.Rows.Count > 0)
                {
                    string id = dt.Rows[0]["User_ID"].ToString();
                    if (dt.Rows[0]["code_img"] != null && dt.Rows[0]["code_img"].ToString() != "" && dt.Rows[0]["code_img"].ToString() != "https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=")
                    {
                        Second_code.Src = dt.Rows[0]["code_img"].ToString();
                    }
                    else
                    {
                        Hashtable hs       = new Hashtable();
                        string    img_name = "https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=" + TemplateMessage.Sen_img("3@" + id, id); //生成永久二维码
                        Second_code.Src = img_name;
                        hs["code_img"]  = img_name;
                        DataFactory.SqlDataBase().UpdateByHashtable("Base_UserInfo", "User_ID", id, hs);
                    }

                    //修改
                    string    sqls = string.Format("select ID,LOGO,CentreLogo,Extension,HotelNameCode,AdminHotelid from Hotel_Admin where AdminHotelid='{0}'", dt.Rows[0]["AdminHotelid"].ToString());
                    DataTable dss  = DataFactory.SqlDataBase().GetDataTableBySQL(new StringBuilder(sqls));
                    if (dss != null && dss.Rows.Count > 0)
                    {
                        //酒店LOGO
                        if (dss.Rows[0]["LOGO"] != null && dss.Rows[0]["LOGO"].ToString() != "")
                        {
                            HotelLogo.Src = "../../upload/image/SN" + dss.Rows[0]["LOGO"];
                        }

                        //酒店名称
                        if (dss.Rows[0]["HotelNameCode"] != null && dss.Rows[0]["HotelNameCode"].ToString() != "")
                        {
                            lblHotelNameCode.Text = dss.Rows[0]["HotelNameCode"].ToString();
                        }

                        //酒店二维码LOGO
                        if (dss.Rows[0]["CentreLogo"] != null && dss.Rows[0]["CentreLogo"].ToString() != "")
                        {
                            Second_codes.Src = "../../upload/image/" + dss.Rows[0]["CentreLogo"];
                        }

                        //推广说明
                        if (dss.Rows[0]["Extension"] != null && dss.Rows[0]["Extension"].ToString() != "")
                        {
                            lblAdvertising.InnerHtml = dss.Rows[0]["Extension"].ToString();
                        }
                    }
                }
            }
        }
Пример #38
0
 /// <summary>
 /// 加载角色里面成员
 /// </summary>
 /// <param name="RoleId">角色主键</param>
 /// <returns></returns>
 public IList GetListMember(StringBuilder where, SqlParam[] param)
 {
     StringBuilder strSql = new StringBuilder();
     strSql.Append(@"SELECT  *
                     FROM    ( SELECT    U.UserId ,
                                         U.Code ,
                                         U.Account,
                                         U.RealName ,
                                         U.Gender ,
                                         U.Mobile ,
                                         I.ItemName AS DutyId ,
                                         IA.ItemName AS TitleId ,
                                         U.Enabled ,
                                         U.SortCode,
                                         ORG.FullName AS DepartmentId,
                                         U.Spell,
                                         U.Description
                                 FROM      AMS_User U
                                         LEFT JOIN AMS_Organization ORG ON ORG.OrganizationId = U.DepartmentId
                                         LEFT JOIN AMS_ItemDetails I ON U.DutyId = I.ItemCode
                                                                         AND I.ItemsId = '137a2d97-d1d9-4752-9c5e-239097e2ed68'
                                         LEFT JOIN AMS_ItemDetails IA ON U.TitleId = IA.ItemCode
                                                                             AND IA.ItemsId = '2acba9e8-5fa7-4b6f-8ebd-56e753dd059a'
                             ) A WHERE 1=1");
     strSql.Append(where);
     strSql.Append(" ORDER BY DepartmentId,SortCode");
     return DbHelper.GetDataListBySQL<AMS_User>(strSql, param);
 }
Пример #39
0
        //更新销售结余后台表 存在出现同一张单出现表体出现相同物料时导致重复创建结余后台表,停用
        private DynamicObjectCollection UpdateForecastBack(DynamicObjectCollection dycupdateForecastBack, SqlParam param)
        {
            //逐行计算更新金额
            long    oldentityid     = 0;
            decimal ForecastBackQTY = 0;
            string  sql             = "";

            foreach (var dydata in dycupdateForecastBack)
            {
                long newentityid = Convert.ToInt64(dydata["FEntryID"]);
                if (oldentityid != newentityid)
                {
                    oldentityid     = newentityid;
                    ForecastBackQTY = Convert.ToDecimal(dydata["FBASEUNITQTY"]);
                }
                if (ForecastBackQTY > 0)
                {/*逐行加
                  * if (ForecastBackQTY >= Convert.ToDecimal(dydata["FQTY"]))
                  * {
                  *     dydata["FQTY"] = 0;
                  *     ForecastBackQTY = ForecastBackQTY + Convert.ToDecimal(dydata["FQTY"]);
                  * }
                  * else
                  * {
                  *     dydata["FQTY"] = Convert.ToDecimal(dydata["FQTY"]) - ForecastBackQTY;
                  *     ForecastBackQTY = 0;
                  * }*/
                    //加首行(避免重复加)
                    dydata["FQTY"]  = Convert.ToDecimal(dydata["FQTY"]) + ForecastBackQTY;
                    ForecastBackQTY = 0;
                }


                sql = string.Format(@"Update JN_T_SAL_ForecastBack   
                set FQTY={0}
                where FID={1}", Convert.ToString(dydata["FQTY"]), Convert.ToString(dydata["ID"]));

                DBUtils.Execute(this.Context, sql);
            }

            /*
             * string sql = string.Empty;
             *
             * sql = string.Format(@"Update JN_T_SAL_ForecastBack as t0
             *  set (FQTY)=(select  a.FQTY-c.FBASEUNITQTY
             *  from JN_T_SAL_ForecastBack a
             *  inner join T_SAL_ORDER b on a.FSALEORGID=b.FSALEORGID and a.FSALERID=b.FSALERID
             *  and a.FSaleDeptId=b.FSALEDEPTID  and a.FSaleGroupId=b.FSALEGROUPID
             *  inner join TABLE(fn_StrSplit(@FID,',',1)) tb on b.Fid=tb.Fid
             *  inner join T_SAL_ORDERENTRY c on b.FID=c.FID and a.FMATERIALID=c.FMATERIALID
             *  and a.FAUXPROPID=c.FAUXPROPID and c.FBaseUnitID=a.FUnitID
             *  inner join t_BD_Stock d on c.FSTOCKID_MX=d.FStockId
             *  where a.FID=t0.FID and d.FMasterId in (100313,100328) )
             *  ");
             *
             * DBUtils.Execute(this.Context, sql, param);*/

            return(null);
        }
Пример #40
0
        // Token: 0x06000070 RID: 112 RVA: 0x0000A4AC File Offset: 0x000086AC
        protected override void View()
        {
            if (this.id > 0)
            {
                this.appinfo = DbHelper.ExecuteModel <AppInfo>(this.id);
            }
            SqlParam sqlParam = DbHelper.MakeAndWhere("appid", this.id);

            if (this.ispost)
            {
                if (this.action == "appupdate")
                {
                    SortAppInfo sortAppInfo = DbHelper.ExecuteModel <SortAppInfo>(this.sortappid);
                    sortAppInfo = FPRequest.GetModel <SortAppInfo>(sortAppInfo, "sort_");
                    if (sortAppInfo.name == "")
                    {
                        this.ShowErr("栏目应用名称不能为空。");
                        return;
                    }
                    DbHelper.ExecuteUpdate <SortAppInfo>(sortAppInfo);
                }
                else if (this.action == "appadd")
                {
                    SortAppInfo sortAppInfo = FPRequest.GetModel <SortAppInfo>(new SortAppInfo(), "sortadd_");
                    sortAppInfo.appid       = this.id;
                    sortAppInfo.installpath = this.appinfo.installpath;
                    if (sortAppInfo.name == "")
                    {
                        this.ShowErr("栏目应用名称不能为空。");
                        return;
                    }
                    DbHelper.ExecuteInsert <SortAppInfo>(sortAppInfo);
                }
                else if (this.action == "appdelete")
                {
                    DbHelper.ExecuteDelete <SortAppInfo>(FPRequest.GetInt("appid"));
                }
                this.sortapplist = DbHelper.ExecuteList <SortAppInfo>(OrderBy.ASC, new SqlParam[]
                {
                    sqlParam
                });
                string text = "";
                foreach (SortAppInfo sortAppInfo2 in this.sortapplist)
                {
                    if (text != "")
                    {
                        text += "|";
                    }
                    string text2 = text;
                    text = string.Concat(new string[]
                    {
                        text2,
                        sortAppInfo2.name,
                        ",",
                        sortAppInfo2.markup,
                        ",",
                        sortAppInfo2.indexpage,
                        ",",
                        sortAppInfo2.viewpage
                    });
                }
                this.appinfo.sortapps = text;
                FPSerializer.Save <AppInfo>(this.appinfo, FPUtils.GetMapPath(this.webpath + this.appinfo.installpath + "/app.config"));
                CacheBll.RemoveSortCache();
                base.Response.Redirect("appsortmanage.aspx?id=" + this.id);
            }
            this.sortapplist = DbHelper.ExecuteList <SortAppInfo>(OrderBy.ASC, new SqlParam[]
            {
                sqlParam
            });
            base.SaveRightURL();
        }
Пример #41
0
        private void bind(string sjhm)
        {
            //获取用户信息
            StringBuilder sqlKeHu = new StringBuilder();

            sqlKeHu.AppendFormat(@"SELECT * FROM dbo.hy_hyzlxxb WHERE sjhm='" + sjhm + "'");
            DataTable dt = DataFactory.SqlDataBase(RequestSession.GetSessionUser().AdminHotelid.ToString()).GetDataTableBySQL(sqlKeHu);

            if (dt.Rows.Count > 0)
            {
                string     adminhotelid = RequestSession.GetSessionUser().AdminHotelid.ToString();//adminhotelid
                string     sql          = string.Format(@"  SELECT (SELECT TOP 1 id FROM dbo.Hotel WHERE Hotel.AdminHotelid=@AdminHotelid)hotelid,Hotel_Admin.type FROM dbo.Hotel_Admin
                    where Hotel_Admin.AdminHotelid=@AdminHotelid");
                SqlParam[] parmAdd      = new SqlParam[] {
                    new SqlParam("@AdminHotelid", adminhotelid)
                };
                DataTable sql1s     = DataFactory.SqlDataBase().GetDataTableBySQL(new StringBuilder(sql), parmAdd);
                string    hotelid   = ""; //酒店ID
                string    hotelType = ""; //酒店类型
                if (sql1s != null && sql1s.Rows.Count > 0)
                {
                    hotelid   = sql1s.Rows[0]["hotelid"].ToString();
                    hotelType = sql1s.Rows[0]["type"].ToString();
                }
                else
                {
                }

                if (dt.Rows[0]["fxurl"] != null && dt.Rows[0]["fxurl"].ToString() != "")
                {
                    fxsrc.Src = "~/QR_code/MemberQRCode/" + dt.Rows[0]["fxurl"] + ".jpg";
                }
                else
                {
                    //查询WeChatInfo,获取NOTIFY_URL
                    //获取用户信息
                    string        NOTIFY_URL = "";
                    StringBuilder sqlInfo    = new StringBuilder();
                    sqlInfo.AppendFormat(@"SELECT * FROM dbo.WeChatInfo WHERE AdminHotelid='" + adminhotelid + "'");
                    DataTable dtInfo = DataFactory.SqlDataBase().GetDataTableBySQL(sqlInfo);
                    if (dtInfo != null && dtInfo.Rows.Count > 0)
                    {
                        NOTIFY_URL = dtInfo.Rows[0]["NOTIFY_URL"].ToString();
                    }
                    else
                    {
                    }

                    QRCodeEncoder qrCodeEncoder = new QRCodeEncoder();
                    qrCodeEncoder.QRCodeEncodeMode   = QRCodeEncoder.ENCODE_MODE.BYTE;
                    qrCodeEncoder.QRCodeErrorCorrect = QRCodeEncoder.ERROR_CORRECTION.M;
                    qrCodeEncoder.QRCodeVersion      = 0;//范围值是0-40
                    qrCodeEncoder.QRCodeScale        = 4;
                    String data;
                    if (hotelType == "0")
                    {
                        data = "http://" + NOTIFY_URL + "/Reservation/HotelDetails.aspx?AdminHotelid=" + adminhotelid + "&hotelid=" + hotelid + "&sjhm=" + sjhm + "";
                    }
                    else
                    {
                        data = "http://" + NOTIFY_URL + "/Reservation/HotelList.aspx?AdminHotelid=" + adminhotelid;
                    }
                    System.Drawing.Bitmap  image   = qrCodeEncoder.Encode(data, Encoding.UTF8);
                    System.IO.MemoryStream MStream = new System.IO.MemoryStream();
                    string filename = DateTime.Now.ToString("yyyyMMddHHmmssfff") + hotelid;

                    image.Save(Server.MapPath("~/QR_code/MemberQRCode/") + filename + ".jpg");
                    image.Save(MStream, System.Drawing.Imaging.ImageFormat.Gif);
                    fxsrc.Src     = "~/QR_code/MemberQRCode/" + filename + ".jpg";
                    hdFxurl.Value = filename + ".jpg";
                    StringBuilder sqlUpdateKeHu = new StringBuilder();
                    sqlUpdateKeHu.AppendFormat(@"update Base_UserInfo set  fxurl='" + filename + "'  where User_Account='" + sjhm + "'");
                    DataTable dtUpdate = DataFactory.SqlDataBase().GetDataTableBySQL(sqlUpdateKeHu);
                }
            }
            else
            {
                return;
                //Response.Redirect("../member/MemberCenter.aspx");
            }
        }
Пример #42
0
 // Token: 0x0600031F RID: 799 RVA: 0x0000D54C File Offset: 0x0000B74C
 protected override void View()
 {
     if (this.reurl == "")
     {
         this.reurl = "login.aspx";
     }
     this.regconfig = RegConfigs.GetRegConfig();
     if (this.ispost)
     {
         if (this.userid > 0)
         {
             this.ShowErr("对不起,系统不允许重复注册用户。");
         }
         else if (this.regconfig.regstatus != 1)
         {
             this.ShowErr("对不起,系统目前暂不允许新用户注册。");
         }
         else
         {
             if (this.regconfig.regctrl > 0)
             {
                 SqlParam sqlParam = DbHelper.MakeAndWhere("regip", FPRequest.GetIP());
                 UserInfo userInfo = DbHelper.ExecuteModel <UserInfo>(new SqlParam[]
                 {
                     sqlParam
                 });
                 if (userInfo.id > 0)
                 {
                     int num = this.StrDateDiffHours(userInfo.joindatetime, this.regconfig.regctrl);
                     if (num < 0)
                     {
                         this.ShowErr("抱歉,系统设置了IP注册间隔限制,您必须在 " + (num * -1).ToString() + " 小时后才可以重新注册");
                         return;
                     }
                 }
             }
             if (this.regconfig.ipregctrl.Trim() != "")
             {
                 string[] iparray = FPUtils.SplitString(this.regconfig.ipregctrl, "|");
                 if (FPUtils.InIPArray(FPRequest.GetIP(), iparray))
                 {
                     this.ShowErr("抱歉,系统设置了IP注册限制,您所在的IP段不允许注册。");
                     return;
                 }
             }
             string @string = FPRequest.GetString("username");
             string string2 = FPRequest.GetString("password");
             string text    = FPRequest.GetString("email").Trim().ToLower();
             string string3 = FPRequest.GetString("realname");
             string string4 = FPRequest.GetString("idcard");
             string text2   = FPRequest.GetString("mobile").Trim();
             if (@string.Equals(""))
             {
                 this.ShowErr("用户名不能为空。");
             }
             else if (@string.Length < 3)
             {
                 this.ShowErr("对不起,用户名不能小于3个字符");
             }
             else if (@string.Length > 20)
             {
                 this.ShowErr("对不起,用户名不能大于20个字符");
             }
             else if (!FPUtils.IsSafeSqlString(@string))
             {
                 this.ShowErr("对不起,您使用的用户名有敏感字符");
             }
             else if (this.InRestrictArray(@string, this.regconfig.restrict))
             {
                 this.ShowErr("对不起,该用户名:" + @string + " 不允许使用");
             }
             else if (UserBll.CheckUserName(@string))
             {
                 this.ShowErr("该用户名已经存在,请使用别的用户名。");
             }
             else if (string2.Equals(""))
             {
                 this.ShowErr("密码不能为空");
             }
             else if (string2 != FPRequest.GetString("repeat"))
             {
                 this.ShowErr("对不起,两次输入密码不相同");
             }
             else if (this.regconfig.email == 1 && text == "")
             {
                 this.ShowErr("Email不能为空");
             }
             else if (text.Trim() != "" && !FPUtils.IsEmail(text))
             {
                 this.ShowErr("Email格式不正确");
             }
             else
             {
                 if (text.Trim() != "")
                 {
                     if (DbHelper.ExecuteCount <UserInfo>("[email]='" + text + "'") > 0)
                     {
                         this.ShowErr("邮箱: \"" + text + "\" 已经被其他用户使用");
                         return;
                     }
                 }
                 string emailHostName = this.GetEmailHostName(text);
                 if (text.Trim() != "" && this.regconfig.accessemail.Trim() != "")
                 {
                     if (!FPUtils.InArray(emailHostName, this.regconfig.accessemail, "|"))
                     {
                         this.ShowErr("本站点只允许使用以下域名的Email地址注册:" + this.regconfig.accessemail);
                         return;
                     }
                 }
                 else if (text.Trim() != "" && this.regconfig.censoremail.Trim() != "")
                 {
                     if (FPUtils.InArray(text, this.regconfig.censoremail, "|"))
                     {
                         this.ShowErr("本站点不允许使用以下域名的Email地址注册: " + this.regconfig.censoremail);
                         return;
                     }
                 }
                 if (this.regconfig.realname == 1)
                 {
                     if (string3.Equals(""))
                     {
                         this.ShowErr("真实姓名不能为空");
                         return;
                     }
                 }
                 if (this.InRestrictArray(string3, this.regconfig.restrict))
                 {
                     this.ShowErr("对不起,该姓名:[" + string3 + "]不允许使用");
                 }
                 else
                 {
                     if (this.regconfig.mobile == 1)
                     {
                         if (text2.Equals(""))
                         {
                             this.ShowErr("手机号码不能为空");
                             return;
                         }
                     }
                     if (text2.Trim().Length > 20)
                     {
                         this.ShowErr("手机号码不能大于20个字符");
                     }
                     else if (text2.Trim() != "" && !Regex.IsMatch(text2.Trim(), "^[\\d|-]+$"))
                     {
                         this.ShowErr("手机号码中含有非法字符");
                     }
                     else
                     {
                         if (this.regconfig.rules == 1)
                         {
                             if (FPRequest.GetInt("rules", 0) != 1)
                             {
                                 this.ShowErr("对不起,您没有选择同意网站许可协议");
                                 return;
                             }
                         }
                         if (this.isseccode)
                         {
                             if (FPRequest.GetString("verify").Equals(""))
                             {
                                 this.ShowErr("验证码不能为空");
                                 return;
                             }
                             if (!this.isvalid)
                             {
                                 this.ShowErr("验证码错误");
                                 return;
                             }
                         }
                         this.iuser              = FPRequest.GetModel <UserInfo>();
                         this.iuser.password     = FPUtils.MD5(this.iuser.password);
                         this.iuser.credits      = this.regconfig.credit;
                         this.iuser.regip        = FPRequest.GetIP();
                         this.iuser.joindatetime = DbUtils.GetDateTime();
                         if (this.regconfig.regverify == 1)
                         {
                             this.iuser.authstr  = "";
                             this.iuser.authflag = 1;
                             this.iuser.roleid   = 3;
                         }
                         else if (this.regconfig.regverify == 2)
                         {
                             this.iuser.authstr  = WMSUtils.CreateAuthStr(20);
                             this.iuser.authflag = 1;
                             this.iuser.roleid   = 3;
                             string newValue = string.Concat(new string[]
                             {
                                 "<pre style=\"width:100%;word-wrap:break-word\"><a href=\"http://",
                                 this.domain,
                                 this.rawpath,
                                 "activationuser.aspx?authstr=",
                                 this.iuser.authstr,
                                 "\"  target=\"_blank\">http://",
                                 this.domain,
                                 this.rawpath,
                                 "activationuser.aspx?authstr=",
                                 this.iuser.authstr,
                                 "</a></pre>"
                             });
                             MsgTempInfo msgTemplate = MsgTempBll.GetMsgTemplate("email_register");
                             msgTemplate.content = msgTemplate.content.Replace("【用户名】", this.iuser.username).Replace("【邮箱帐号】", this.iuser.email).Replace("【激活链接】", newValue);
                             Email.Send(text, msgTemplate.name, msgTemplate.content);
                         }
                         else
                         {
                             this.iuser.authstr  = "";
                             this.iuser.authflag = 0;
                             this.iuser.roleid   = 5;
                         }
                         this.iuser.id = DbHelper.ExecuteInsert <UserInfo>(this.iuser);
                         if (this.iuser.id > 0)
                         {
                             if (this.regconfig.credit > 0 && this.iuser.credits > 0)
                             {
                                 UserBll.Credit_AddLog(this.iuser.id, "用户注册", 0, this.iuser.credits);
                             }
                             if (this.regconfig.regverify == 1)
                             {
                                 base.AddMsg("注册成功, 但需要等待管理员审核后您的帐户才能生效。");
                             }
                             else if (this.regconfig.regverify == 2)
                             {
                                 base.AddMsg("您的注册邮箱[" + this.iuser.email + "]将收到一封认证邮件,请登录您的邮箱查收,并点击邮件中的链接完成激活。激活成功后,可以使用站内所有功能,再次感谢您的加入。");
                             }
                             else
                             {
                                 base.AddMsg("注册成功, 请点击下面链接返回登录。");
                             }
                         }
                         else
                         {
                             this.ShowErr("注册失败,请检查输入是否正确。");
                         }
                     }
                 }
             }
         }
     }
 }
Пример #43
0
        public static void Login(string username, string password)
        {
            string sql = "SELECT id,password FROM userinfo WHERE username=@name";
            SqlParam data = new SqlParam { { "@name", username } };
            Database db = new Database();
            SqlDataReader reader = db.Query(sql, data);

            if (!reader.Read()) {
                reader.Close();
                db.Close();
                throw new UserException("用户名不存在");
            }

            string hashedPassword = (string)reader["password"];
            int id = (int)reader["id"];
            reader.Close();
            db.Close();

            if (HashPassword(password) != hashedPassword) {
                throw new UserException("密码错误");
            }

            HttpContext.Current.Session["UserId"] = id;
            JumpPageBack();
        }
Пример #44
0
 /// <summary>
 /// 获得数据列表(带条件)
 /// </summary>
 /// <param name="where">条件</param>
 /// <param name="param">参数化</param>
 /// <returns></returns>
 public IList GetListWhere(StringBuilder where, SqlParam[] param)
 {
     StringBuilder strSql = new StringBuilder();
     strSql.Append("SELECT * FROM AMS_InterfaceAccess WHERE 1=1");
     strSql.Append(where);
     return DbHelper.GetDataListBySQL<AMS_InterfaceAccess>(strSql, param);
 }
Пример #45
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (!string.IsNullOrEmpty(Request.QueryString["MemberId"]))
                {
                    string AdminHotelid = hdAdminHotelid.Value = RequestSession.GetSessionUser().AdminHotelid.ToString();
                    string MemberId     = hdMemberId.Value = Request.QueryString["MemberId"];
                    string RechargeId   = Request.QueryString["RechargeId"];

                    Bind(AdminHotelid, MemberId);//加载用户信息

                    //判断当前用户是否存在打印表
                    string newTime = DateTime.Now.ToString();                                         //当前时间
                    spPrintTime.InnerHtml = Convert.ToDateTime(newTime).ToString("yyyy-mm-dd HH:mm"); //打印时间

                    string        Code_Url = "http://www.zidinn.com/Melt/Card_Pay.aspx?AdminHotelid=" + AdminHotelid + "&MemberId=" + MemberId;
                    StringBuilder sb       = new StringBuilder();
                    sb.Append(@"
                    SELECT  *  FROM    ReceiptInfo 
                    WHERE   AdminHotelid =@AdminHotelid and MemberId=@MemberId
                    ");
                    SqlParam[] param = new SqlParam[] {
                        new SqlParam("@AdminHotelid", AdminHotelid),
                        new SqlParam("@MemberId", MemberId)
                    };
                    DataTable dt = DataFactory.SqlDataBase().GetDataTableBySQL(sb, param);
                    if (dt != null && dt.Rows.Count > 0)
                    {
                        hdId.Value = dt.Rows[0]["ID"].ToString();
                        string Img_path = dt.Rows[0]["CodeImg"].ToString();
                        if (dt.Rows[0]["Effective"].ToString() == "0")
                        {
                            //判断打印时间是否超过两小时
                            string PrintTime = Convert.ToDateTime(dt.Rows[0]["PrintTime"]).AddHours(2).ToString(); //开始时间
                            if (Convert.ToDateTime(PrintTime) > Convert.ToDateTime(newTime))                       //有效时间
                            {
                                try
                                {
                                    //判断文件的存在
                                    if (System.IO.File.Exists(HttpContext.Current.Server.MapPath("..") + "\\..\\SysSetBase\\memInfo\\PayImg\\" + Img_path))
                                    {
                                        erweima.Src = "~/SysSetBase/memInfo/PayImg/" + Img_path;
                                    }
                                }
                                catch { }
                            }
                            else //超过时间(重新生成码)
                            {
                                try
                                {
                                    //判断文件的存在
                                    if (System.IO.File.Exists(HttpContext.Current.Server.MapPath("..") + "\\..\\SysSetBase\\memInfo\\PayImg\\" + Img_path))
                                    {
                                        FileInfo file;
                                        file = new FileInfo(Server.MapPath("..") + "\\..\\SysSetBase\\memInfo\\PayImg\\" + Img_path);
                                        file.Delete();
                                    }
                                }
                                catch { }

                                Bitmap        bt            = new Bitmap(500, 500);
                                QRCodeEncoder qrCodeEncoder = new QRCodeEncoder();
                                qrCodeEncoder.QRCodeEncodeMode   = QRCodeEncoder.ENCODE_MODE.BYTE;
                                qrCodeEncoder.QRCodeScale        = 4;
                                qrCodeEncoder.QRCodeVersion      = 8;
                                qrCodeEncoder.QRCodeErrorCorrect = QRCodeEncoder.ERROR_CORRECTION.M;
                                String data = Code_Url;
                                System.Drawing.Bitmap  image   = qrCodeEncoder.Encode(data, Encoding.UTF8);
                                System.IO.MemoryStream MStream = new System.IO.MemoryStream();
                                string filename = DateTime.Now.ToString("yyyyMMddHHmmssfff") + ".jpg";
                                image.Save(Server.MapPath("~/SysSetBase/memInfo/PayImg/") + filename);
                                image.Save(MStream, System.Drawing.Imaging.ImageFormat.Gif);
                                erweima.Src = "~/SysSetBase/memInfo/PayImg/" + filename;

                                //更新图片信息
                                Hashtable hs = new Hashtable();
                                hs["PrintTime"] = newTime; //打印时间;
                                hs["CodeImg"]   = filename;
                                DataFactory.SqlDataBase().UpdateByHashtable("ReceiptInfo", "ID", dt.Rows[0]["ID"].ToString(), hs);
                            }
                        }
                        else
                        {
                            try
                            {
                                //判断文件的存在
                                if (System.IO.File.Exists(HttpContext.Current.Server.MapPath("..") + "\\..\\SysSetBase\\memInfo\\PayImg\\" + Img_path))
                                {
                                    erweima.Src = "~/SysSetBase/memInfo/PayImg/" + Img_path;
                                }
                            }
                            catch { }
                        }
                    }
                    else
                    {
                        Hashtable hs = new Hashtable();
                        hs["MemberId"]    = hdMemberId.Value;
                        hs["CardNumber"]  = spCardNumber.InnerHtml;
                        hs["MemberLevel"] = spMemberLevel.InnerHtml;
                        hs["Name"]        = spName.InnerHtml;
                        hs["Phone"]       = spPhone.InnerHtml;
                        hs["PrintTime"]   = newTime; //打印时间;
                        //hs["TopUpMoney"] = spTopUpMoney.InnerHtml;
                        //hs["Consumption"] = spConsumption.InnerHtml;
                        hs["Remaining"]    = spRemaining.InnerHtml;
                        hs["RulesContent"] = "";
                        hs["Adminhotelid"] = hdAdminHotelid.Value;

                        Bitmap        bt            = new Bitmap(500, 500);
                        QRCodeEncoder qrCodeEncoder = new QRCodeEncoder();
                        qrCodeEncoder.QRCodeEncodeMode   = QRCodeEncoder.ENCODE_MODE.BYTE;
                        qrCodeEncoder.QRCodeScale        = 4;
                        qrCodeEncoder.QRCodeVersion      = 8;
                        qrCodeEncoder.QRCodeErrorCorrect = QRCodeEncoder.ERROR_CORRECTION.M;
                        String data = Code_Url;
                        System.Drawing.Bitmap  image   = qrCodeEncoder.Encode(data, Encoding.UTF8);
                        System.IO.MemoryStream MStream = new System.IO.MemoryStream();
                        string filename = DateTime.Now.ToString("yyyyMMddHHmmssfff") + ".jpg";
                        image.Save(Server.MapPath("~/SysSetBase/memInfo/PayImg/") + filename);
                        image.Save(MStream, System.Drawing.Imaging.ImageFormat.Gif);
                        erweima.Src = "~/SysSetBase/memInfo/PayImg/" + filename;

                        hs["CodeImg"] = filename;
                        int Rid = DataFactory.SqlDataBase().InsertByHashtableReturnPkVal("ReceiptInfo", hs);
                        if (Rid > 0)
                        {
                            hdId.Value = Rid.ToString();
                        }
                    }
                }
            }
        }
Пример #46
0
 /// <summary>
 /// 获取记录总数(带条件)
 /// </summary>
 /// <param name="where">条件</param>
 /// <param name="param">参数化</param>
 /// <returns></returns>
 public int GetRecordCount(StringBuilder where, SqlParam[] param)
 {
     return DbUtils.RecordCount("AMS_TableColumns", where, param);
 }
Пример #47
0
 /// <summary>
 /// 获取记录总数(带条件)
 /// </summary>
 /// <param name="where">条件</param>
 /// <param name="param">参数化</param>
 /// <returns></returns>
 public int GetRecordCount(StringBuilder where, SqlParam[] param)
 {
     return DbUtils.RecordCount("AMS_Button", where, param);
 }
Пример #48
0
        /// <summary>
        /// 批量新增 接口,接口参数
        /// </summary>
        /// <param name="InterfaceFrom">接口配置</param>
        /// <param name="InterfaceDetailsFrom">接口参数明细</param>
        /// <param name="key">主键</param>
        /// <returns></returns>
        public int AddInterfaceManage(object[] InterfaceFrom, object[] InterfaceDetailsFrom, string key)
        {
            //return dal.AddInterfaceManage(InterfaceFrom, InterfaceDetailsFrom, key);

            try
            {
                StringBuilder[] sqls = new StringBuilder[InterfaceDetailsFrom.Length + 2];
                object[] objs = new object[InterfaceDetailsFrom.Length + 2];
                Hashtable ht_Interface = new Hashtable();
                foreach (string item in InterfaceFrom)
                {
                    if (item.Length > 0)
                    {
                        string[] str_item = item.Split('☻');
                        ht_Interface[str_item[0]] = str_item[1];
                    }
                }
                if (!string.IsNullOrEmpty(key))
                {
                    ht_Interface["InterfaceId"] = key;
                    ht_Interface["ModifyDate"] = DateTime.Now;
                    ht_Interface["ModifyUserId"] = RequestSession.GetSessionUser().UserId;
                    ht_Interface["ModifyUserName"] = RequestSession.GetSessionUser().UserName;
                }
                else
                {
                    ht_Interface["InterfaceId"] = CommonHelper.GetGuid;
                    ht_Interface["CreateUserId"] = RequestSession.GetSessionUser().UserId;
                    ht_Interface["CreateUserName"] = RequestSession.GetSessionUser().UserName;
                }
                sqls[0] = !string.IsNullOrEmpty(key) ? SqlParamHelper.UpdateSql("BASE_InterfaceManage", "InterfaceId", ht_Interface) : SqlParamHelper.InsertSql("BASE_InterfaceManage", ht_Interface);
                objs[0] = SqlParamHelper.GetParameter(ht_Interface);
                sqls[1] = SqlParamHelper.DeleteSql("BASE_InterfaceManageDetails", "InterfaceId");
                objs[1] = new SqlParam[] { new SqlParam("@InterfaceId", key) };
                int index = 2;
                foreach (string item in InterfaceDetailsFrom)
                {
                    if (item.Length > 0)
                    {
                        Hashtable ht_InterfaceDetails = new Hashtable();
                        foreach (string itemwithin in item.Split('☺'))
                        {
                            if (itemwithin.Length > 0)
                            {
                                string[] str_item = itemwithin.Split('☻');
                                ht_InterfaceDetails[str_item[0]] = str_item[1];
                                if (str_item[0].ToString() == "FieldMinLength")
                                {
                                    ht_InterfaceDetails[str_item[0]] = str_item[1] == "true" ? 0 : 1;
                                }
                                if (str_item[0].ToString() == "Enabled")
                                {
                                    ht_InterfaceDetails[str_item[0]] = str_item[1] == "true" ? 0 : 1;
                                }
                            }
                        }
                        ht_InterfaceDetails["InterfaceDetailsId"] = CommonHelper.GetGuid;
                        ht_InterfaceDetails["InterfaceId"] = ht_Interface["InterfaceId"];
                        sqls[index] = SqlParamHelper.InsertSql("BASE_InterfaceManageDetails", ht_InterfaceDetails); ;
                        objs[index] = SqlParamHelper.GetParameter(ht_InterfaceDetails);
                        index++;
                    }
                }
                return DbHelper.BatchExecuteBySql(sqls, objs);
            }
            catch
            {
                return -1;
            }
        }
Пример #49
0
        private void Bind(string AdminHotelid, string MemberId)
        {
            //查询会员卡余额
            StringBuilder sbhy = new StringBuilder();

            sbhy.Append(@"
            SELECT  hy.lsh ,
                    hy.kh ,
                    hy.xm ,
                    hy.sjhm ,
                    mb.hylxname ,
                    CONVERT(VARCHAR(100), hy.addtime, 23) AS addtime ,
                    ISNULL(hy.hykye, 0) AS hykye
            FROM    hy_hyzlxxb hy ,
                    hy_hylxbmb mb
            WHERE   hy.hylx = mb.hylxcode and hy.lsh=@MemberId
            ");
            SqlParam[] parmhy = new SqlParam[] {
                new SqlParam("@MemberId", MemberId)
            };
            DataTable ds = DataFactory.SqlDataBase(AdminHotelid).GetDataTableBySQL(sbhy, parmhy);

            if (ds != null && ds.Rows.Count > 0)
            {
                if (ds.Rows[0]["kh"] != null && ds.Rows[0]["kh"].ToString() != "")
                {
                    spCardNumber.InnerHtml = ds.Rows[0]["kh"].ToString();
                }

                if (ds.Rows[0]["hylxname"] != null && ds.Rows[0]["hylxname"].ToString() != "")
                {
                    spMemberLevel.InnerHtml = ds.Rows[0]["hylxname"].ToString();
                }

                if (ds.Rows[0]["xm"] != null && ds.Rows[0]["xm"].ToString() != "")
                {
                    spName.InnerHtml = ds.Rows[0]["xm"].ToString();
                }

                if (ds.Rows[0]["sjhm"] != null && ds.Rows[0]["sjhm"].ToString() != "")
                {
                    spPhone.InnerHtml = ds.Rows[0]["sjhm"].ToString();
                }
                spRemaining.InnerHtml = Convert.ToDouble(ds.Rows[0]["hykye"]).ToString();
            }

            //加载酒店信息
            StringBuilder sb_hotel = new StringBuilder();

            sb_hotel.Append(@"SELECT Name  FROM Hotel_Admin WHERE AdminHotelid=@AdminHotelid and DeleteMark=1 ");
            SqlParam[] parm_hotel = new SqlParam[] {
                new SqlParam("@AdminHotelid", AdminHotelid)
            };
            DataTable dt_hotel = DataFactory.SqlDataBase().GetDataTableBySQL(sb_hotel, parm_hotel);

            if (dt_hotel != null && dt_hotel.Rows.Count > 0)
            {
                if (dt_hotel.Rows[0]["Name"] != null && dt_hotel.Rows[0]["Name"].ToString() != "")
                {
                    spHotelName.InnerHtml = dt_hotel.Rows[0]["Name"].ToString();
                }
            }

            //加载规则信息
            StringBuilder sb_rule = new StringBuilder();

            sb_rule.Append(@"SELECT RulesContent  FROM ReceiptRules WHERE AdminHotelid=@AdminHotelid ");
            SqlParam[] parm_rule = new SqlParam[] {
                new SqlParam("@AdminHotelid", AdminHotelid)
            };
            DataTable dt_rule = DataFactory.SqlDataBase().GetDataTableBySQL(sb_rule, parm_rule);

            if (dt_rule != null && dt_rule.Rows.Count > 0)
            {
                if (dt_rule.Rows[0]["RulesContent"] != null && dt_rule.Rows[0]["RulesContent"].ToString() != "")
                {
                    RulesContent.InnerHtml = dt_rule.Rows[0]["RulesContent"].ToString();
                }
            }
        }
Пример #50
0
 public void AddParam(string pName, string pValue)
 {
     SqlParam sp = new SqlParam(pName, pValue);
     param.Add(sp);
 }
Пример #51
0
 /// <summary>
 /// 分页获取数据列表(带条件)
 /// </summary>
 /// <param name="where">条件</param>
 /// <param name="param">参数化</param>
 /// <param name="orderField">排序字段</param>
 /// <param name="orderType">排序类型</param>
 /// <param name="pageIndex">当前页</param>
 /// <param name="pageSize">页大小</param>
 /// <param name="count">总条数</param>
 /// <returns></returns>
 public IList GetPageListWhere(StringBuilder where, SqlParam[] param, string orderField, string orderType, int pageIndex, int pageSize, ref int count)
 {
     StringBuilder strSql = new StringBuilder();
     strSql.Append(@"SELECT  *
                     FROM    ( SELECT  U.UserId ,
                             U.Code ,
                             U.Account ,
                             U.RealName ,
                             U.Gender ,
                             U.Email ,
                             U.Mobile ,
                             U.OICQ ,
                             U.Enabled ,
                             U.SortCode ,
                             ORGA.FullName AS CompanyId ,
                             ORG.FullName AS DepartmentId ,
                             U.Spell ,
                             U.LogOnCount ,
                             U.LastVisit ,
                             U.Description
                     FROM    BASE_USER U
                             LEFT JOIN AMS_Organization ORG ON ORG.OrganizationId = U.DepartmentId
                             LEFT JOIN AMS_Organization ORGA ON ORGA.OrganizationId = U.CompanyId");
     strSql.Append(" WHERE 1=1 " + DataPermission.Instance.User + ") A WHERE 1=1");
     strSql.Append(where);
     return DbHelper.GetPageList<BASE_USER>(strSql.ToString(), param, "CompanyId," + CommonHelper.ToOrderField("SortCode", orderField), orderType, pageIndex, pageSize, ref count);
 }
Пример #52
0
        /// <summary>
        /// 公众号关注自动回复事件
        /// </summary>
        /// <param name="ToUserName">开发者微信号</param>
        /// <param name="FromUserName">自己的OPENID</param>
        /// <param name="CreateTime">消息创建时间 (整型)</param>
        public static string Automatic_Focus(string ToUserName, string FromUserName, string CreateTime)
        {
            string resxml  = "";
            string context = "欢迎关注!";

            resxml = "<xml><ToUserName><![CDATA[" + FromUserName + "]]></ToUserName><FromUserName><![CDATA[" + ToUserName + "]]></FromUserName><CreateTime>" + CreateTime + "</CreateTime><MsgType><![CDATA[text]]></MsgType><Content><![CDATA[" + context + "]]></Content></xml> ";

            StringBuilder sb = new StringBuilder();

            sb.Append(@"
            SELECT  w.AdminHotelid ,
                    h.Name ,
                    h.type ,
                    ISNULL(( SELECT TOP 1
                                    ImgFile
                             FROM   Photo
                             WHERE  [type] = '9'
                                    AND AdminHotelid = h.AdminHotelid
                             ORDER BY hotelid,ID ASC
                           ), '') images,
                           r.content,
                           r.photo,
                           r.bt,
                           r.url
            FROM    dbo.WeChatInfo w
                    INNER JOIN dbo.Hotel_Admin h ON w.AdminHotelid = h.AdminHotelid
                    LEFT JOIN Reply_attention r ON r.AdminHotelid = h.AdminHotelid 
            WHERE   w.Original_ID = @Original_ID
                    AND h.AdminHotelid <> '1'
            ");
            SqlParam[] param = new SqlParam[] {
                new SqlParam("@Original_ID", ToUserName.Trim())
            };
            DataTable dt = DataFactory.SqlDataBase().GetDataTableBySQL(sb, param);

            if (dt != null && dt.Rows.Count > 0)
            {
                string AdminHotelid = dt.Rows[0]["AdminHotelid"].ToString();
                string url          = HttpContext.Current.Request.Url.ToString();
                url = url.Substring(0, url.LastIndexOf("/"));

                string picUrl = url + "/Marketing/images/fuli.jpg";

                string images = dt.Rows[0]["images"].ToString();
                if (images != "")
                {
                    picUrl = url + "/upload/photo/SN" + images;
                }
                string wyrul = url + "/Reservation/HotelList.aspx?AdminHotelid=" + AdminHotelid;
                context = "欢迎关注" + dt.Rows[0]["Name"] + "!";
                string contexts = "倾听感动,分享喜悦,“" + dt.Rows[0]["Name"] + "微管家”与您24小时贴身相伴。立即点击预订吧!";
                //自定义关注图文推送
                try
                {
                    contexts = dt.Rows[0]["content"].ToString() == "" ? contexts : dt.Rows[0]["content"].ToString();
                    context  = dt.Rows[0]["bt"].ToString() == "" ? context : dt.Rows[0]["bt"].ToString();
                    wyrul    = dt.Rows[0]["url"].ToString() == "" ? wyrul : dt.Rows[0]["url"].ToString();
                    picUrl   = dt.Rows[0]["photo"].ToString() == "" ? picUrl : url + "/upload/Reply/" + dt.Rows[0]["photo"].ToString();
                }
                catch { }
                resxml = "<xml><ToUserName><![CDATA[" + FromUserName + "]]></ToUserName><FromUserName><![CDATA[" + ToUserName + "]]></FromUserName><CreateTime>" + CreateTime + "</CreateTime><MsgType><![CDATA[news]]></MsgType><ArticleCount>1</ArticleCount><Articles><item><Title><![CDATA[" + context + "]]></Title><Description><![CDATA[" + contexts + "]]></Description><PicUrl><![CDATA[" + picUrl + "]]></PicUrl><Url><![CDATA[" + wyrul + "]]></Url></item></Articles></xml> ";
            }
            return(resxml);
        }
Пример #53
0
 // Token: 0x0600030B RID: 779 RVA: 0x0000C6D4 File Offset: 0x0000A8D4
 protected override void View()
 {
     if (this.ispost)
     {
         UserInfo userInfo = UserBll.GetUserInfo(this.userid);
         if (userInfo.ismobile == 1)
         {
             this.ShowErr("您的手机已通过了验证。");
         }
         else
         {
             string @string = FPRequest.GetString("mobile");
             if (@string.Trim().Length > 20)
             {
                 this.ShowErr("手机号码不能大于20个字符");
             }
             else if (@string.Trim() != "" && !Regex.IsMatch(@string.Trim(), "^[\\d|-]+$"))
             {
                 this.ShowErr("手机号码中含有非法字符");
             }
             else
             {
                 string string2   = FPRequest.GetString("code");
                 string clientsms = string.Concat(new object[]
                 {
                     @string,
                     "|",
                     string2,
                     "|",
                     DbUtils.GetDateTime()
                 });
                 if (this.Session["FP_SMSVERIFY"] != null)
                 {
                     string serversms = this.Session["FP_SMSVERIFY"].ToString();
                     int    num       = SMS.CheckSMS(clientsms, serversms);
                     if (num == 1)
                     {
                         SqlParam[] sqlparams = new SqlParam[]
                         {
                             DbHelper.MakeSet("ismobile", 1),
                             DbHelper.MakeSet("mobile", @string),
                             DbHelper.MakeAndWhere("id", this.userid)
                         };
                         DbHelper.ExecuteUpdate <UserInfo>(sqlparams);
                         base.ResetUser();
                         base.AddMsg("手机号码已绑定成功!");
                     }
                     else if (num == 0)
                     {
                         this.ShowErr("验证手机号码不正确。");
                     }
                     else if (num == -1)
                     {
                         this.ShowErr("验证码不正确。");
                     }
                     else if (num == -2)
                     {
                         this.ShowErr("验证码已过期。");
                     }
                 }
                 else
                 {
                     this.ShowErr("无效验证码。");
                 }
             }
         }
     }
 }
Пример #54
0
        ///// <summary>
        ///// 用户扫码订房事件
        ///// </summary>
        ///// <param name="ToUserName">开发者微信号</param>
        ///// <param name="EventKey">餐厅餐桌ID</param>
        ///// <param name="FromUserName">自己的OPENID</param>
        /////  <param name="FromUserName">消息创建时间(整型)</param>
        ///// <returns></returns>
        //private string Scan_code(string ToUserName, string EventKey, string FromUserName, string CreateTime, string type)
        //{
        //    string resxml = "";
        //    string id = EventKey;
        //    string sql = string.Format(@"SELECT  id , sort , number ,isdelete , code_img ,  Catering_id FROM WX_board where id='{0}' and isdelete=1 ", id);
        //    DataTable ds = DataFactory.SqlDataBase().GetDataTableBySQL(new StringBuilder(sql));
        //    if (ds != null && ds.Rows.Count > 0)
        //    {
        //        string context = wxhy(FromUserName, id);
        //        Hashtable hs = new Hashtable();
        //        hs["board_id"] = id;
        //        hs["CateringId"] = ds.Rows[0]["Catering_id"];
        //        DataFactory.SqlDataBase().InsertByHashtable("WX_boardList", hs);

        //        resxml = automatic_hf(context, ToUserName, FromUserName, CreateTime);

        //    }
        //    else
        //    {
        //        resxml = automatic_hf("该二维码已失效", ToUserName, FromUserName, CreateTime);
        //    }
        //    return resxml;
        //}

        /// <summary>
        /// 关键字回复
        /// </summary>
        /// <param name="text">关键字</param>
        /// <param name="ToUserName">开发者微信号</param>
        /// <param name="FromUserName">自己的OPENID</param>
        /// <param name="CreateTime">消息创建时间(整型)</param>
        /// <returns></returns>
        public static string reply(string text, string ToUserName, string FromUserName, string CreateTime)
        {
            string AdminHotelid = adminhotelid(ToUserName);

            if (AdminHotelid == "")
            {
                return("");
            }
            StringBuilder sql = new StringBuilder();

            sql.Append("select id,name,media_id,content,code_img,Reply_id,type from Replylist where AdminHotelid=@AdminHotelid and  name like @name ");
            SqlParam[] param = new SqlParam[] {
                new SqlParam("@AdminHotelid", AdminHotelid),
                new SqlParam("@name", "%" + text + "%")
            };

            string    resxml = "";
            DataTable ds     = DataFactory.SqlDataBase().GetDataTableBySQL(sql, param);

            if (ds != null && ds.Rows.Count > 0)
            {
                if (ds.Rows[0]["type"].ToString() == "1")
                {  //文字回复
                    resxml = automatic_hf(ds.Rows[0]["content"].ToString(), ToUserName, FromUserName, CreateTime, AdminHotelid);
                }
                else if (ds.Rows[0]["type"].ToString() == "2") //图片回复
                {
                    resxml = "<xml><ToUserName><![CDATA[" + FromUserName + "]]></ToUserName><FromUserName><![CDATA[" + ToUserName + "]]></FromUserName><CreateTime>" + CreateTime + "</CreateTime><MsgType><![CDATA[image]]></MsgType><Image><MediaId><![CDATA[" + ds.Rows[0]["media_id"].ToString() + "]]></MediaId></Image></xml> ";
                }

                if (ds.Rows[0]["name"].ToString() == text)
                {
                    Hashtable hs = new Hashtable();
                    hs["Reply_id"]     = ds.Rows[0]["Reply_id"].ToString();
                    hs["ReplyList_id"] = ds.Rows[0]["id"].ToString();
                    hs["type"]         = 2; //全匹配
                    hs["AdminHotelid"] = AdminHotelid;
                    DataFactory.SqlDataBase().InsertByHashtable("Reply_user", hs);
                }
                else
                {
                    Hashtable hs = new Hashtable();
                    hs["Reply_id"]     = ds.Rows[0]["Reply_id"].ToString();
                    hs["ReplyList_id"] = ds.Rows[0]["id"].ToString();
                    hs["type"]         = 1; //模糊匹配
                    hs["AdminHotelid"] = AdminHotelid;
                    DataFactory.SqlDataBase().InsertByHashtable("Reply_user", hs);
                }
            }
            else
            {
                StringBuilder sb = new StringBuilder();
                sb.AppendFormat("select id,type,media_id,content,photo from Reply_news where 1=1 and AdminHotelid='{0}'", AdminHotelid);

                DataTable dss = DataFactory.SqlDataBase().GetDataTableBySQL(sb);
                if (dss != null && dss.Rows.Count > 0)
                {
                    if (dss.Rows[0]["type"].ToString() == "1")
                    {  //文字回复
                        resxml = automatic_hf(dss.Rows[0]["content"].ToString(), ToUserName, FromUserName, CreateTime, AdminHotelid);
                    }
                    else if (dss.Rows[0]["type"].ToString() == "2") //图片回复
                    {
                        resxml = "<xml><ToUserName><![CDATA[" + FromUserName + "]]></ToUserName><FromUserName><![CDATA[" + ToUserName + "]]></FromUserName><CreateTime>" + CreateTime + "</CreateTime><MsgType><![CDATA[image]]></MsgType><Image><MediaId><![CDATA[" + dss.Rows[0]["media_id"].ToString() + "]]></MediaId></Image></xml> ";
                    }
                }
            }

            return(resxml);
        }
Пример #55
0
 /// <summary>
 /// 分页获取数据列表(带条件)
 /// </summary>
 /// <param name="where">条件</param>
 /// <param name="param">参数化</param>
 /// <param name="orderField">排序字段</param>
 /// <param name="orderType">排序类型</param>
 /// <param name="pageIndex">当前页</param>
 /// <param name="pageSize">页大小</param>
 /// <param name="count">总条数</param>
 /// <returns></returns>
 public IList GetPageListWhere(StringBuilder where, SqlParam[] param, string orderField, string orderType, int pageIndex, int pageSize, ref int count)
 {
     //return dal.GetPageListWhere(where, param, orderField, orderType, pageIndex, pageSize, ref count);
     StringBuilder strSql = new StringBuilder();
     strSql.Append("SELECT * FROM AMS_TableColumns WHERE 1=1");
     strSql.Append(where);
     return DbHelper.GetPageList<AMS_TableColumns>(strSql.ToString(), param, CommonHelper.ToOrderField("SortCode", orderField), orderType, pageIndex, pageSize, ref count);
 }
Пример #56
0
        public Criteria Merge(Criteria other)
        {
            if (other == null)
            {
                return(this);
            }
            Criteria newCriteria = new Criteria();

            StringBuilder sb = new StringBuilder();

            if (whereClause != null)
            {
                sb.Append(whereClause);
            }
            if (other.whereClause != null)
            {
                if (sb.Length > 0)
                {
                    sb.Append(" AND ");
                }
                sb.Append(other.whereClause);
            }
            newCriteria.whereClause = sb.Length == 0 ? null : sb.ToString();

            sb = new StringBuilder();
            if (joins != null)
            {
                sb.Append(joins);
            }
            if (other.joins != null)
            {
                sb.Append(" ");
                sb.Append(other.joins);
            }
            newCriteria.joins = sb.Length == 0 ? null : sb.ToString();
            int pos = 1;

            for (int i = 0; i < parameters.Count; i++)
            {
                newCriteria.parameters.Add((pos), parameters[i + 1]);
                pos++;
            }
            for (int i = 0; i < other.parameters.Count; i++)
            {
                SqlParam p = (SqlParam)other.parameters[i + 1];
                p.SetPos(pos);
                newCriteria.parameters.Add((pos), p);
                pos++;
            }
            if (minRowIndex >= 0)
            {
                newCriteria.minRowIndex = minRowIndex;
            }
            if (other.minRowIndex >= 0)
            {
                newCriteria.minRowIndex = other.minRowIndex;
            }
            if (maxRowIndex >= 0)
            {
                newCriteria.maxRowIndex = maxRowIndex;
            }
            if (other.maxRowIndex >= 0)
            {
                newCriteria.maxRowIndex = other.maxRowIndex;
            }
            if (distinct || other.IsDistinct())
            {
                newCriteria.distinct = other.distinct;
            }
            return(newCriteria);
        }
Пример #57
0
 /// <summary>
 /// 获得数据列表(带条件)
 /// </summary>
 /// <param name="where">条件</param>
 /// <param name="param">参数化</param>
 /// <returns></returns>
 public IList GetListWhere(StringBuilder where, SqlParam[] param)
 {
     StringBuilder strSql = new StringBuilder();
     strSql.Append("SELECT * FROM BASE_InterfaceManage WHERE 1=1");
     strSql.Append(where);
     strSql.Append(" ORDER BY CreateDate DESC");
     return DbHelper.GetDataListBySQL<BASE_InterfaceManage>(strSql, param);
 }
Пример #58
0
        /// <summary>
        /// 已关注执行事件:客户扫码酒店推广二维码
        /// </summary>
        /// <param name="ToUserName">开发者微信号</param>
        /// <param name="Phone">手机号码</param>
        /// <param name="FromUserName">自己的OPENID</param>
        /// <param name="CreateTime">消息创建时间 (整型)</param>
        public static string HotelFocusWelfare(string ToUserName, string Hotelid, string FromUserName, string CreateTime)
        {
            string url     = ConfigHelper.GetAppSettings("Url");
            string resxml  = "";
            string context = "欢迎关注!";

            resxml = "<xml><ToUserName><![CDATA[" + FromUserName + "]]></ToUserName><FromUserName><![CDATA[" + ToUserName + "]]></FromUserName><CreateTime>" + CreateTime + "</CreateTime><MsgType><![CDATA[text]]></MsgType><Content><![CDATA[" + context + "]]></Content></xml> ";

            string sql = string.Format(@"SELECT  w.AdminHotelid,h.type, h.Name FROM dbo.WeChatInfo w INNER JOIN dbo.Hotel_Admin h ON w.AdminHotelid=h.AdminHotelid where  w.Original_ID=@Original_ID and h.AdminHotelid<>'1'");

            SqlParam[] parmAdd2 = new SqlParam[] {
                new SqlParam("@Original_ID", ToUserName.Trim())
            };
            DataTable dt = DataFactory.SqlDataBase().GetDataTableBySQL(new StringBuilder(sql), parmAdd2);

            if (dt != null && dt.Rows.Count > 0)
            {
                string AdminHotelid = dt.Rows[0]["AdminHotelid"].ToString();
                string tpurl        = url + "/Marketing/images/fuli.jpg";
                string wyrul        = url + "/Marketing/register.aspx?AdminHotelid=" + dt.Rows[0]["AdminHotelid"];
                context = "欢迎关注" + dt.Rows[0]["Name"] + "!";
                resxml  = "<xml><ToUserName><![CDATA[" + FromUserName + "]]></ToUserName><FromUserName><![CDATA[" + ToUserName + "]]></FromUserName><CreateTime>" + CreateTime + "</CreateTime><MsgType><![CDATA[text]]></MsgType><Content><![CDATA[" + context + "]]></Content></xml> ";


                ////判断是否开启活动  Wx_function(功能开启设置表)
                string     sqls4    = string.Format(@"select Wx_Marketing from Wx_function where Wx_Marketing=1 and AdminHotelid=@AdminHotelid");
                SqlParam[] parmAdd4 = new SqlParam[] {
                    new SqlParam("@AdminHotelid", dt.Rows[0]["AdminHotelid"])
                };
                DataTable dt4 = DataFactory.SqlDataBase().GetDataTableBySQL(new StringBuilder(sqls4), parmAdd4);
                if (dt4 != null && dt4.Rows.Count > 0)
                {
                    context = "欢迎关注" + dt.Rows[0]["Name"] + "!";
                    string contexts = "欢迎关注" + dt.Rows[0]["Name"] + ",点击进去领取福利";
                    resxml = "<xml><ToUserName><![CDATA[" + FromUserName + "]]></ToUserName><FromUserName><![CDATA[" + ToUserName + "]]></FromUserName><CreateTime>" + CreateTime + "</CreateTime><MsgType><![CDATA[news]]></MsgType><ArticleCount>1</ArticleCount><Articles><item><Title><![CDATA[" + context + "]]></Title><Description><![CDATA[" + contexts + "]]></Description><PicUrl><![CDATA[" + tpurl + "]]></PicUrl><Url><![CDATA[" + wyrul + "]]></Url></item></Articles></xml> ";
                }
                else
                {
                    resxml = Automatic_Focus(ToUserName, FromUserName, CreateTime);
                }

                Log.Info("已关注(添加扫码记录 判断是永久还是临时):", FromUserName);
                //添加扫码记录 判断是永久还是临时

                //判断是否成为会员
                bool isVip = false;
                //添加扫码记录 判断是永久还是临时
                CommonMethod.HotelSource(AdminHotelid, FromUserName, Hotelid, out isVip);
                if (isVip)
                {
                    //推送文字订房、充值
                    string reservation = url + "/Reservation/HotelList.aspx?AdminHotelid=" + AdminHotelid;

                    //string recharge = url + "/Vipcard/MemCart.aspx?AdminHotelid=" + AdminHotelid;//充值链接
                    context = @"尊贵的会员,快快点击“<a href='" + reservation + "'>订房</a>”进行客房预订吧!";
                    resxml  = automatic_return(context, ToUserName, FromUserName, CreateTime);
                }

                Log.Info("已关注(完成----------):", FromUserName);
            }

            return(resxml);
        }
Пример #59
0
        /// <summary>
        /// 检查销售预测单结余表后台表是否存在
        /// sType: A 销售订单  B 调拨申请单  C 赠品申请单  D 销售预测单 E  销售预测变更单
        /// </summary>
        /// <param name="ctx"></param>
        /// <param name="dycInsertForecastBack">销售结余后台表</param>
        /// <param name="dycInsertForecastLog">销售结余日志表</param>
        /// <returns></returns>
        ///
        public static DynamicObjectCollection SelectForecastBack(Context ctx, SqlParam param, string sType)
        {
            string sql = string.Empty;

            switch (sType)
            {
                #region//销售订单
            case "A":

                sql = string.Format(@"select  a.FID as ID,a.FQTY,a.FAUXPROPID,a.FUNITID,a.FSALERID,a.FMATERIALID,a.FJNSUBDATE,a.FSALEORGID,b.fid
                from JN_T_SAL_ForecastBack a
                inner join T_SAL_ORDER b on a.FSALEORGID=b.FJNSALEORGID and a.FSALERID=b.FJNSALERID 
                and a.FSaleDeptId=b.FJNSaleDeptId  and a.FSaleGroupId=b.FJNSaleGroupId
                inner join T_SAL_ORDERENTRY c on b.FID=c.FID and a.FMATERIALID=c.FJNMATERIALID 
                and a.FAUXPROPID=c.FJNAUXPROP  and a.FUnitID=c.FBaseUnitID
                inner join TABLE(fn_StrSplit(@FID,',',1)) tb on b.Fid=tb.Fid
                order by ID,FJNSUBDATE");
                break;

                #endregion
                #region//调拨申请单
            case "B":
                sql = string.Format(@"select  a.FID as ID,a.FQTY,a.FAUXPROPID,a.FUNITID,a.FSALERID,a.FMATERIALID,a.FJNSUBDATE,a.FSALEORGID,b.fid
                from JN_T_SAL_ForecastBack a
                inner join JN_YDL_SCM_AllotApplyFor b on a.FSALEORGID=b.FJNSALEORGID and a.FSALERID=b.FJNSALERID 
                and a.FSaleDeptId=b.FJNSaleDeptId  and a.FSaleGroupId=b.FJNSaleGroupId
                inner join T_SAL_ORDERENTRY c on b.FID=c.FID and a.FMATERIALID=c.FJNMATERIALID 
                and a.FAUXPROPID=c.FJNAUXPROP  and a.FUnitID=c.FBaseUnitID
                inner join TABLE(fn_StrSplit(@FID,',',1)) tb on b.Fid=tb.Fid
                order by ID,FJNSUBDATE");
                break;

                #endregion
                #region//赠品申请单
            case "C":
                sql = string.Format(@"select  a.FID as ID,a.FQTY,a.FAUXPROPID,a.FUNITID,a.FSALERID,a.FMATERIALID,a.FJNSUBDATE,a.FSALEORGID,b.fid
                from JN_T_SAL_ForecastBack a
                inner join JN_T_SAL_GiftReq b on a.FSALEORGID=b.FJNSALEORGID and a.FSALERID=b.FJNSALERID 
                and a.FSaleDeptId=b.FJNSaleDeptId  and a.FSaleGroupId=b.FJNSaleGroupId
                inner join JN_T_SAL_GiftReqEntry c on b.FID=c.FID and a.FMATERIALID=c.FJNMATERIALID 
                and a.FAUXPROPID=c.FJNAUXPROP  and a.FUnitID=c.FBaseUnitID
                inner join TABLE(fn_StrSplit(@FID,',',1)) tb on b.Fid=tb.Fid
                order by ID,FJNSUBDATE");
                break;

                #endregion
                #region //销售预测单
            case "D":
                sql = string.Format(@"select  a.FID as ID,a.FQTY,a.FAUXPROPID,a.FUNITID,a.FSALERID,a.FMATERIALID,a.FJNSUBDATE,a.FSALEORGID,b.FID,c.FEntryID,
                (case when  c.FBASEUNITID<>a.FUnitID then (c.FBASEUNITQTY * e.FConvertNumerator / e.FConvertDenominator)
                                  else c.FBASEUNITQTY end  )as  FBASEUNITQTY
                from JN_T_SAL_ForecastBack a
                inner join JN_T_SAL_Forecast b on a.FSALEORGID=b.FJNSALEORGID and a.FSALERID=b.FJNSALERID 
                and a.FSaleDeptId=b.FJNSaleDeptId  and a.FSaleGroupId=b.FJNSaleGroupId
                inner join JN_T_SAL_ForecastEntity c on b.FID=c.FID and a.FMATERIALID=c.FJNMATERIALID 
                and a.FAUXPROPID=c.FJNAUXPROP  and a.FUnitID=c.FBaseUnitID
                inner join T_BD_Material d  on a.FMATERIALID=d.FMATERIALID
                left join T_BD_UNITCONVERTRATE e  on d.FMASTERID =e.FMASTERID and e.FCurrentUnitId=c.FBASEUNITID and e.FDESTUNITID=a.FUnitID
                inner join TABLE(fn_StrSplit(@FID,',',1)) tb on b.Fid=tb.Fid
                order by ID,FJNSUBDATE");
                break;
                #endregion

                #region //销售预测变更单
            case "E":
                sql = string.Format(@"select  a.FID as ID,a.FQTY,a.FAUXPROPID,a.FUNITID,a.FSALERID,a.FMATERIALID,a.FJNSUBDATE,a.FSALEORGID,b.fid
                from JN_T_SAL_ForecastBack a
                inner join JN_T_SAL_ForecastChange b on a.FSALEORGID=b.FJNSALEORGID and a.FSALERID=b.FJNSALERID 
                and a.FSaleDeptId=b.FJNSaleDeptId  and a.FSaleGroupId=b.FJNSaleGroupId
                inner join JN_T_SAL_ForecastChangeEntry c on b.FID=c.FID and a.FMATERIALID=c.FJNMATERIALID 
                and a.FAUXPROPID=c.FJNAUXPROP  and a.FUnitID=c.FBaseUnitID
                inner join TABLE(fn_StrSplit(@FID,',',1)) tb on b.Fid=tb.Fid
                order by ID,FJNSUBDATE");
                break;
                #endregion
            }
            return(DBUtils.ExecuteDynamicObject(ctx, sql, null, null, CommandType.Text, new SqlParam[] { param }));
        }
Пример #60
0
        /// <summary>
        /// 自主关注
        /// </summary>
        /// <param name="ToUserName">开发者微信号</param>
        /// <param name="FromUserName">自己的OPENID</param>
        /// <param name="CreateTime">消息创建时间 (整型)</param>
        public static string AutonomyFollow(string ToUserName, string FromUserName, string CreateTime)
        {
            string resxml  = "";
            string context = "欢迎关注!";

            StringBuilder sb = new StringBuilder();

            sb.Append(@"
            SELECT  w.AdminHotelid ,
                    h.Name ,
                    h.type ,
                    ISNULL(( SELECT TOP 1
                                    ImgFile
                             FROM   Photo
                             WHERE  [type] = '9'
                                    AND AdminHotelid = h.AdminHotelid
                             ORDER BY hotelid,ID ASC
                           ), '') images,
                           r.content,
                           r.photo,
                           r.bt,
                           r.url
            FROM    dbo.WeChatInfo w
                    INNER JOIN dbo.Hotel_Admin h ON w.AdminHotelid = h.AdminHotelid
                    LEFT JOIN Reply_attention r ON r.AdminHotelid = h.AdminHotelid 
            WHERE   w.Original_ID = @Original_ID
                    AND h.AdminHotelid <> '1'
            ");
            SqlParam[] param = new SqlParam[] {
                new SqlParam("@Original_ID", ToUserName.Trim())
            };
            DataTable dt = DataFactory.SqlDataBase().GetDataTableBySQL(sb, param);

            if (dt != null && dt.Rows.Count > 0)
            {
                string AdminHotelid = dt.Rows[0]["AdminHotelid"].ToString();
                string url          = "http://www.zidinn.com";

                //判断是否成为会员
                bool isVip = DataFactory.SqlDataBase().IsExist("MemberInfo", "Openid", FromUserName) > 0;

                if (isVip)
                {
                    //推送文字订房、充值
                    string reservation = url + "/Reservation/HotelList.aspx?AdminHotelid=" + AdminHotelid;
                    context = @"尊贵的会员,快快点击“<a href='" + reservation + "'>订房</a>”进行客房预订吧!";
                    resxml  = text_xml(context, ToUserName, FromUserName, CreateTime);
                }
                else
                {
                    string picUrl = url + "/Marketing/images/fuli.jpg";
                    string images = dt.Rows[0]["images"].ToString();
                    if (images != "")
                    {
                        picUrl = url + "/upload/photo/SN" + images;
                    }
                    string wyrul = url + "/Reservation/HotelList.aspx?AdminHotelid=" + AdminHotelid;
                    context = "欢迎关注" + dt.Rows[0]["Name"] + "!";
                    string contexts = "倾听感动,分享喜悦,“" + dt.Rows[0]["Name"] + "微管家”与您24小时贴身相伴。立即点击预订吧!";

                    //自定义关注图文推送
                    try {
                        contexts = dt.Rows[0]["content"].ToString() == "" ? contexts : dt.Rows[0]["content"].ToString();
                        context  = dt.Rows[0]["bt"].ToString() == "" ? context : dt.Rows[0]["bt"].ToString();
                        wyrul    = dt.Rows[0]["url"].ToString() == "" ? wyrul : dt.Rows[0]["url"].ToString();
                        picUrl   = dt.Rows[0]["photo"].ToString() == "" ? picUrl : url + "/upload/Reply/" + dt.Rows[0]["photo"].ToString();
                    }
                    catch { }


                    resxml = "<xml><ToUserName><![CDATA[" + FromUserName + "]]></ToUserName><FromUserName><![CDATA[" + ToUserName + "]]></FromUserName><CreateTime>" + CreateTime + "</CreateTime><MsgType><![CDATA[news]]></MsgType><ArticleCount>1</ArticleCount><Articles><item><Title><![CDATA[" + context + "]]></Title><Description><![CDATA[" + contexts + "]]></Description><PicUrl><![CDATA[" + picUrl + "]]></PicUrl><Url><![CDATA[" + wyrul + "]]></Url></item></Articles></xml> ";
                }
            }
            return(resxml);
        }