Exemplo n.º 1
0
        /// <summary>
        /// 获得权限列表
        /// </summary>
        /// <param name="UserName">用户名</param>
        /// <param name="ClassID">权限对象</param>
        /// <param name="dr">返回DataReader</param>
        /// <returns>整形是否成功</returns>
        public int GetProcessList(string UserName, long ClassID, out SqlDataReader dr)
        {
            int iReturn = 1;

            UDS.Components.Database mySQL      = new UDS.Components.Database();
            SqlParameter[]          parameters =
            {
                mySQL.MakeInParam("@UserName", SqlDbType.VarChar, 300, UserName),
                mySQL.MakeInParam("@ClassID",  SqlDbType.Int,       4, ClassID)
            };
            dr = null;
            try
            {
                mySQL.RunProc("sp_GetRightListToClass", parameters, out dr);
            }
            catch (Exception e)
            {
                Error.Log(e.ToString());
            }
            finally
            {
                //mySQL.Close();
                //mySQL = null;
            }
            return(iReturn);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 添加权限
        /// </summary>
        /// <param name="SrcID"></param>
        /// <param name="ObjID"></param>
        /// <param name="BaseOn"></param>
        /// <param name="ProcID"></param>
        /// <returns></returns>
        public int AddRight(long SrcID, long ObjID, int BaseOn, int ProcID)
        {
            int iReturn = 1;

            UDS.Components.Database mySQL = new UDS.Components.Database();
            try
            {
                SqlParameter[] parameters =
                {
                    mySQL.MakeInParam("@Act_ID",   SqlDbType.Int, 4, ProcID),
                    mySQL.MakeInParam("@Based_On", SqlDbType.Int, 4, BaseOn),
                    mySQL.MakeInParam("@Src_ID",   SqlDbType.Int, 4, SrcID),
                    mySQL.MakeInParam("@Obj_ID",   SqlDbType.Int, 4, ObjID)
                };
                mySQL.RunProc("sp_AddAssignRule", parameters);
            }
            catch (Exception e)
            {
                Error.Log(e.ToString());
            }
            finally
            {
                mySQL.Close();
                mySQL = null;
            }
            return(iReturn);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 添加权限
        /// </summary>
        /// <param name="SrcID"></param>
        /// <param name="ObjID"></param>
        /// <param name="BaseOn"></param>
        /// <param name="ProcID"></param>
        /// <returns></returns>
        public int AddRight(long SrcID,long ObjID,int BaseOn,int ProcID)
        {
            int iReturn=1;
            UDS.Components.Database mySQL = new UDS.Components.Database();
            try
            {

                SqlParameter[] parameters = {
                                                mySQL.MakeInParam("@Act_ID",	SqlDbType.Int,	4,ProcID),
                                                mySQL.MakeInParam("@Based_On",	SqlDbType.Int,	4,BaseOn),
                                                mySQL.MakeInParam("@Src_ID",	SqlDbType.Int,	4,SrcID),
                                                mySQL.MakeInParam("@Obj_ID",	SqlDbType.Int,	4,ObjID)

                                        };
                mySQL.RunProc("sp_AddAssignRule",parameters);
            }
            catch(Exception e)
            {
                Error.Log(e.ToString());
            }
            finally
            {
                mySQL.Close();
                mySQL = null;
            }
            return iReturn;
        }
Exemplo n.º 4
0
 /// <summary>
 /// �ӽ�ɫ��ɾ����Ա
 /// </summary>
 /// <param name="roleid">��ɫid</param>
 /// <param name="staffid">��Աid</param>
 /// <returns>����ֵ</returns>
 public static int DelStaffFromRole(int roleid,string staffid)
 {
     UDS.Components.Database db = new UDS.Components.Database();
     SqlParameter[] prams = {
                                 db.MakeInParam("@Role_ID",SqlDbType.Int,4,roleid),
                                 db.MakeInParam("@StaffIDS",SqlDbType.VarChar,3000,staffid)
                            };
     return(db.RunProc("sp_DeleteStaffFromRole",prams));
 }
Exemplo n.º 5
0
 /// <summary>
 /// ��ӽ�ɫ
 /// </summary>
 /// <param name="rolename">��ɫ��</param>
 /// <param name="roledescription">��ɫ����</param>
 /// <returns>��ɫID</returns>
 public static int Add(string rolename,string roledescription)
 {
     UDS.Components.Database db = new UDS.Components.Database();
     SqlParameter[] prams = {
                                 db.MakeInParam("@Role_Name",SqlDbType.VarChar,300,rolename.Trim()),
                                 db.MakeInParam("@Role_Description",SqlDbType.VarChar,300,roledescription.Trim())
                            };
     return(db.RunProc("sp_AddMyRole",prams));
 }
Exemplo n.º 6
0
 /// <summary>
 /// 从角色中添加成员
 /// </summary>
 /// <param name="roleid">角色id</param>
 /// <param name="staffid">非成员id</param>
 /// <returns>返回值</returns>
 public static int AddStaffFromRole(int roleid, string staffid)
 {
     UDS.Components.Database db    = new UDS.Components.Database();
     SqlParameter[]          prams =
     {
         db.MakeInParam("@Role_ID",  SqlDbType.Int,        4, roleid),
         db.MakeInParam("@StaffIDS", SqlDbType.VarChar, 3000, staffid)
     };
     return(db.RunProc("sp_AddStaffToRole", prams));
 }
Exemplo n.º 7
0
 /// <summary>
 /// 添加角色
 /// </summary>
 /// <param name="rolename">角色名</param>
 /// <param name="roledescription">角色描述</param>
 /// <returns>角色ID</returns>
 public static int Add(string rolename, string roledescription)
 {
     UDS.Components.Database db    = new UDS.Components.Database();
     SqlParameter[]          prams =
     {
         db.MakeInParam("@Role_Name",        SqlDbType.VarChar, 300, rolename.Trim()),
         db.MakeInParam("@Role_Description", SqlDbType.VarChar, 300, roledescription.Trim())
     };
     return(db.RunProc("sp_AddMyRole", prams));
 }
Exemplo n.º 8
0
 /// <summary>
 /// 修改角色信息
 /// </summary>
 /// <param name="roleid">角色ID</param>
 /// <param name="rolename">角色名称</param>
 /// <param name="roledescription">角色描述</param>
 /// <returns>返回值(0成功1不成功)</returns>
 public static int Modify(int roleid, string rolename, string roledescription)
 {
     UDS.Components.Database db    = new UDS.Components.Database();
     SqlParameter[]          prams =
     {
         db.MakeInParam("@role_id",          SqlDbType.Int,       4, roleid),
         db.MakeInParam("@role_name",        SqlDbType.VarChar, 300, rolename.Trim()),
         db.MakeInParam("@role_description", SqlDbType.VarChar, 300, roledescription.Trim())
     };
     return(db.RunProc("sp_UpdateRoleInfo", prams));
 }
Exemplo n.º 9
0
        /// <summary>
        /// 人员职位级别更新
        /// </summary>
        /// <param name="PositionID">职位ID</param>
        /// <param name="NewCaste">新职级</param>
        /// <returns>返回是否成功</returns>
        public static int UpdateCaste(long PositionID, int NewCaste)
        {
            UDS.Components.Database db = new UDS.Components.Database();

            SqlParameter[] prams =
            {
                db.MakeInParam("@PositionID", SqlDbType.Int, 4, PositionID),
                db.MakeInParam("@NewCaste",   SqlDbType.Int, 4, NewCaste)
            };
            return(db.RunProc("sp_UpdatePositionCaste", prams));
        }
Exemplo n.º 10
0
 /// <summary>
 /// 检查此人是否已经在联系人列表中
 /// </summary>
 /// <param name="type">联系人类型(0:所有联系人1:员工联系人2:客户联系人3:自定义联系人)</param>
 /// <param name="staffid">用户id</param>
 /// <param name="id">联系人id</param>
 /// <returns></returns>
 public bool HaveInList(int type, int staffid, int id)
 {
     UDS.Components.Database data  = new UDS.Components.Database();
     SqlParameter[]          prams =
     {
         data.MakeInParam("@type",    SqlDbType.Int, 4, type),
         data.MakeInParam("@staffid", SqlDbType.Int, 4, staffid),
         data.MakeInParam("@id",      SqlDbType.Int, 4, id)
     };
     return((data.RunProc("sp_Linkman_HaveInList", prams) == 1)?true:false);
 }
Exemplo n.º 11
0
 private void cmdSubmit_ServerClick(object sender, System.EventArgs e)
 {
     UDS.Components.Database db = new UDS.Components.Database();
     SqlParameter[] prams = {
                                 db.MakeInParam("@StaffIDS",SqlDbType.VarChar,300,selectedID),
                                 db.MakeInParam("@NewDeptID",SqlDbType.Int,4,Int32.Parse(Department.Items[Department.SelectedIndex].Value))
                            };
     db.RunProc("sp_StaffMove",prams);
     if(ReturnPage ==0)
         Response.Redirect(backfilepath+"?DeptID="+DeptID+"&displayType="+displayType);
     else
         Response.Redirect("../Staff/ManageStaff.aspx?DisplayType=0");
 }
Exemplo n.º 12
0
        /// <summary>
        /// 得到我的联系人
        /// </summary>
        /// <param name="type">联系人类型(0:所有联系人1:员工联系人2:客户联系人3:自定义联系人)</param>
        /// <param name="staffid">用户id</param>
        /// <returns></returns>
        public SqlDataReader GetMyLinkman(int type, int staffid)
        {
            UDS.Components.Database data  = new UDS.Components.Database();
            SqlParameter[]          prams =
            {
                data.MakeInParam("@type",    SqlDbType.Int, 4, type),
                data.MakeInParam("@staffid", SqlDbType.Int, 4, staffid)
            };
            SqlDataReader dr = null;

            data.RunProc("sp_Linkman_GetList", prams, out dr);
            return(dr);
        }
Exemplo n.º 13
0
        public string GetRoleInfo(long RoleID, string FiledName)
        {
            UDS.Components.Database db = new UDS.Components.Database();
            SqlDataReader           dr = null;

            SqlParameter[] prams =
            {
                db.MakeInParam("@RoleID", SqlDbType.Int, 4, RoleID),
            };
            db.RunProc("sp_GetRoleInfo", prams, out dr);
            try
            {
                if (dr.Read())
                {
                    try
                    {
                        return(dr[FiledName].ToString());
                    }
                    catch
                    {
                        return("");
                    }
                }
                else
                {
                    return("");
                }
            }
            finally
            {
                dr = null;
                db = null;
            }
        }
Exemplo n.º 14
0
        /// <summary>
        /// ����ĵ���������ĿID
        /// </summary>
        /// <param name="DocID">�ĵ�ID</param>
        public static int GetDocumentProjectID(long DocID)
        {
            int iReturn=0;
            UDS.Components.Database mySQL = new UDS.Components.Database();
            SqlParameter[] parameters = {
                                            mySQL.MakeInParam("@DocID",SqlDbType.Int ,4,DocID)
                                        };

            try
            {
                iReturn = mySQL.RunProc("sp_Flow_GetDocumentProjectID",parameters);

            }
            catch(Exception e)
            {
                Error.Log(e.ToString());
                throw new Exception("��ù��ĵ���ĿID�����",e);
            }
            finally
            {
                mySQL.Close();
                mySQL = null;
            }
            return iReturn;
        }
Exemplo n.º 15
0
 /// <summary>
 /// 设置用户是否需要硬件KEY验证
 /// </summary>
 /// <param name="StaffID">人员ID</param>
 /// <param name="IsNeedKey">是否需要登陆</param>
 /// <returns>返回是否成功</returns>
 public bool SetIsNeedKey(string StaffIDs, bool IsNeedKey)
 {
     UDS.Components.Database db = new UDS.Components.Database();
     if (StaffIDs.Length > 0)
     {
         SqlParameter[] prams =
         {
             db.MakeInParam("@StaffIDs",  SqlDbType.VarChar, 1000, StaffIDs),
             db.MakeInParam("@IsNeedKey", SqlDbType.Bit,        1, IsNeedKey)
         };
         return(db.RunProc("sp_Staff_SetIsNeedKey", prams) == 0?true:false);
     }
     else
     {
         return(false);
     }
 }
Exemplo n.º 16
0
Arquivo: Team.cs Projeto: hoku85/UDS
 /// <summary>
 /// ������ɾ��ij��Ա
 /// </summary>
 /// <param name="staffids">��Աid����</param>
 /// <returns>�Ƿ�ɹ�</returns>
 public bool DeleteStaffFromTeam(string staffids,int TeamID)
 {
     UDS.Components.Database db = new UDS.Components.Database();
     SqlParameter[] prams = {
                                db.MakeInParam("@StaffIDS",SqlDbType.VarChar,300,staffids),
                                db.MakeInParam("@TeamID",SqlDbType.Int,8,TeamID)
                            };
     try
     {
         return((db.RunProc("sp_DeleteStaffFromTeam",prams)==0)?true:false);
     }
     catch(Exception ex)
     {
         Error.Log(ex.ToString());
         throw new Exception("������ɾ��ij��Ա!",ex);
     }
 }
Exemplo n.º 17
0
 /// <summary>
 /// ɾ����ɫ
 /// </summary>
 /// <param name="roleid">��ɫID</param>
 /// <returns>0�ɹ�1���ɹ�</returns>
 public static int Delete(int roleid)
 {
     UDS.Components.Database db = new UDS.Components.Database();
     SqlParameter[] prams = {
                                db.MakeInParam("@role_id",SqlDbType.Int,4,roleid)
                            };
     return(db.RunProc("sp_DeleteRole",prams));
 }
Exemplo n.º 18
0
 /// <summary>
 /// 删除角色
 /// </summary>
 /// <param name="roleid">角色ID</param>
 /// <returns>0成功1不成功</returns>
 public static int Delete(int roleid)
 {
     UDS.Components.Database db    = new UDS.Components.Database();
     SqlParameter[]          prams =
     {
         db.MakeInParam("@role_id", SqlDbType.Int, 4, roleid)
     };
     return(db.RunProc("sp_DeleteRole", prams));
 }
Exemplo n.º 19
0
 private void cmdSubmit_ServerClick(object sender, System.EventArgs e)
 {
     UDS.Components.Database db    = new UDS.Components.Database();
     SqlParameter[]          prams =
     {
         db.MakeInParam("@StaffIDS",  SqlDbType.VarChar, 300, selectedID),
         db.MakeInParam("@NewDeptID", SqlDbType.Int,       4, Int32.Parse(Department.Items[Department.SelectedIndex].Value))
     };
     db.RunProc("sp_StaffMove", prams);
     if (ReturnPage == 0)
     {
         Response.Redirect(backfilepath + "?DeptID=" + DeptID + "&displayType=" + displayType);
     }
     else
     {
         Response.Redirect("../Staff/ManageStaff.aspx?DisplayType=0");
     }
 }
Exemplo n.º 20
0
Arquivo: Team.cs Projeto: youye00/UDS
 /// <summary>
 /// 加入成员至组
 /// </summary>
 /// <param name="staffids">人员id集合</param>
 /// <returns>是否成功</returns>
 public bool AddMemberToTeam(string staffids, int TeamID)
 {
     UDS.Components.Database db    = new UDS.Components.Database();
     SqlParameter[]          prams =
     {
         db.MakeInParam("@StaffIDS", SqlDbType.VarChar, 300, staffids),
         db.MakeInParam("@TeamID",   SqlDbType.Int,       8, TeamID)
     };
     try
     {
         return((db.RunProc("sp_AddStaffToTeam", prams) == 0)?true:false);
     }
     catch (Exception ex)
     {
         Error.Log(ex.ToString());
         throw new Exception("加入成员至组出错!", ex);
     }
 }
Exemplo n.º 21
0
 /// <summary>
 /// 使人员复职
 /// </summary>
 /// <param name="staffids">人员id集合</param>
 /// <returns>是否成功</returns>
 public bool ReturnPosition(string staffids)
 {
     UDS.Components.Database db    = new UDS.Components.Database();
     SqlParameter[]          prams =
     {
         db.MakeInParam("@StaffIDS", SqlDbType.VarChar, 300, staffids)
     };
     return((db.RunProc("sp_StaffRehab", prams) == 0)?true:false);
 }
Exemplo n.º 22
0
        /// <summary>
        /// 人员更新
        /// </summary>
        /// <param name="StaffID">人员ID</param>
        /// <returns>返回是否成功</returns>
        public int UpdateInfo(long StaffID, string RealName, int Sex, string Birthday, string Password, string Email, string Phone, string Mobile, long PositionID, int Caste)
        {
            UDS.Components.Database db = new UDS.Components.Database();

            SqlParameter[] prams =
            {
                db.MakeInParam("@StaffID",    SqlDbType.Int,        4, StaffID),
                db.MakeInParam("@RealName",   SqlDbType.VarChar,   50, RealName),
                db.MakeInParam("@Sex",        SqlDbType.Bit,        1, Sex),
                db.MakeInParam("@Birthday",   SqlDbType.DateTime,   8, Birthday),
                db.MakeInParam("@Password",   SqlDbType.VarChar,  255, Password),
                db.MakeInParam("@Email",      SqlDbType.VarChar,  500, Email),
                db.MakeInParam("@Phone",      SqlDbType.VarChar,   50, Phone),
                db.MakeInParam("@Mobile",     SqlDbType.VarChar,   50, Mobile),
                db.MakeInParam("@PositionID", SqlDbType.Int,        4, PositionID),
                db.MakeInParam("@Caste",      SqlDbType.Int,        4, Caste)
            };
            return(db.RunProc("sp_UpdateStaffInfo", prams));
        }
Exemplo n.º 23
0
 /// <summary>
 /// 更新自定义联系人分类
 /// </summary>
 /// <param name="mlinkman"></param>
 public void UpdateCustomLinkmanType(CustomLinkman clinkman)
 {
     UDS.Components.Database data = new UDS.Components.Database();
     if (clinkman.Type.IndexOf(',', 0) != -1)
     {
         string [] arrtype = clinkman.Type.Split(',');
         for (int i = 0; i < arrtype.Length; i++)
         {
             if (arrtype[i].Trim() != "")
             {
                 SqlParameter[] prams1 =
                 {
                     data.MakeInParam("@typeid", SqlDbType.Int, 4, arrtype[i]),
                     data.MakeInParam("@id",     SqlDbType.Int, 4, clinkman.ID)
                 };
                 data.RunProc("sp_Linkman_AddCustomLinkmanType", prams1);
             }
         }
     }
 }
Exemplo n.º 24
0
        public SqlDataReader GetStaffIDByRealName(string realname)
        {
            UDS.Components.Database db = new UDS.Components.Database();
            SqlDataReader           dr = null;

            SqlParameter[] prams =
            {
                db.MakeInParam("@realname", SqlDbType.VarChar, 100, realname)
            };
            db.RunProc("sp_GetStaffIDByRealName", prams, out dr);
            return(dr);
        }
Exemplo n.º 25
0
        public SqlDataReader GetCustomLinkmanType(int id)
        {
            UDS.Components.Database data  = new UDS.Components.Database();
            SqlParameter[]          prams =
            {
                data.MakeInParam("@id", SqlDbType.Int, 4, id)
            };
            SqlDataReader dr = null;

            data.RunProc("sp_Linkman_GetCustomLinkmanTypeByCustomLinkmanID", prams, out dr);
            return(dr);
        }
Exemplo n.º 26
0
Arquivo: BBS.cs Projeto: youye00/UDS
        public SqlDataReader Find(string key, BBSSearchOption option, DataTable boards)
        {
            string        boardids = "";
            string        sql      = "select * from UDS_Bbs_ForumItem";
            SqlDataReader dr       = null;


            if (option.searchtype == BBSSearchType.author)
            {
                sql += " where sender like '%" + key + "%'";
            }
            else if (option.searchtype == BBSSearchType.title)
            {
                sql += " where title like '%" + key + "%'";
            }

            if (option.BoardID != 0)
            {
                sql += " and board_id=" + option.BoardID;
            }
            else
            {
                foreach (DataRow row in boards.Rows)
                {
                    boardids += row["board_id"].ToString() + ",";
                }

                if (boardids != "")
                {
                    boardids = boardids.Substring(0, boardids.Length - 1);
                }



                sql += " and board_id in (" + boardids + ")";
            }
            if (option.TimeBound != TimeSpan.MaxValue)
            {
                //计算时间段
                sql += " and datediff(d,send_time,getdate())< " + option.TimeBound.Days.ToString();
            }


            UDS.Components.Database db    = new UDS.Components.Database();
            SqlParameter[]          prams =
            {
                db.MakeInParam("@SQL", SqlDbType.NText, 5000, sql),
            };

            db.RunProc("sp_RunSQL", prams, out dr);
            return(dr);
        }
Exemplo n.º 27
0
        public SqlDataReader GetRoleInfo(long RoleID)
        {
            UDS.Components.Database db = new UDS.Components.Database();
            SqlDataReader           dr = null;

            SqlParameter[] prams =
            {
                db.MakeInParam("@RoleID", SqlDbType.Int, 4, RoleID),
            };
            db.RunProc("sp_GetRoleInfo", prams, out dr);

            return(dr);
        }
Exemplo n.º 28
0
 /// <summary>
 /// ����ĵ�
 /// </summary>
 /// <param name="UserName">�����</param>
 /// <param name="FlowID">��������ID</param>
 /// <param name="SQL">��ʽ�����ݵ�SQL���</param>
 public int AddDocument(string UserName,long FlowID,string SQL)
 {
     int iReturn=-1;
     UDS.Components.Database mySQL = new UDS.Components.Database();
     SqlParameter[] parameters = {
                                     mySQL.MakeInParam("@DocBuilder",SqlDbType.VarChar,300,UserName),
                                     mySQL.MakeInParam("@FlowID",SqlDbType.Int ,4,FlowID),
                                     mySQL.MakeInParam("@SQL",SqlDbType.NText,4000,SQL)
                                 };
     try
     {
         iReturn = mySQL.RunProc("sp_Flow_AddDocument",parameters);
     }
     catch(Exception e)
     {
         Error.Log(e.ToString());
     }
     finally
     {
         mySQL.Close();
         mySQL = null;
     }
     return iReturn;
 }
Exemplo n.º 29
0
 /// <summary>
 /// 人员复职
 /// </summary>
 /// <param name="StaffID">人员ID</param>
 /// <returns>返回是否成功</returns>
 public bool Rehab(string StaffIDS)
 {
     UDS.Components.Database db = new UDS.Components.Database();
     if (StaffIDS.Length > 0)
     {
         SqlParameter[] prams =
         {
             db.MakeInParam("@StaffIDS", SqlDbType.VarChar, 300, StaffIDS.ToString())
         };
         return(db.RunProc("sp_StaffRehab", prams) == 0?true:false);
     }
     else
     {
         return(false);
     }
 }
Exemplo n.º 30
0
        /// <summary>
        /// 根据rolename得到roleid
        /// </summary>
        /// <param name="rolename">角色名称</param>
        /// <returns>角色id</returns>
        public static int GetRoleIDByName(string rolename)
        {
            UDS.Components.Database db = new UDS.Components.Database();
            int           roleid       = 0;
            SqlDataReader dr           = null;

            SqlParameter[] prams =
            {
                db.MakeInParam("@rolename", SqlDbType.VarChar, 100, rolename),
            };
            db.RunProc("sp_GetRoleIDFromName", prams, out dr);
            while (dr.Read())
            {
                roleid = Int32.Parse(dr["role_id"].ToString());
            }
            return(roleid);
        }
Exemplo n.º 31
0
 /// <summary>
 /// ����ļ��������ݿ����
 /// </summary>
 /// <param name="att">DocAttachFile��</param>
 /// <param name="DocID">�ļ�ID</param>
 public void AddAttach(UDS.Components.DocAttachFile att,long DocID)
 {
     UDS.Components.Database data = new UDS.Components.Database();
     SqlParameter[] prams = {
                                data.MakeInParam("@DocID",  SqlDbType.Int, 20, DocID),
                                data.MakeInParam("@FileName",  SqlDbType.VarChar, 300, att.FileName),
                                data.MakeInParam("@FileSize",  SqlDbType.Int, 20, att.FileSize),
                                data.MakeInParam("@FileAttribute",  SqlDbType.SmallInt,20, att.FileAttribute),
                                data.MakeInParam("@FileVisualPath",  SqlDbType.NVarChar, 200, att.FileVisualPath),
                                data.MakeInParam("@FileAuthor",  SqlDbType.NVarChar, 50, att.FileAuthor),
                                data.MakeInParam("@FileCatlog",  SqlDbType.NVarChar, 20, att.FileCatlog),
                                data.MakeInParam("@FileAddedDate", SqlDbType.DateTime, 30, DateTime.Parse(att.FileAddedDate))
                            };
     try
     {
         data.RunProc("sp_Flow_AddFile", prams);
     }
     catch (Exception ex)
     {
         Error.Log(ex.ToString());
         throw new Exception("�ļ��������ͳ���!",ex);
     }
 }
Exemplo n.º 32
0
        /// <summary>
        /// 得到员工上下班时间
        /// </summary>
        public DutyTime GetDutyTime()
        {
            UDS.Components.Database db = new UDS.Components.Database();
            DutyTime dt = new DutyTime();

            System.Data.SqlClient.SqlParameter[] prams =
            {
                db.MakeInParam("@staffid",      System.Data.SqlDbType.Int,            4, staffid),
                db.MakeOutParam("@ondutytime",  System.Data.SqlDbType.SmallDateTime, 8),
                db.MakeOutParam("@offdutytime", System.Data.SqlDbType.SmallDateTime, 8)
            };
            if (db.RunProc("sp_WA_GetDutyTime", prams) != 0)
            {
                throw(new Exception("读取人员上下班时间出错"));
            }
            else
            {
                dt.OnDutyTime  = (System.DateTime)prams[1].Value;
                dt.OffDutyTime = (System.DateTime)prams[2].Value;
                return(dt);
            }
        }
Exemplo n.º 33
0
        private void Bind()
        {
            DataSet ds = new DataSet();

            UDS.Components.Staff staff1   = new UDS.Components.Staff();
            SqlDataReader        dr_Staff = staff1.GetAllStaffs();
            DataTable            dt_Staff = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_Staff);

            dt_Staff.TableName = "Staff";
            ds.Tables.Add(dt_Staff);

            try
            {
                UDS.Components.Database db    = new UDS.Components.Database();
                SqlParameter[]          prams =
                {
                    db.MakeInParam("@SQL", SqlDbType.NText, 5000, searchstring)
                };
                SqlDataReader dr = null;
                db.RunProc("sp_RunSql", prams, out dr);
                DataTable dt = UDS.Components.Tools.ConvertDataReaderToDataTable(dr);
                dt.TableName = "Client";
                ds.Tables.Add(dt);

                ltl_Client.Text = dt.Rows.Count.ToString();

                ds.Relations.Add("ClientAddMan_Staff", ds.Tables["Client"].Columns["AddManID"], ds.Tables["Staff"].Columns["Staff_ID"], false);

                dt.DefaultView.Sort = ViewState["SortField"].ToString() + " " + ViewState["SortDirect"].ToString();

                dgrd_clientlist.DataSource = dt.DefaultView;
                dgrd_clientlist.DataBind();
            }
            catch (Exception ex)
            {
                UDS.Components.Error.Log(ex.ToString());
                Server.Transfer("../../Error.aspx");
            }
        }
Exemplo n.º 34
0
        /// <summary>
        /// 删除权限
        /// </summary>
        /// <param name="RuleIDs">权限记录号</param>
        public int DeleteRight(string RuleIDs)
        {
            int iReturn = 1;

            UDS.Components.Database mySQL = new UDS.Components.Database();
            try
            {
                SqlParameter[] parameters =
                {
                    mySQL.MakeInParam("@Rule_IDS", SqlDbType.VarChar, 300, RuleIDs)
                };
                mySQL.RunProc("sp_DeleteAssignRule", parameters);
            }
            catch (Exception e)
            {
                Error.Log(e.ToString());
            }
            finally
            {
                //mySQL.Close();
                //mySQL = null;
            }
            return(iReturn);
        }
Exemplo n.º 35
0
        /// <summary>
        /// 删除权限
        /// </summary>
        /// <param name="RuleIDs">权限记录号</param>
        public int DeleteRight(string RuleIDs)
        {
            int iReturn=1;
            UDS.Components.Database mySQL = new UDS.Components.Database();
            try
            {

                SqlParameter[] parameters = {
                                                mySQL.MakeInParam("@Rule_IDS",SqlDbType.VarChar ,300,RuleIDs)

                                            };
                mySQL.RunProc("sp_DeleteAssignRule",parameters);
            }
            catch(Exception e)
            {
                Error.Log(e.ToString());
            }
            finally
            {
                //mySQL.Close();
                //mySQL = null;
            }
            return iReturn;
        }
Exemplo n.º 36
0
        private void Bind()
        {
            DataSet ds = new DataSet();
            UDS.Components.Staff staff1 = new UDS.Components.Staff();
            SqlDataReader dr_Staff = staff1.GetAllStaffs();
            DataTable dt_Staff = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_Staff);
            dt_Staff.TableName = "Staff";
            ds.Tables.Add(dt_Staff);

            try
            {
                UDS.Components.Database db = new UDS.Components.Database();
                SqlParameter[] prams = {
                                           db.MakeInParam("@SQL",SqlDbType.NText,5000,searchstring)
                                       };
                SqlDataReader dr = null;
                db.RunProc("sp_RunSql",prams,out dr);
                DataTable dt = UDS.Components.Tools.ConvertDataReaderToDataTable(dr);
                dt.TableName = "Client";
                ds.Tables.Add(dt);

                ltl_Client.Text = dt.Rows.Count.ToString();

                ds.Relations.Add("ClientAddMan_Staff",ds.Tables["Client"].Columns["AddManID"],ds.Tables["Staff"].Columns["Staff_ID"],false);

                dt.DefaultView.Sort = ViewState["SortField"].ToString() + " " + ViewState["SortDirect"].ToString();

                dgrd_clientlist.DataSource = dt.DefaultView;
                dgrd_clientlist.DataBind();
            }
            catch(Exception ex)
            {
                UDS.Components.Error.Log(ex.ToString());
                Server.Transfer("../../Error.aspx");
            }
        }
Exemplo n.º 37
0
Arquivo: BBS.cs Projeto: hoku85/UDS
 /// <summary>
 /// ɾ������
 /// </summary>
 public void DelAttachment(string attachmentmd)
 {
     UDS.Components.Database data = new UDS.Components.Database ();
     SqlParameter[] prams = {
                                data.MakeInParam("@replayid",  SqlDbType.Int, 4,this.ReplayId),
                            };
     SqlDataReader dr = null;
     data.RunProc ("sp_BBS_GetReplayAttachment",prams,out dr);
     while(dr.Read())
     {
         System.IO.File.Delete(attachmentmd+"\\"+dr["filename"].ToString());
     }
     data.Close();
     SqlParameter[] prams1 = {
                                data.MakeInParam("@replayid",  SqlDbType.Int, 4,this.ReplayId),
     };
     data.RunProc("sp_BBS_DelAttachmentToReplay",prams1);
 }
Exemplo n.º 38
0
Arquivo: BBS.cs Projeto: hoku85/UDS
        public SqlDataReader Find(string key,BBSSearchOption option,DataTable boards)
        {
            string boardids = "";
            string sql = "select * from UDS_Bbs_ForumItem";
            SqlDataReader dr = null;

            if(option.searchtype==BBSSearchType.author)
            {
                sql += " where sender like '%"+key+"%'";
            }
            else if(option.searchtype==BBSSearchType.title)
            {
                sql += " where title like '%"+key+"%'";
            }

            if(option.BoardID!=0)
            {
                sql += " and board_id="+option.BoardID;
            }
            else
            {
                foreach(DataRow row in boards.Rows)
                {
                    boardids += row["board_id"].ToString() + ",";
                }

                if(boardids!="")
                    boardids = boardids.Substring(0,boardids.Length-1);

                sql += " and board_id in ("+boardids+")";
            }
            if(option.TimeBound!=TimeSpan.MaxValue)
            {
                //����ʱ���
                sql += " and datediff(d,send_time,getdate())< "+option.TimeBound.Days.ToString();
            }

            UDS.Components.Database db = new UDS.Components.Database();
            SqlParameter[] prams = {
                                       db.MakeInParam("@SQL",  SqlDbType.NText, 5000, sql),
            };

            db.RunProc("sp_RunSQL",prams,out dr);
            return dr;
        }
Exemplo n.º 39
0
        /// <summary>
        /// ��Ա����
        /// </summary>
        /// <param name="StaffID">��ԱID</param>
        /// <returns>�����Ƿ�ɹ�</returns>
        public int UpdateInfo(long StaffID, string RealName, int Sex, string Birthday, string Password, string Email, string Phone, string Mobile, long PositionID, int Caste, string ContractDate
            , string InsuranceStatus
            , string AccumulationStatus
            , string IDNumber
            , string Marriage
            , string Address
            , string BirthPlace
            , string Education
            , string Features
            , string Remark
            , string InsuranceBase
            , string EndowmentCompany
            , string EndowmentPersonal
            , string UnemploymentCompany
            , string UnemploymentPersonal
            , string Injury
            , string Maternity
            , string MedicalCompany
            , string MedicalPersonal
            , string InsuranceCompanyTotal
            , string InsurancePersonalTotal
            , string AccumulationBase
            , string AccumulationCompany
            , string AccumulationPersonal
            , string staff_dept)
        {
            UDS.Components.Database db = new UDS.Components.Database();

            SqlParameter[] prams = {
                                        db.MakeInParam("@StaffID",SqlDbType.Int,4,StaffID),
                                        db.MakeInParam("@RealName",SqlDbType.VarChar,50,RealName),
                                        db.MakeInParam("@Sex",SqlDbType.Bit ,1,Sex),
                                        db.MakeInParam("@Birthday",SqlDbType.DateTime ,8,Birthday),
                                        db.MakeInParam("@Password",SqlDbType.VarChar,255,Password),
                                        db.MakeInParam("@Email",SqlDbType.VarChar,500,Email),
                                        db.MakeInParam("@Phone",SqlDbType.VarChar,50,Phone),
                                        db.MakeInParam("@Mobile",SqlDbType.VarChar,50,Mobile),
                                        db.MakeInParam("@PositionID",SqlDbType.Int,4,PositionID),
                                        db.MakeInParam("@Caste",SqlDbType.Int,4,Caste),

                                           db.MakeInParam("@ContractDate",SqlDbType.DateTime,8,ContractDate),
                                         db.MakeInParam("@InsuranceStatus",SqlDbType.VarChar,300,InsuranceStatus),
                                        db.MakeInParam("@AccumulationStatus",SqlDbType.VarChar,300,AccumulationStatus),
                                        db.MakeInParam("@IDNumber",SqlDbType.VarChar,300,IDNumber),
                                        db.MakeInParam("@Marriage",SqlDbType.VarChar,300,Marriage),
                                        db.MakeInParam("@Address",SqlDbType.VarChar,300,Address),
                                        db.MakeInParam("@BirthPlace",SqlDbType.VarChar,300,BirthPlace),
                                        db.MakeInParam("@Education ",SqlDbType.VarChar,300,Education ),
                                        db.MakeInParam("@Features",SqlDbType.VarChar,300,Features),
                                        db.MakeInParam("@Remark",SqlDbType.VarChar,300,Remark),

                                        db.MakeInParam("@InsuranceBase",SqlDbType.Money,21, decimal.Parse(InsuranceBase)),
                                        db.MakeInParam("@EndowmentCompany",SqlDbType.Money,21, decimal.Parse(EndowmentCompany)),
                                        db.MakeInParam("@EndowmentPersonal ",SqlDbType.Money,21, decimal.Parse(EndowmentPersonal )),
                                        db.MakeInParam("@UnemploymentCompany ",SqlDbType.Money,21, decimal.Parse(UnemploymentCompany )),
                                        db.MakeInParam("@UnemploymentPersonal",SqlDbType.Money,21, decimal.Parse(UnemploymentPersonal)),
                                        db.MakeInParam("@Injury",SqlDbType.Money,21, decimal.Parse(Injury)),
                                        db.MakeInParam("@Maternity ",SqlDbType.Money,21, decimal.Parse(Maternity )),
                                        db.MakeInParam("@MedicalCompany ",SqlDbType.Money,21, decimal.Parse(MedicalCompany )),
                                        db.MakeInParam("@MedicalPersonal",SqlDbType.Money,21, decimal.Parse(MedicalPersonal)),
                                        db.MakeInParam("@InsuranceCompanyTotal ",SqlDbType.Money,21, decimal.Parse(InsuranceCompanyTotal )),
                                        db.MakeInParam("@InsurancePersonalTotal",SqlDbType.Money,21, decimal.Parse(InsurancePersonalTotal)),
                                        db.MakeInParam("@AccumulationBase",SqlDbType.Money,21, decimal.Parse(AccumulationBase)),
                                        db.MakeInParam("@AccumulationCompany ",SqlDbType.Money,21, decimal.Parse(AccumulationCompany )),
                                        db.MakeInParam("@AccumulationPersonal",SqlDbType.Money,21, decimal.Parse(AccumulationPersonal)),
                                        db.MakeInParam("@staff_dept",SqlDbType.VarChar,200,staff_dept)

                                    };
            return db.RunProc("sp_UpdateStaffInfo",prams);
        }
Exemplo n.º 40
0
 /// <summary>
 /// �����û��Ƿ���ҪӲ��KEY��֤
 /// </summary>
 /// <param name="StaffID">��ԱID</param>
 /// <param name="IsNeedKey">�Ƿ���Ҫ��½</param>
 /// <returns>�����Ƿ�ɹ�</returns>
 public bool SetIsNeedKey(string  StaffIDs,bool IsNeedKey)
 {
     UDS.Components.Database db = new UDS.Components.Database();
     if(StaffIDs.Length >0)
     {
         SqlParameter[] prams = {
                                    db.MakeInParam("@StaffIDs",SqlDbType.VarChar,1000,StaffIDs),
                                    db.MakeInParam("@IsNeedKey",SqlDbType.Bit ,1,IsNeedKey)
                                };
         return db.RunProc("sp_Staff_SetIsNeedKey",prams)==0?true:false;
     }
     else
         return false;
 }
Exemplo n.º 41
0
 /// <summary>
 /// ʹ��Ա��ְ
 /// </summary>
 /// <param name="staffids">��Աid����</param>
 /// <returns>�Ƿ�ɹ�</returns>
 public bool ReturnPosition(string staffids)
 {
     UDS.Components.Database db = new UDS.Components.Database();
     SqlParameter[] prams = {
                                db.MakeInParam("@StaffIDS",SqlDbType.VarChar,300,staffids)
                             };
     return((db.RunProc("sp_StaffRehab",prams)==0)?true:false);
 }
Exemplo n.º 42
0
        /// <summary>
        /// 获得权限列表
        /// </summary>
        /// <param name="UserName">用户名</param>
        /// <param name="ClassID">权限对象</param>
        /// <param name="dr">返回DataTable</param>
        /// <returns>整形是否成功</returns>
        public int GetProcessList(string UserName,long ClassID,out DataTable dt)
        {
            int iReturn=1;
            SqlDataReader dr;
            UDS.Components.Database mySQL = new UDS.Components.Database();
            SqlParameter[] parameters = {
                                            mySQL.MakeInParam("@UserName",SqlDbType.VarChar ,300,UserName),
                                            mySQL.MakeInParam("@ClassID",SqlDbType.Int,4,ClassID)
                                        };
            dt = null;
            try
            {
                mySQL.RunProc("sp_GetRightListToClass",parameters,out dr);
                dt = UDS.Components.Tools.ConvertDataReaderToDataTable(dr);

            }
            catch(Exception e)
            {
                Error.Log(e.ToString());
            }
            finally
            {
                //mySQL.Close();
                //mySQL = null;
            }
            return iReturn;
        }
Exemplo n.º 43
0
 /// <summary>
 /// �����Զ�����ϵ�˷���
 /// </summary>
 /// <param name="mlinkman"></param>
 public void UpdateCustomLinkmanType(CustomLinkman clinkman)
 {
     UDS.Components.Database data = new UDS.Components.Database();
     if(clinkman.Type.IndexOf(',',0)!=-1)
     {
         string [] arrtype = clinkman.Type.Split(',');
         for(int i = 0;i<arrtype.Length;i++)
         {
             if(arrtype[i].Trim()!="")
             {
                 SqlParameter[] prams1 = {
                                             data.MakeInParam("@typeid",SqlDbType.Int,4,arrtype[i]),
                                             data.MakeInParam("@id",SqlDbType.Int,4,clinkman.ID)
                                         };
                 data.RunProc("sp_Linkman_AddCustomLinkmanType",prams1);
             }
         }
     }
 }
Exemplo n.º 44
0
 /// <summary>
 /// �����Զ�����ϵ��
 /// </summary>
 /// <param name="mlinkman"></param>
 public void UpdateCustomLinkman(CustomLinkman clinkman)
 {
     UDS.Components.Database data = new UDS.Components.Database();
     SqlParameter[] prams = {
                                data.MakeInParam("@ID",SqlDbType.Int,4,clinkman.ID),
                                data.MakeInParam("@name",SqlDbType.VarChar,100,clinkman.Name),
                                data.MakeInParam("@Gender",SqlDbType.Bit,1,clinkman.Gender),
                                data.MakeInParam("@UnitTelephone",SqlDbType.VarChar,50,clinkman.UnitTelephone),
                                data.MakeInParam("@Email",SqlDbType.VarChar,50,clinkman.Email),
                                data.MakeInParam("@UnitAddress",SqlDbType.VarChar,200,clinkman.UnitAddress),
                                data.MakeInParam("@UnitZip",SqlDbType.VarChar,50,clinkman.UnitZip),
                                data.MakeInParam("@FamilyAddress",SqlDbType.VarChar,200,clinkman.FamilyAddress),
                                data.MakeInParam("@FamilyZip",SqlDbType.VarChar,50,clinkman.FamilyZip),
                                data.MakeInParam("@Mobile",SqlDbType.VarChar,100,clinkman.Mobile),
                                data.MakeInParam("@FamilyTelephone",SqlDbType.VarChar,100,clinkman.FamilyTelephone),
                                data.MakeInParam("@Memo",SqlDbType.VarChar,1000,clinkman.Memo),
                                data.MakeInParam("@Age",SqlDbType.VarChar,50,clinkman.Age),
                                data.MakeInParam("@Type",SqlDbType.VarChar,200,clinkman.Type)
                            };
     data.RunProc("sp_Linkman_UpdateCustomLinkman",prams);
 }
Exemplo n.º 45
0
 /// <summary>
 /// 更新自定义联系人
 /// </summary>
 /// <param name="mlinkman"></param>
 public void UpdateCustomLinkman(CustomLinkman clinkman)
 {
     UDS.Components.Database data  = new UDS.Components.Database();
     SqlParameter[]          prams =
     {
         data.MakeInParam("@ID",              SqlDbType.Int,        4, clinkman.ID),
         data.MakeInParam("@name",            SqlDbType.VarChar,  100, clinkman.Name),
         data.MakeInParam("@Gender",          SqlDbType.Bit,        1, clinkman.Gender),
         data.MakeInParam("@UnitTelephone",   SqlDbType.VarChar,   50, clinkman.UnitTelephone),
         data.MakeInParam("@Email",           SqlDbType.VarChar,   50, clinkman.Email),
         data.MakeInParam("@UnitAddress",     SqlDbType.VarChar,  200, clinkman.UnitAddress),
         data.MakeInParam("@UnitZip",         SqlDbType.VarChar,   50, clinkman.UnitZip),
         data.MakeInParam("@FamilyAddress",   SqlDbType.VarChar,  200, clinkman.FamilyAddress),
         data.MakeInParam("@FamilyZip",       SqlDbType.VarChar,   50, clinkman.FamilyZip),
         data.MakeInParam("@Mobile",          SqlDbType.VarChar,  100, clinkman.Mobile),
         data.MakeInParam("@FamilyTelephone", SqlDbType.VarChar,  100, clinkman.FamilyTelephone),
         data.MakeInParam("@Memo",            SqlDbType.VarChar, 1000, clinkman.Memo),
         data.MakeInParam("@Age",             SqlDbType.VarChar,   50, clinkman.Age),
         data.MakeInParam("@Type",            SqlDbType.VarChar,  200, clinkman.Type)
     };
     data.RunProc("sp_Linkman_UpdateCustomLinkman", prams);
 }
Exemplo n.º 46
0
        public SqlDataReader GetRoleInfo(long RoleID)
        {
            UDS.Components.Database db = new UDS.Components.Database();
            SqlDataReader dr = null;
            SqlParameter[] prams = {
                                       db.MakeInParam("@RoleID",SqlDbType.Int ,4,RoleID),
            };
            db.RunProc("sp_GetRoleInfo",prams,out dr);

            return(dr);
        }
Exemplo n.º 47
0
        private void btn_OK_Click(object sender, System.EventArgs e)
        {
            if(lbx_search.Items.Count>0)
            {
                string searchstring = "";
                string tmp = "";
                DateTime begintime = new DateTime();
                DateTime endtime = DateTime.Now;
                foreach(ListItem lt in lbx_search.Items)
                {
                    string [] searcharr = new string[2];
                    searcharr = lt.Value.Split(':');
                    switch(searcharr[0].Trim())
                    {
                        case "������Ա����":
                            UDS.Components.Staff staff = new UDS.Components.Staff();
                            SqlDataReader dr_staffid = staff.GetStaffIDByRealName(searcharr[1]);
                            tmp = "UDS_CM_ClientContact.MarketmanID='";
                            while(dr_staffid.Read())
                            {
                                tmp +=  dr_staffid["staff_id"] + "' or UDS_CM_ClientContact.MarketmanID='";
                            }
                            dr_staffid.Close();
                            if(tmp=="UDS_CM_ContactInfo.MarketmanID='")
                                searchstring = "1=2";
                            else
                            {
                                tmp = tmp.Substring(0,tmp.Length-37);
                                searchstring += "(" + tmp + ") and ";
                            }
                            break;

                        case "�ͻ�����":
                            UDS.Components.CM cm = new UDS.Components.CM();
                            SqlDataReader dr_clientid = cm.GetClientIDByName(searcharr[1]);
                            tmp = "UDS_CM_ClientContact.ClientID='";
                            while(dr_clientid.Read())
                            {
                                tmp +=  dr_clientid["ID"] + "' or UDS_CM_ClientContact.ClientID='";
                            }
                            dr_clientid.Close();
                            if(tmp=="UDS_CM_ClientContact.ClientID='")
                                searchstring = "1=2";
                            else
                            {
                                tmp = tmp.Substring(0,tmp.Length-34);
                                searchstring += "(" + tmp + ") and ";
                            }
                            break;
                        case "�ͻ����":
                            searchstring += "UDS_CM_ClientContact.ClientID=" + searcharr[1] + " and ";
                            break;
                        case "���۽׶�":
                        switch(searcharr[1])
                        {
                            case "����":
                                searchstring += "patindex('%trace%',UDS_CM_ClientContact.curstatus)>=0" + " and ";
                                break;
                            case "���":
                                searchstring += "patindex('%boot%',UDS_CM_ClientContact.curstatus)>=0" + " and ";
                                break;
                            case "��Ʒ�Ƽ�":
                                searchstring += "patindex('%commend%',UDS_CM_ClientContact.curstatus)>=0" + " and ";
                                break;
                            case "������":
                                searchstring += "patindex('%requirement%',UDS_CM_ClientContact.curstatus)>=0" + " and ";
                                break;
                            case "�����ύ":
                                searchstring += "patindex('%submit%',UDS_CM_ClientContact.curstatus)>=0" + " and ";
                                break;
                            case "����̸��":
                                searchstring += "patindex('%negotiate%',UDS_CM_ClientContact.curstatus)>=0" + " and ";
                                break;
                            case "��Ŀʵʩ":
                                searchstring += "patindex('%actualize%',UDS_CM_ClientContact.curstatus)>=0" + " and ";
                                break;
                            case "���ٷ���":
                                searchstring += "patindex('%traceservice%',UDS_CM_ClientContact.curstatus)>=0" + " and ";
                                break;
                            case "���":
                                searchstring += "patindex('%last%',UDS_CM_ClientContact.curstatus)>=0" + " and ";
                                break;
                        }
                            break;
                        case "�ɽ�Ԥ��":
                            searchstring += "UDS_CM_ClientContact.BargainPrognosis='" + searcharr[1] + "' and ";
                            break;
                        case "�ѽ�Ǣ����":
                            searchstring += "UDS_CM_ClientContact.ContactTimes=" + searcharr[1] + " and ";
                            break;
                        case "��Ǣ����ְ��":
                            searchstring += "UDS_CM_Linkman.[Position]='" + searcharr[1] + "' and ";
                            break;
                        case "�״ν�Ǣʱ��":
                            searchstring += "UDS_CM_ClientInfo.FirstContactTime='" + searcharr[1] + "' and ";
                            break;
                        case "���һ�ν�Ǣʱ��":
                            searchstring += "UDS_CM_ClientInfo.ContactTime='" + searcharr[1] + "' and ";
                            break;
                        case "�´�Լ��ʱ��":
                            searchstring += "UDS_CM_ClientInfo.NextContactTime='" + searcharr[1] + "' and ";
                            break;
                        case "����������¼":
                            //�õ�������ʼ��(��һ -- ����)
                            begintime = DateTime.Now;
                        switch((int)DateTime.Now.DayOfWeek)
                        {
                            case 0:
                                begintime = begintime.AddDays(-6);
                                break;
                            default:
                                begintime = begintime.AddDays(1-(int)DateTime.Now.DayOfWeek);
                                break;
                        }
                            searchstring += "(UDS_CM_ClientContact.updatetime between '" + begintime.ToShortDateString() + "' and '" + endtime.ToShortDateString() + "') and ";
                            break;
                        case "����������¼":
                            //�õ�������ʼ��
                            begintime = DateTime.Now;
                            begintime = begintime.AddDays(1-DateTime.Now.Day);
                            searchstring += "(UDS_CM_ClientContact.updatetime between '" + begintime.ToShortDateString() + "' and '" + endtime.ToShortDateString() + "') and ";
                            break;

                    }
                }

                searchstring = "select * from UDS_CM_ClientInfo where ID IN (select UDS_CM_ClientInfo.ID from UDS_CM_ClientContact left join UDS_CM_ClientContact_Linkman ON UDS_CM_ClientContact.ID=UDS_CM_ClientContact_Linkman.ContactID left join UDS_CM_Linkman ON UDS_CM_ClientContact_Linkman.LinkmanID=UDS_CM_ClientContact_Linkman.id,UDS_CM_ClientInfo where UDS_CM_ClientContact.clientid=UDS_CM_ClientInfo.id and " + searchstring;
                if(searchstring.EndsWith("and "))
                {
                    searchstring = searchstring.Substring(0,searchstring.Length-4);
                }
                searchstring += " group by UDS_CM_ClientInfo.ID)";

                DataSet ds = new DataSet();
                UDS.Components.Staff staff1 = new UDS.Components.Staff();
                SqlDataReader dr_Staff = staff1.GetAllStaffs();
                DataTable dt_Staff = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_Staff);
                dt_Staff.TableName = "Staff";
                ds.Tables.Add(dt_Staff);

                UDS.Components.Database db = new UDS.Components.Database();
                SqlParameter[] prams = {
                                           db.MakeInParam("@SQL",SqlDbType.NText,5000,searchstring)
                                       };
                SqlDataReader dr = null;
                db.RunProc("sp_RunSql",prams,out dr);
                DataTable dt = UDS.Components.Tools.ConvertDataReaderToDataTable(dr);
                dt.TableName = "Client";
                ds.Tables.Add(dt);

                ltl_Client.Text = dt.Rows.Count.ToString();

                ds.Relations.Add("ClientAddMan_Staff",ds.Tables["Client"].Columns["AddManID"],ds.Tables["Staff"].Columns["Staff_ID"],false);

                dgrd_ContactList.DataSource = dt.DefaultView;
                dgrd_ContactList.DataBind();

            }
        }
Exemplo n.º 48
0
        private void cmdSubmit_Click(object sender, System.EventArgs e)
        {
            if (rb_male.Checked == true)
            {
                sex = 1;
            }
            else
            {
                sex = 0;
            }

            if (EditStatus == 0)
            {
                UDS.Components.Database db = new UDS.Components.Database();
                SqlDataReader           dr;
                if (mydepartment.Visible == true)
                {
                    DeptID = cboDepartment.Items[cboDepartment.SelectedIndex].Value.ToString();
                }

                SqlParameter[] prams =
                {
                    db.MakeInParam("@StaffName",    SqlDbType.VarChar,  300, txtStaffName.Text),
                    db.MakeInParam("@Password",     SqlDbType.VarChar,  300, txtPassword.Text),
                    db.MakeInParam("@RealName",     SqlDbType.VarChar,  300, txtRealName.Text),
                    db.MakeInParam("@Sex",          SqlDbType.Int,        4, sex),
                    db.MakeInParam("@Status",       SqlDbType.Int,        4,                       0),
                    db.MakeInParam("@Email",        SqlDbType.VarChar,  300, txtEmail.Text),
                    db.MakeInParam("@RegistedDate", SqlDbType.DateTime,   8, DateTime.Now.ToString()),
                    db.MakeInParam("@DeptID",       SqlDbType.Int,        4, Int32.Parse(DeptID)),
                    db.MakeInParam("@Phone",        SqlDbType.VarChar,   50, txtPhone.Text),
                    db.MakeInParam("@Mobile",       SqlDbType.VarChar,   50, txtMobile.Text),
                    db.MakeInParam("@Birthday",     SqlDbType.DateTime,   8, (txtBirthday.Text.Trim() == "")?"1900-1-1":txtBirthday.Text)
                };
                db.RunProc("sp_AddStaff", prams, out dr);
                if (dr.Read())
                {
                    if (ReturnPage == 0)
                    {
                        Response.Redirect("ListView.aspx?Dep_ID=" + DeptID);
                    }
                    else
                    {
                        Response.Redirect("../Staff/ManageStaff.aspx");
                    }
                }
                else
                {
                    message.Text = "该用户已经存在!";
                }
            }
            else
            {
                UDS.Components.Staff person = new UDS.Components.Staff();
                switch (person.UpdateInfo(StaffID, txtRealName.Text, sex, txtBirthday.Text, txtPassword.Text, txtEmail.Text, txtPhone.Text, txtMobile.Text, Int32.Parse(cboDepartment.Items[cboDepartment.SelectedIndex].Value)))
                {
                case 0:
                    message.Text = "修改成功!";
                    break;

                case -1:
                    message.Text = "验证密码不对!";
                    break;

                default:
                    break;
                }
            }
        }
Exemplo n.º 49
0
 public SqlDataReader GetStaffIDByRealName(string realname)
 {
     UDS.Components.Database db = new UDS.Components.Database();
     SqlDataReader dr = null;
     SqlParameter[] prams = {
                                db.MakeInParam("@realname",SqlDbType.VarChar,100,realname)
                            };
     db.RunProc("sp_GetStaffIDByRealName",prams,out dr);
     return(dr);
 }
Exemplo n.º 50
0
 /// <summary>
 /// ��Ա��ְ
 /// </summary>
 /// <param name="StaffID">��ԱID</param>
 /// <returns>�����Ƿ�ɹ�</returns>
 public bool Rehab(string StaffIDS)
 {
     UDS.Components.Database db = new UDS.Components.Database();
     if(StaffIDS.Length >0)
     {
         SqlParameter[] prams = {
                                    db.MakeInParam("@StaffIDS",SqlDbType.VarChar,300,StaffIDS.ToString())
                                };
         return db.RunProc("sp_StaffRehab",prams)==0?true:false;
     }
     else
         return false;
 }
Exemplo n.º 51
0
        /// <summary>
        /// 添加自定义联系人
        /// </summary>
        /// <param name="clinkman">CustomLinkman结构</param>
        /// <returns>添加的ID</returns>
        public int AddCustomLinkman(CustomLinkman clinkman, int staffid)
        {
            int result = 0;

            UDS.Components.Database data  = new UDS.Components.Database();
            SqlParameter[]          prams =
            {
                data.MakeInParam("@name",            SqlDbType.VarChar,  100, clinkman.Name),
                data.MakeInParam("@Gender",          SqlDbType.Bit,        1, clinkman.Gender),
                data.MakeInParam("@UnitTelephone",   SqlDbType.VarChar,   50, clinkman.UnitTelephone),
                data.MakeInParam("@Email",           SqlDbType.VarChar,   50, clinkman.Email),
                data.MakeInParam("@UnitAddress",     SqlDbType.VarChar,  200, clinkman.UnitAddress),
                data.MakeInParam("@UnitZip",         SqlDbType.VarChar,   50, clinkman.UnitZip),
                data.MakeInParam("@FamilyAddress",   SqlDbType.VarChar,  200, clinkman.FamilyAddress),
                data.MakeInParam("@FamilyZip",       SqlDbType.VarChar,   50, clinkman.FamilyZip),
                data.MakeInParam("@Mobile",          SqlDbType.VarChar,  100, clinkman.Mobile),
                data.MakeInParam("@FamilyTelephone", SqlDbType.VarChar,  100, clinkman.FamilyTelephone),
                data.MakeInParam("@Memo",            SqlDbType.VarChar, 1000, clinkman.Memo),
                data.MakeInParam("@Staffid",         SqlDbType.Int,        4, staffid),
                data.MakeInParam("@Age",             SqlDbType.VarChar,   50, clinkman.Age)
            };
            result = data.RunProc("sp_Linkman_AddCustomLinkman", prams);

            if (clinkman.Type.IndexOf(',', 0) != -1)
            {
                string [] arrtype = clinkman.Type.Split(',');
                for (int i = 0; i < arrtype.Length; i++)
                {
                    if (arrtype[i].Trim() != "")
                    {
                        SqlParameter[] prams1 =
                        {
                            data.MakeInParam("@typeid", SqlDbType.Int, 4, arrtype[i]),
                            data.MakeInParam("@id",     SqlDbType.Int, 4, result)
                        };
                        data.RunProc("sp_Linkman_AddCustomLinkmanType", prams1);
                    }
                }
            }

            return(result);
        }
Exemplo n.º 52
0
 /// <summary>
 /// �޸Ľ�ɫ��Ϣ
 /// </summary>
 /// <param name="roleid">��ɫID</param>
 /// <param name="rolename">��ɫ����</param>
 /// <param name="roledescription">��ɫ����</param>
 /// <returns>����ֵ��0�ɹ�1���ɹ���</returns>
 public static int Modify(int roleid,string rolename,string roledescription)
 {
     UDS.Components.Database db = new UDS.Components.Database();
     SqlParameter[] prams = {
                                 db.MakeInParam("@role_id",SqlDbType.Int ,4,roleid),
                                 db.MakeInParam("@role_name",SqlDbType.VarChar,300,rolename.Trim()),
                                 db.MakeInParam("@role_description",SqlDbType.VarChar,300,roledescription.Trim())
                            };
     return(db.RunProc("sp_UpdateRoleInfo",prams));
 }
Exemplo n.º 53
0
 public SqlDataReader GetCustomLinkmanType(int id)
 {
     UDS.Components.Database data = new UDS.Components.Database();
     SqlParameter[] prams = {
                                data.MakeInParam("@id",SqlDbType.Int,4,id)
                            };
     SqlDataReader dr = null;
     data.RunProc("sp_Linkman_GetCustomLinkmanTypeByCustomLinkmanID",prams,out dr);
     return(dr);
 }
Exemplo n.º 54
0
        public string GetRoleInfo(long RoleID,string FiledName)
        {
            UDS.Components.Database db = new UDS.Components.Database();
            SqlDataReader dr = null;
            SqlParameter[] prams = {
                                       db.MakeInParam("@RoleID",SqlDbType.Int ,4,RoleID),
            };
            db.RunProc("sp_GetRoleInfo",prams,out dr);
            try
            {
                if(dr.Read())
                {
                    try
                    {
                        return dr[FiledName].ToString();
                    }
                    catch
                    {
                        return "";
                    }
                }
                else
                    return "";
            }
            finally
            {

                if (db != null)
                {
                    db.Close();
                }
                if (dr != null)
                {
                    dr.Close();
                    dr.Dispose();
                }
                dr = null;
                db = null;
            }
        }
Exemplo n.º 55
0
 /// <summary>
 /// �õ��ҵ���ϵ��
 /// </summary>
 /// <param name="type">��ϵ������(0:������ϵ��1:Ա����ϵ��2:�ͻ���ϵ��3:�Զ�����ϵ��)</param>
 /// <param name="staffid">�û�id</param>
 /// <returns></returns>
 public SqlDataReader GetMyLinkman(int type,int staffid)
 {
     UDS.Components.Database data = new UDS.Components.Database();
     SqlParameter[] prams = {
                                 data.MakeInParam("@type",SqlDbType.Int,4,type),
                                 data.MakeInParam("@staffid",SqlDbType.Int,4,staffid)
     };
     SqlDataReader dr = null;
     data.RunProc("sp_Linkman_GetList",prams,out dr);
     return(dr);
 }
Exemplo n.º 56
0
        /// <summary>
        /// ����Զ�����ϵ��
        /// </summary>
        /// <param name="clinkman">CustomLinkman�ṹ</param>
        /// <returns>��ӵ�ID</returns>
        public int AddCustomLinkman(CustomLinkman clinkman,int staffid)
        {
            int result = 0;
            UDS.Components.Database data = new UDS.Components.Database();
            SqlParameter[] prams = {
                                        data.MakeInParam("@name",SqlDbType.VarChar,100,clinkman.Name),
                                        data.MakeInParam("@Gender",SqlDbType.Bit,1,clinkman.Gender),
                                        data.MakeInParam("@UnitTelephone",SqlDbType.VarChar,50,clinkman.UnitTelephone),
                                        data.MakeInParam("@Email",SqlDbType.VarChar,50,clinkman.Email),
                                        data.MakeInParam("@UnitAddress",SqlDbType.VarChar,200,clinkman.UnitAddress),
                                        data.MakeInParam("@UnitZip",SqlDbType.VarChar,50,clinkman.UnitZip),
                                        data.MakeInParam("@FamilyAddress",SqlDbType.VarChar,200,clinkman.FamilyAddress),
                                        data.MakeInParam("@FamilyZip",SqlDbType.VarChar,50,clinkman.FamilyZip),
                                        data.MakeInParam("@Mobile",SqlDbType.VarChar,100,clinkman.Mobile),
                                        data.MakeInParam("@FamilyTelephone",SqlDbType.VarChar,100,clinkman.FamilyTelephone),
                                        data.MakeInParam("@Memo",SqlDbType.VarChar,1000,clinkman.Memo),
                                        data.MakeInParam("@Staffid",SqlDbType.Int,4,staffid),
                                        data.MakeInParam("@Age",SqlDbType.VarChar,50,clinkman.Age)
                                   };
            result = data.RunProc("sp_Linkman_AddCustomLinkman",prams);

            if(clinkman.Type.IndexOf(',',0)!=-1)
            {
                string [] arrtype = clinkman.Type.Split(',');
                for(int i = 0;i<arrtype.Length;i++)
                {
                    if(arrtype[i].Trim()!="")
                    {
                        SqlParameter[] prams1 = {
                                                    data.MakeInParam("@typeid",SqlDbType.Int,4,arrtype[i]),
                                                    data.MakeInParam("@id",SqlDbType.Int,4,result)
                                                };
                        data.RunProc("sp_Linkman_AddCustomLinkmanType",prams1);
                    }
                }
            }

            return(result);
        }
Exemplo n.º 57
0
 /// <summary>
 /// �������Ƿ��Ѿ�����ϵ���б���
 /// </summary>
 /// <param name="type">��ϵ������(0:������ϵ��1:Ա����ϵ��2:�ͻ���ϵ��3:�Զ�����ϵ��)</param>
 /// <param name="staffid">�û�id</param>
 /// <param name="id">��ϵ��id</param>
 /// <returns></returns>
 public bool HaveInList(int type,int staffid,int id)
 {
     UDS.Components.Database data = new UDS.Components.Database();
     SqlParameter[] prams = {
                                data.MakeInParam("@type",SqlDbType.Int,4,type),
                                data.MakeInParam("@staffid",SqlDbType.Int,4,staffid),
                                data.MakeInParam("@id",SqlDbType.Int,4,id)
                            };
     return((data.RunProc("sp_Linkman_HaveInList",prams)==1)?true:false);
 }
Exemplo n.º 58
0
 /// <summary>
 /// ����rolename�õ�roleid
 /// </summary>
 /// <param name="rolename">��ɫ����</param>
 /// <returns>��ɫid</returns>
 public static int GetRoleIDByName(string rolename)
 {
     UDS.Components.Database db = new UDS.Components.Database();
     int roleid = 0;
     SqlDataReader dr = null;
     SqlParameter[] prams = {
                                db.MakeInParam("@rolename",SqlDbType.VarChar,100,rolename),
                            };
     try
     {
         db.RunProc("sp_GetRoleIDFromName", prams, out dr);
         while (dr.Read())
         {
             roleid = Int32.Parse(dr["role_id"].ToString());
         }
     }
     finally
     {
         db.Close();
     }
     return(roleid);
 }
Exemplo n.º 59
0
        private void btn_OK_Click(object sender, System.EventArgs e)
        {
            if (lbx_search.Items.Count > 0)
            {
                string   searchstring = "";
                string   tmp          = "";
                DateTime begintime    = new DateTime();
                DateTime endtime      = DateTime.Now;
                foreach (ListItem lt in lbx_search.Items)
                {
                    string [] searcharr = new string[2];
                    searcharr = lt.Value.Split(':');
                    switch (searcharr[0].Trim())
                    {
                    case "销售人员姓名":
                        UDS.Components.Staff staff      = new UDS.Components.Staff();
                        SqlDataReader        dr_staffid = staff.GetStaffIDByRealName(searcharr[1]);
                        tmp = "UDS_CM_ClientContact.MarketmanID='";
                        while (dr_staffid.Read())
                        {
                            tmp += dr_staffid["staff_id"] + "' or UDS_CM_ClientContact.MarketmanID='";
                        }
                        dr_staffid.Close();
                        if (tmp == "UDS_CM_ContactInfo.MarketmanID='")
                        {
                            searchstring = "1=2";
                        }
                        else
                        {
                            tmp           = tmp.Substring(0, tmp.Length - 37);
                            searchstring += "(" + tmp + ") and ";
                        }
                        break;

                    case "客户名称":
                        UDS.Components.CM cm          = new UDS.Components.CM();
                        SqlDataReader     dr_clientid = cm.GetClientIDByName(searcharr[1]);
                        tmp = "UDS_CM_ClientContact.ClientID='";
                        while (dr_clientid.Read())
                        {
                            tmp += dr_clientid["ID"] + "' or UDS_CM_ClientContact.ClientID='";
                        }
                        dr_clientid.Close();
                        if (tmp == "UDS_CM_ClientContact.ClientID='")
                        {
                            searchstring = "1=2";
                        }
                        else
                        {
                            tmp           = tmp.Substring(0, tmp.Length - 34);
                            searchstring += "(" + tmp + ") and ";
                        }
                        break;

                    case "客户编号":
                        searchstring += "UDS_CM_ClientContact.ClientID=" + searcharr[1] + " and ";
                        break;

                    case "销售阶段":
                        switch (searcharr[1])
                        {
                        case "跟踪":
                            searchstring += "patindex('%trace%',UDS_CM_ClientContact.curstatus)>=0" + " and ";
                            break;

                        case "启动":
                            searchstring += "patindex('%boot%',UDS_CM_ClientContact.curstatus)>=0" + " and ";
                            break;

                        case "产品推荐":
                            searchstring += "patindex('%commend%',UDS_CM_ClientContact.curstatus)>=0" + " and ";
                            break;

                        case "需求定义":
                            searchstring += "patindex('%requirement%',UDS_CM_ClientContact.curstatus)>=0" + " and ";
                            break;

                        case "方案提交":
                            searchstring += "patindex('%submit%',UDS_CM_ClientContact.curstatus)>=0" + " and ";
                            break;

                        case "商务谈判":
                            searchstring += "patindex('%negotiate%',UDS_CM_ClientContact.curstatus)>=0" + " and ";
                            break;

                        case "项目实施":
                            searchstring += "patindex('%actualize%',UDS_CM_ClientContact.curstatus)>=0" + " and ";
                            break;

                        case "跟踪服务":
                            searchstring += "patindex('%traceservice%',UDS_CM_ClientContact.curstatus)>=0" + " and ";
                            break;

                        case "收尾款":
                            searchstring += "patindex('%last%',UDS_CM_ClientContact.curstatus)>=0" + " and ";
                            break;
                        }
                        break;

                    case "成交预估":
                        searchstring += "UDS_CM_ClientContact.BargainPrognosis='" + searcharr[1] + "' and ";
                        break;

                    case "已接洽次数":
                        searchstring += "UDS_CM_ClientContact.ContactTimes=" + searcharr[1] + " and ";
                        break;

                    case "接洽对象职务":
                        searchstring += "UDS_CM_Linkman.[Position]='" + searcharr[1] + "' and ";
                        break;

                    case "首次接洽时间":
                        searchstring += "UDS_CM_ClientInfo.FirstContactTime='" + searcharr[1] + "' and ";
                        break;

                    case "最后一次接洽时间":
                        searchstring += "UDS_CM_ClientInfo.ContactTime='" + searcharr[1] + "' and ";
                        break;

                    case "下次约见时间":
                        searchstring += "UDS_CM_ClientInfo.NextContactTime='" + searcharr[1] + "' and ";
                        break;

                    case "本周新增记录":
                        //得到本周起始日(周一 -- 周日)
                        begintime = DateTime.Now;
                        switch ((int)DateTime.Now.DayOfWeek)
                        {
                        case 0:
                            begintime = begintime.AddDays(-6);
                            break;

                        default:
                            begintime = begintime.AddDays(1 - (int)DateTime.Now.DayOfWeek);
                            break;
                        }
                        searchstring += "(UDS_CM_ClientContact.updatetime between '" + begintime.ToShortDateString() + "' and '" + endtime.ToShortDateString() + "') and ";
                        break;

                    case "本月新增记录":
                        //得到本月起始日
                        begintime     = DateTime.Now;
                        begintime     = begintime.AddDays(1 - DateTime.Now.Day);
                        searchstring += "(UDS_CM_ClientContact.updatetime between '" + begintime.ToShortDateString() + "' and '" + endtime.ToShortDateString() + "') and ";
                        break;
                    }
                }

                searchstring = "select * from UDS_CM_ClientInfo where ID IN (select UDS_CM_ClientInfo.ID from UDS_CM_ClientContact left join UDS_CM_ClientContact_Linkman ON UDS_CM_ClientContact.ID=UDS_CM_ClientContact_Linkman.ContactID left join UDS_CM_Linkman ON UDS_CM_ClientContact_Linkman.LinkmanID=UDS_CM_ClientContact_Linkman.id,UDS_CM_ClientInfo where UDS_CM_ClientContact.clientid=UDS_CM_ClientInfo.id and " + searchstring;
                if (searchstring.EndsWith("and "))
                {
                    searchstring = searchstring.Substring(0, searchstring.Length - 4);
                }
                searchstring += " group by UDS_CM_ClientInfo.ID)";

                DataSet ds = new DataSet();
                UDS.Components.Staff staff1   = new UDS.Components.Staff();
                SqlDataReader        dr_Staff = staff1.GetAllStaffs();
                DataTable            dt_Staff = UDS.Components.Tools.ConvertDataReaderToDataTable(dr_Staff);
                dt_Staff.TableName = "Staff";
                ds.Tables.Add(dt_Staff);

                UDS.Components.Database db    = new UDS.Components.Database();
                SqlParameter[]          prams =
                {
                    db.MakeInParam("@SQL", SqlDbType.NText, 5000, searchstring)
                };
                SqlDataReader dr = null;
                db.RunProc("sp_RunSql", prams, out dr);
                DataTable dt = UDS.Components.Tools.ConvertDataReaderToDataTable(dr);
                dt.TableName = "Client";
                ds.Tables.Add(dt);

                ltl_Client.Text = dt.Rows.Count.ToString();

                ds.Relations.Add("ClientAddMan_Staff", ds.Tables["Client"].Columns["AddManID"], ds.Tables["Staff"].Columns["Staff_ID"], false);

                dgrd_ContactList.DataSource = dt.DefaultView;
                dgrd_ContactList.DataBind();
            }
        }