Exemple #1
0
        /// <summary>
        /// �ж��Ƿ��й���Ȩ��
        /// </summary>
        /// <param name="username">�û���</param>
        /// <returns>bool</returns>
        public bool AdminBBS(string username,int classid)
        {
            if(classid!=0)
            {
                int actid = 8;
                Database db = new Database();
                SqlParameter[] prams = {
                                           db.MakeInParam("@Class_ID",SqlDbType.Int,4,classid),
                                           db.MakeInParam("@Username",SqlDbType.VarChar,100,username),
                                           db.MakeInParam("@Act_ID",SqlDbType.Int,4,actid),
                                           db.MakeOutParam("@ReturnValue",SqlDbType.Int,4)
                                       };
                try
                {
                    db.RunProc("sp_GetAccessPermission",prams);
                                        //					����������
                                        //					return(true);
                    return((Int32.Parse(prams[3].Value.ToString())==1)?true:false);

                }
                catch(Exception ex)
                {
                    Error.Log(ex.Message);
                    throw new Exception("BBSȨ���жϴ���!",ex);
                }
            }
            else
                return(false);
        }
Exemple #2
0
        /// <summary>
        /// ɾ��ijĿ¼
        /// </summary>
        /// <param name="ClassID">��ĿID</param>
        public void Delete(int ClassID)
        {
            Database data = new Database();
            SqlParameter[] prams = {
                                       data.MakeInParam("@TeamID" , SqlDbType.Int, 20, ClassID),
            };
            try
            {
                data.RunProc("sp_DeleteTeam", prams);
            }

            catch (Exception ex)
            {
                Error.Log(ex.ToString());

            }
            finally
            {
                if (data != null)
                {
                    data.Close();
                    data.Dispose();
                }
            }
        }
Exemple #3
0
        private void Bangding()
        {
            SqlDataReader dr; //������������
            Database mySQL = new Database();
            string UserName;

            UserName = Server.UrlDecode(Request.Cookies["UserName"].Value);

            SqlParameter[] parameters = {
                                            mySQL.MakeInParam("@StaffName",SqlDbType.VarChar ,300,UserName)
                                        };

            mySQL.RunProc("sp_Flow_GetMyFlow",parameters,out dr);
            try
            {
                DataTable dt = Tools.ConvertDataReaderToDataTable(dr);

                dgFlowList.DataSource = dt.DefaultView;
                dgFlowList.DataBind();
            }
            finally
            {
                if (mySQL != null)
                {
                    mySQL.Close();
                }
                if (dr != null)
                {
                    dr.Close();
                }
            }
        }
Exemple #4
0
        /// <summary>
        /// ��ȡij��Ŀ����
        /// </summary>
        /// <param name="ClassID">��ĿID</param>
        public static string GetProjectName(int ClassID)
        {
            string ProjectName = "";
            SqlDataReader dataReader = null;
            Database data = new Database();
            SqlParameter[] prams =
                                {
                                    data.MakeInParam("@projectid",	SqlDbType.Int, 20 ,ClassID)
                                };
            try
            {
                data.RunProc("sp_GetProjectName", prams, out dataReader);
                if (dataReader.Read())
                    ProjectName = dataReader[0].ToString();
                return ProjectName;
            }

            catch (Exception ex)
            {
                Error.Log(ex.ToString());
                return "";
            }
            finally
            {

                if (dataReader != null)
                {
                    dataReader.Close();
                }
            }
        }
Exemple #5
0
        private void Bangding()
        {
            SqlDataReader dr;
            Database db = new Database();
            SqlParameter[] parms = {
                                        db.MakeInParam("@DeptID",SqlDbType.Int  ,4,DeptID),
                                    };
            db.RunProc("sp_Flow_GetDept", parms, out dr);
            try
            {
                if (dr.Read())
                {
                    txtDeptName.Text = dr["Dept_Name"].ToString();
                    txtRemark.Text = dr["Dept_Remark"].ToString();
                }

                if (db != null)
                {
                    db.Close();
                    db = null;
                }
            }
            finally
            {
                if (db != null)
                {
                    db.Close();
                }
                if (dr != null)
                {
                    dr.Close();
                }
                dr = null;
            }
        }
Exemple #6
0
        private void BindGrid()
        {
            SqlDataReader dr=null; //������������
            Database db = new Database();
            try
            {
                SqlParameter[] prams = {
                                       db.MakeInParam("@StaffType",SqlDbType.Bit,1,DisplayType)
                                   };
                db.RunProc("sp_GetStaffisneedkey", prams, out dr);
                DataTable dt = Tools.ConvertDataReaderToDataTable(dr);
                dbStaffList.DataSource = dt.DefaultView;
                dbStaffList.DataBind();
            }
            finally
            {
                if (db != null)
                {
                    db.Close();
                }
                if (dr != null)
                {
                    dr.Close();
                }

            }
        }
Exemple #7
0
        /// <summary>
        /// ���ݰ�
        /// </summary>
        private void BindGrid()
        {
            SqlDataReader dr; //������������
            Database db = new Database();
            SqlParameter[] prams = {
                                        db.MakeInParam("@StaffType",SqlDbType.Bit,1,displaytype)
            };
            db.RunProc("sp_GetAllStaff",prams,out dr);
            DataTable dt =Tools.ConvertDataReaderToDataTable(dr);
            //��DataTable��ĩβ���Ͽ��У�ʹ��DataGrid�̶�����
            int blankrows = StaffList.PageSize - (dt.Rows.Count % StaffList.PageSize);
            for (int i = 0; i < blankrows; i++)
            {
                dt.Rows.Add(dt.NewRow());
            }

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

            //���ڿռ�¼����ʾcheckbox
            for(int i=0;i<StaffList.Items.Count;i++)
            {
                if(StaffList.Items[i].Cells[1].Text=="&nbsp;")
                {
                    StaffList.Items[i].FindControl("cb_StaffID").Visible = false;
                }
            }
            lbl_totalrecord.Text =StaffList.PageCount.ToString();
            lbl_curpage.Text = txb_PageNo.Text = (StaffList.CurrentPageIndex + 1).ToString();
            txb_ItemPerPage.Text = StaffList.PageSize.ToString();
            lbl_totalpage.Text = StaffList.PageCount.ToString();
        }
Exemple #8
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            // 在此处放置用户代码以初始化页面
            if (!Page.IsPostBack)
            {
                //操作者登录名
                HttpCookie UserCookie = Request.Cookies["Username"];
                Username = UserCookie.Value.ToString();

                PositionID   = (Request.QueryString["PositionID"] == null)?"":Request.QueryString["PositionID"].ToString();
                displayType  = (Request.QueryString["displayType"] == null)?"":Request.QueryString["displayType"].ToString();
                selectedID   = (Request.QueryString["StaffIDS"] == null)?"":Request.QueryString["StaffIDS"].ToString();
                backfilepath = (Request.QueryString["BackFilePath"] == null)?"":Request.QueryString["BackFilePath"].ToString();
                SqlDataReader           dr;
                UDS.Components.Database db = new UDS.Components.Database();
                db.RunProc("SP_Ext_GetPosition", out dr);
                cboPosition.DataSource     = dr;
                cboPosition.DataTextField  = "Position_Name";
                cboPosition.DataValueField = "Position_ID";
                cboPosition.DataBind();
            }
            if (Request.QueryString["ReturnPage"] != null)
            {
                ReturnPage = Int32.Parse(Request.QueryString["ReturnPage"].ToString());
            }
            else
            {
                ReturnPage = 0;
            }
        }
Exemple #9
0
        private void Bangding()
        {
            SqlDataReader dr;
            Database db = new Database();
            SqlParameter[] parms = {
                                        db.MakeInParam("@StyleID",SqlDbType.Int  ,4,StyleID),
                                    };
            db.RunProc("sp_Flow_GetStyle",parms,out dr);
            if(dr.Read())
            {
                txtStyleName.Text = dr["Style_Name"].ToString();
                txtStyleRemark.Text = dr["Style_Remark"].ToString();
                lblTemplate.Text  = "<a href='" + @"Template\" + dr["Template"].ToString() + "'>" + dr["Template"].ToString() + "</a>";
                if(dr["Template"].ToString()=="")
                    Template.Visible = false;
                else
                    Template.Visible  = true;

            }
            else
            {
                Template.Visible  = false;
            }

            if(db!=null)
            {
                db.Close();
                db = null;
            }
            dr.Close();
            dr = null;
        }
Exemple #10
0
        private void BindGrid()
        {
            SqlDataReader dr=null; //������������
            Database db = new Database();
            try
            {
                SqlParameter[] prams = {
                                       db.MakeInParam("@RoleID",SqlDbType.Int,4,RoleID)
                                   };
                if (DisplayType == 0)
                    db.RunProc("sp_GetStaffInRole", prams, out dr);
                else
                    db.RunProc("sp_GetStaffNotInRole", prams, out dr);

                DataTable dt = Tools.ConvertDataReaderToDataTable(dr);

                dbStaffList.DataSource = dt.DefaultView;
                dbStaffList.DataBind();
            }
            finally
            {
                if (db != null)
                { db.Close(); }
                if (dr != null)
                {

                    dr.Close();
                }
            }
        }
Exemple #11
0
        private void Bangding()
        {
            SqlDataReader dr = null; //存放人物的数据
            Database mySQL = new Database();
            try
            {
                SqlParameter[] parameters = {
                                            mySQL.MakeInParam("@NewsID",SqlDbType.Int ,4,0)
                                        };

                mySQL.RunProc("sp_Flow_GetNews", parameters, out dr);

                DataTable dt = Tools.ConvertDataReaderToDataTable(dr);

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

            }
            finally
            {
                if (mySQL != null)
                {
                    mySQL.Close();
                }
                if (dr != null)
                {
                    dr.Close();
                }
            }
        }
Exemple #12
0
        /// <summary>
        /// ��Ӳ���
        /// </summary>
        /// <param name="pid">�����ŵĸ�����id</param>
        /// <param name="name">�����ŵ�����</param>
        /// <param name="description">�����ŵ�����</param>
        /// <returns>�����ŷ��䵽��id</returns>
        public static long Add(long ParentDepartmentID,string name,string description)
        {
            Database db = new Database();
            SqlParameter[] prams = new SqlParameter[3];

            prams[0] = new SqlParameter();
            prams[1] = new SqlParameter();
            prams[2] = new SqlParameter();

            prams[0].SqlDbType = SqlDbType.Int;
            prams[0].ParameterName = "@Dept_ParentID";
            prams[0].Value = ParentDepartmentID;

            prams[1].SqlDbType = SqlDbType.VarChar;
            prams[1].Size = 255;
            prams[1].ParameterName = "@Dept_Name";
            prams[1].Value = name;

            prams[2].SqlDbType = SqlDbType.Text;
            prams[2].ParameterName = "@Dept_Remark";
            prams[2].Value = description;

            //prams[3] = new SqlParameter();
            //prams[3].SqlDbType = SqlDbType.Int;
            //prams[3].ParameterName = "@ID";
            //prams[3].Direction = ParameterDirection.ReturnValue;

            return (db.RunProc("sp_AddDepartment",prams));
        }
Exemple #13
0
        private void BindGrid()
        {
            SqlDataReader dr; //������������
            Database db = new Database();
            SqlParameter[] prams = {
                                       db.MakeInParam("@StaffType",SqlDbType.Bit,1,DisplayType)
                                   };
            db.RunProc("sp_GetAllStaff",prams,out dr);
            DataTable dt =Tools.ConvertDataReaderToDataTable(dr);

            dbStaffList.DataSource = dt.DefaultView;
            dbStaffList.DataBind();
            if(DisplayType==0)
            {
                //				lbOnline.BackColor = Color.FromArgb(0xCCCCCC);
                //				lbOffLine.BackColor =Color.FromArgb(0xFFFFFF);
                cmdRehab.Visible = false;
                cmdDimission.Visible = true;
                cmdChangePosition.Visible =true;
            }
            else
            {
                //				lbOnline.BackColor =Color.FromArgb(0xFFFFFF);
                //				lbOffLine.BackColor =Color.FromArgb(0xCCCCCC);
                cmdRehab.Visible = true;
                cmdDimission.Visible = false;
                cmdChangePosition.Visible =false;

            }
        }
Exemple #14
0
        /// <summary>
        /// ��ȡij�ڵ���ϸ��Ϣ
        /// </summary>
        /// <param name="ClassID">��ĿID</param>
        public SqlDataReader GetClassDetail(int ClassID)
        {
            SqlDataReader dataReader = null;
            Database data = new Database();
            SqlParameter[] prams =
                                {
                                    data.MakeInParam("@ClassID",	SqlDbType.Int, 20 ,ClassID)
                                };
            try
            {
                data.RunProc("sp_GetClass", prams, out dataReader);
                return dataReader;
            }

            catch (Exception ex)
            {
                Error.Log(ex.ToString());
                return null;
            }
            //finally
            //{
            //    data.Close();
            //    data.Dispose();
            //    dataReader.Close();
            //    dataReader.Dispose();
            //}
        }
Exemple #15
0
        /// <summary>
        /// ��Ŀ���
        /// </summary>
        public void Add(int ParentID,string ProjectName,string ProjectRemark,string Wright,int Status,int Scale,DateTime StartDate,DateTime EndDate)
        {
            // �������ݿ�����༰DataReader
            Database data = new Database();

            // ִ�д洢���̣�������SqlDataReader����
            SqlParameter[] prams = {
                                       data.MakeInParam("@ParentID" , SqlDbType.Int, 20, ParentID),
                                       data.MakeInParam("@ProjectName" , SqlDbType.NVarChar, 20, ProjectName.Trim()),
                                       data.MakeInParam("@ProjectRemark" , SqlDbType.NVarChar, 400, ProjectRemark.Trim()),
                                       data.MakeInParam("@Wright" , SqlDbType.NVarChar, 40, Wright),
                                       data.MakeInParam("@Status" , SqlDbType.Int, 40, Status),
                                       data.MakeInParam("@Scale" , SqlDbType.Int, 20, Scale),
                                       data.MakeInParam("@StartDate" , SqlDbType.DateTime, 30, StartDate),
                                       data.MakeInParam("@EndDate" , SqlDbType.DateTime, 30, EndDate)
                                   };

            try
            {
                data.RunProc("sp_AddProject",prams);

            }
            catch(Exception ex)
            {
                Error.Log(ex.ToString());
                throw new Exception("��Ŀ��ӳ���",ex);
            }
            finally
            {
                data	   = null;
            }
        }
Exemple #16
0
        /// <summary>
        /// ��Ŀ¼�ڵ�
        /// </summary>
        /// <param name="ClassID">��Ŀ¼�ڵ�</param>
        /// <returns>��Ŀ¼�ڵ�</returns>
        public void AddClass(int ParentID, string ClassName, string ClassRemark, int ClassType, string AddedBy, DateTime AddedDate, int Status)
        {
            Database data = new Database();
            SqlParameter[] prams = {
                                       data.MakeInParam("@ClassParentID" , SqlDbType.Int, 20, ParentID),
                                       data.MakeInParam("@ClassName" , SqlDbType.NVarChar, 20, ClassName),
                                       data.MakeInParam("@ClassRemark" , SqlDbType.NVarChar, 400, ClassRemark),
                                       data.MakeInParam("@ClassType" , SqlDbType.Int, 1, ClassType),
                                       data.MakeInParam("@AddedBy" , SqlDbType.NVarChar, 40, AddedBy),
                                       data.MakeInParam("@AddedDate" , SqlDbType.DateTime, 30, AddedDate),
                                       data.MakeInParam("@Status" , SqlDbType.Int, 1, Status)
                                   };

            try
            {
                data.RunProc("sp_AddTeam", prams);

            }
            catch (Exception ex)
            {
                Error.Log(ex.ToString());
                throw new Exception("Ŀ¼��ӳ���", ex);
            }
            finally
            {
                if (data != null)
                {
                    data.Close();
                    data.Dispose();
                }
            }
        }
Exemple #17
0
        /// <summary>
        /// �õ��ҵ������ĵ�
        /// </summary>
        /// <param name="UserName">�û���</param>
        /// <param name="RightCode">�鿴�ĵ���Ȩ�޴���</param>
        /// <returns>����dataReader</returns>
        public SqlDataReader GetMyDocument(string UserName,int RightCode)
        {
            Database data = new Database();
            SqlDataReader dataReader = null;
            // ִ�д洢���̣�������SqlDataReader����
            SqlParameter[] prams = {
                                       data.MakeInParam("@UserName" , SqlDbType.VarChar , 300, UserName),
                                       data.MakeInParam("@RightCode",SqlDbType.Int,4,RightCode)
                                   };

            try
            {
                data.RunProc("sp_GetMyNewDoc",prams,out dataReader);
                return dataReader;

            }
            catch(Exception ex)
            {
                Error.Log(ex.ToString());
                throw new Exception("��ȡ�ҵ��ĵ�����!",ex);
            }
            //finally
            //{
            //    data	   = null;
            //    dataReader = null;
            //}
        }
Exemple #18
0
        public void BindGrid()
        {
            SqlDataReader dr; //���Ȩ������
            string spName;//�洢������
            spName = "";
            Database db = new Database();
            SqlParameter[] prams = new SqlParameter[1];
            switch(DisplayType)
            {
                case "0":
                    prams[0] = db.MakeInParam("@PositionID",SqlDbType.Int,4,Int32.Parse(strObjID));
                    spName = "sp_GetPositionRightList";
                    break;
                case "1":
                    prams[0] = db.MakeInParam("@Teamid",SqlDbType.Int,4,Int32.Parse(strObjID));
                    spName = "sp_GetTeamRightList";
                    break;
                case "2":
                    prams[0] = db.MakeInParam("@RoleID",SqlDbType.Int,4,Int32.Parse(strObjID));
                    spName = "sp_GetRoleRightList";
                    break;
                default:
                    break;
                    //������
            }

            db.RunProc(spName,prams,out dr);

            DataTable dt =Tools.ConvertDataReaderToDataTable(dr);

            RightsGrid.DataSource = dt.DefaultView;
            RightsGrid.DataBind();
        }
Exemple #19
0
    /// <summary>
    /// 删除附件
    /// </summary>
    public void DelAttachment(string attachmentmd)
    {
        UDS.Components.Database data = new UDS.Components.Database();
        //删除所有回复附件
        //得到所有回复
        UDS.Components.BBSClass bbs = new UDS.Components.BBSClass();
        SqlDataReader           dr1 = null;

        dr1 = bbs.ReadBBSForumItemReplay(this);
        while (dr1.Read())
        {
            BBSReplay replay = new BBSReplay();
            replay.ReplayId = Int32.Parse(dr1["replay_id"].ToString());
            replay.DelAttachment(attachmentmd);
        }
        //删除贴子本身附件
        SqlParameter[] prams =
        {
            data.MakeInParam("@itemid", SqlDbType.Int, 4, this.ItemID),
        };
        SqlDataReader dr = null;

        data.RunProc("sp_BBS_GetItemAttachment", prams, out dr);
        while (dr.Read())
        {
            System.IO.File.Delete(attachmentmd + "\\" + dr["filename"].ToString());
        }
        data.Close();
        SqlParameter[] prams1 =
        {
            data.MakeInParam("@itemid", SqlDbType.Int, 4, this.ItemID),
        };
        data.RunProc("sp_BBS_DelAttachmentToItem", prams1);
    }
Exemple #20
0
 public static int Delete(long PositionID)
 {
     Database db = new Database();
     SqlParameter[] prams = {
                                 db.MakeInParam("@Position_id",SqlDbType.Int,4,PositionID)
                            };
     return(db.RunProc("sp_DeletePosition",prams));
 }
Exemple #21
0
 public static int Delete(long DepartmentID)
 {
     Database db = new Database();
     SqlParameter[] prams = {
                                 db.MakeInParam("@Dept_id",SqlDbType.Int,4,DepartmentID)
                            };
     return(db.RunProc("sp_DeleteDepartment",prams));
 }
Exemple #22
0
 public void AddBoardMaster(int boardid,int staffid)
 {
     Database data = new Database ();
     SqlParameter[] prams = {
                                data.MakeInParam("@BoardID",  SqlDbType.Int, 4,boardid),
                                data.MakeInParam("@StaffID",  SqlDbType.Int, 4,staffid)
                            };
     data.RunProc ("sp_BBS_SetupBoardMaster",prams);
 }
Exemple #23
0
 private void BindPosition()
 {
     UDS.Components.Database db = new UDS.Components.Database();
     SqlDataReader dr_position = null;
     db.RunProc("sp_GetAllPosition",out dr_position);
     cboPosition.DataSource = dr_position;
     cboPosition.DataTextField = "Position_Name";
     cboPosition.DataValueField = "Position_ID";
     cboPosition.DataBind();
 }
Exemple #24
0
 /// <summary>
 /// ��ӿ���ʱ��
 /// </summary>
 /// <param name="id">����id</param>
 /// <param name="ondutytime">�ϰ�ʱ��</param>
 /// <param name="offdutytime">�°�ʱ��</param>
 /// <returns></returns>
 public static int AddDutyTime(long DepartmentID,DateTime ondutytime,DateTime offdutytime)
 {
     Database db = new Database();
     SqlParameter[] prams = {
                                db.MakeInParam("@departmentid",SqlDbType.Int,4,DepartmentID),
                                db.MakeInParam("@ondutytime",SqlDbType.DateTime,8,ondutytime),
                                db.MakeInParam("@offdutytime",SqlDbType.DateTime,8,offdutytime)
                            };
     return (db.RunProc("sp_WA_AddDepartmentDutyTime",prams));
 }
Exemple #25
0
 private void BindPosition()
 {
     Database db = new Database();
     SqlDataReader dr;
     db.RunProc("SP_Ext_GetPosition",out dr);
     ddl_Position.DataSource = dr;
     ddl_Position.DataTextField = "Position_Name";
     ddl_Position.DataValueField = "Position_ID";
     ddl_Position.DataBind();
     ddl_Position.Items.Insert(0,new ListItem("ȫ��","0"));
 }
Exemple #26
0
        private void BindPosition()
        {
            UDS.Components.Database db          = new UDS.Components.Database();
            SqlDataReader           dr_position = null;

            db.RunProc("sp_GetAllPosition", out dr_position);
            cboPosition.DataSource     = dr_position;
            cboPosition.DataTextField  = "Position_Name";
            cboPosition.DataValueField = "Position_ID";
            cboPosition.DataBind();
        }
Exemple #27
0
 //string CatalogName,string CatalogDescription
 //��uds_bbs_catalog��,������¼
 public bool AddBBSCatalog(BBSCatalog BBSCatalog)
 {
     //���� CatalogName ��ʾBBS�е�title , ���� CatalogDescription ��ʾBBS�е�content
     //���洢���̴��ݲ���
     Database data = new Database();
     SqlParameter[] prams = {
                                data.MakeInParam("@title",  SqlDbType.VarChar, 300, BBSCatalog.CatalogName),
                                data.MakeInParam("@content", SqlDbType.NText, 16, BBSCatalog.CatalogDescription),
     };
     data.RunProc ("sp_BBS_AddCatalog",prams);
     return true;
 }
Exemple #28
0
        private void Bangding()
        {
            SqlDataReader dr=null; //������������
            Database mySQL = new Database();
            try
            {
                string strProcName;

                switch (DisplayType)
                {
                    case 1:
                        //strProcName ="sp_Flow_GetMySignIn";
                        strProcName = "sp_Flow_GetMyPostil";
                        Response.Cookies["DisplayStatus"].Value = "Postil";
                        break;
                    case 2:
                        strProcName = "sp_Flow_GetMydDocument";
                        Response.Cookies["DisplayStatus"].Value = "MyDocument";
                        break;
                    case 3:
                        strProcName = "sp_Flow_GetPostiledDocument";
                        Response.Cookies["DisplayStatus"].Value = "Postiled";
                        break;
                    default:
                        strProcName = "sp_Flow_GetMySignIn";
                        break;

                }

                SqlParameter[] parameters = {
                                            mySQL.MakeInParam("@StaffName",SqlDbType.VarChar,300,UserName)
                                        };

                mySQL.RunProc(strProcName, parameters, out dr);

                DataTable dt = Tools.ConvertDataReaderToDataTable(dr);

                dgDocumentList.DataSource = dt.DefaultView;
                dgDocumentList.DataBind();
            }
            finally
            {
                if (mySQL != null)
                {
                    mySQL.Close();
                }
                if (dr != null)
                {
                    dr.Close();
                }
            }
        }
Exemple #29
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            // �ڴ˴������û������Գ�ʼ��ҳ��
            SqlDataReader dr_sellman = null;
            Database db = new Database();

            db.RunProc("sp_GetAllStaff",out dr_sellman);
            lbx_Staff.DataSource = dr_sellman;
            lbx_Staff.DataTextField = "staff_name";
            lbx_Staff.DataValueField = "staff_id";
            lbx_Staff.DataBind();
            dr_sellman.Close();
        }
Exemple #30
0
        private void BindGrid()
        {
            SqlDataReader dr; //������������
            Database db = new Database();
            SqlParameter[] prams = {
                                       db.MakeInParam("@Dept_ID",SqlDbType.Int,4,DeptID),
                                       db.MakeInParam("@Dimission",SqlDbType.Bit,1,DisplayType)
                                   };
            db.RunProc("sp_GetStaffInDepartment",prams,out dr);
            DataTable dt =Tools.ConvertDataReaderToDataTable(dr);

            dbStaffList.DataSource = dt.DefaultView;
            dbStaffList.DataBind();
        }
Exemple #31
0
        private void Bangding()
        {
            SqlDataReader dr=null; //������������
            Database mySQL = new Database();
            try
            {
                String UserName;
                UserName = Server.UrlDecode(Request.Cookies["UserName"].Value);

                SqlParameter[] parameters = {
                                            mySQL.MakeInParam("@UserName",SqlDbType.VarChar,255,UserName)
                                        };

                mySQL.RunProc("sp_GetSubscripitionClass", parameters, out dr);

                DataTable dt = Tools.ConvertDataReaderToDataTable(dr);
                //��DataTable��ĩβ���Ͽ��У�ʹ��DataGrid�̶�����
                //			int iBlankRows = dgMySubsciption.PageSize - (dt.Rows.Count % dgMySubsciption.PageSize);
                //
                //			for (int i = 0; i < iBlankRows; i++)
                //			{
                //				dt.Rows.Add(dt.NewRow()) ;
                //			}

                dgMySubsciption.DataSource = dt.DefaultView;
                dgMySubsciption.DataBind();
                //���ڿռ�¼����ʾcheckbox
                //
                //			if(dgMySubsciption.CurrentPageIndex  == dgMySubsciption.PageCount -1 )
                //			{
                //				for(int i= (dgMySubsciption.PageSize - iBlankRows)  ;i<dgMySubsciption.Items.Count;i++)
                //				{
                //					dgMySubsciption.Items[i].FindControl("ClassID").Visible = false;
                //				}
                //			}
            }
            finally
            {
                if (mySQL != null)
                {
                    mySQL.Close();
                }
                if (dr != null)
                {
                    dr.Close();
                }
            }
            btnDeleteSubscription.Attributes ["onclick"]="javascript:return confirm('��ȷ��Ҫɾ���˶�����?');";
        }
Exemple #32
0
        private void cmdOnDepartment_Click(object sender, System.EventArgs e)
        {
            string selectedID = GetSelectedItemID("Staff_ID");

            UDS.Components.Database db = new UDS.Components.Database();
            if (selectedID.Trim() != "")
            {
                SqlParameter[] prams =
                {
                    db.MakeInParam("@StaffIDS", SqlDbType.VarChar, 300, selectedID)
                };
                db.RunProc("sp_StaffRehab", prams);
            }
            Response.Redirect("Listview.aspx?DeptID=" + DeptID + "&displayType=" + DisplayType.ToString());
        }
Exemple #33
0
 private void cmdSubmit_ServerClick(object sender, System.EventArgs e)
 {
     if(this.cbRemind.Checked==true)
         sms_all();
     UDS.Components.Database db = new UDS.Components.Database();
     SqlParameter[] prams = {
                                 db.MakeInParam("@StaffIDS",SqlDbType.VarChar,300,selectedID),
                                 db.MakeInParam("@NewPositionID",SqlDbType.Int,4,Int32.Parse(cboPosition.Items[cboPosition.SelectedIndex].Value))
                            };
     db.RunProc("sp_StaffMove",prams);
     if(ReturnPage ==0)
         Response.Redirect(backfilepath+"?PositionID="+PositionID+"&displayType="+displayType);
     else
         Response.Redirect("../Staff/ManageStaff.aspx?DisplayType=0");
 }
Exemple #34
0
        private void Bangding()
        {
            SqlDataReader dr; //������������
            Database mySQL = new Database();

            SqlParameter[] parameters = {
                                            mySQL.MakeInParam("@StyleID",SqlDbType.Int ,4,0)
                                        };

            mySQL.RunProc("sp_Flow_GetStyle",parameters,out dr);

            DataTable dt =Tools.ConvertDataReaderToDataTable(dr);

            dgStyleList.DataSource = dt.DefaultView;
            dgStyleList.DataBind();
        }
Exemple #35
0
 /// <summary>
 /// 将附件和回复绑定
 /// </summary>
 /// <param name="filenames">文件名,多个文件名用 , 分开</param>
 public void Attach(string filenames)
 {
     UDS.Components.Database data = new UDS.Components.Database();
     string[] arrfilename         = filenames.Split(',');
     for (int i = 0; i < arrfilename.Length; i++)
     {
         if (arrfilename[i].Trim() != "")
         {
             SqlParameter[] prams =
             {
                 data.MakeInParam("@replayid", SqlDbType.Int,       4, this.ReplayId),
                 data.MakeInParam("@filename", SqlDbType.VarChar, 500, arrfilename[i])
             };
             data.RunProc("sp_BBS_AttachmentToReplay", prams);
         }
     }
 }
        private void BindData()
        {
            string staffids = "";

            UDS.Components.Staff staff = new UDS.Components.Staff();

            //绑定该客户的联系人
            UDS.Components.Database db = new UDS.Components.Database();
            SqlDataReader           dr_ClientLinkman = null;

            SqlParameter[] prams =
            {
                db.MakeInParam("@clientid", SqlDbType.Int, 4, clientid)
            };
            db.RunProc("sp_CM_GetAllLinkmanFromClient", prams, out dr_ClientLinkman);
            lbx_ClientLinkman.DataSource     = dr_ClientLinkman;
            lbx_ClientLinkman.DataTextField  = "Name";
            lbx_ClientLinkman.DataValueField = "id";
            lbx_ClientLinkman.DataBind();
            dr_ClientLinkman.Close();

            //绑定协同人员候选列表
            SqlDataReader dr_staff = null;

            for (int i = 0; i < lbx_Cooperater.Items.Count; i++)
            {
                staffids += lbx_Cooperater.Items[i].Value + ",";
            }
            if (staffids.Length != 0)
            {
                staffids = staffids.Substring(0, staffids.Length - 1);
            }

            dr_staff = staff.GetRemainStaff(staffids);

            lbx_Staff.DataSource     = dr_staff;
            lbx_Staff.DataTextField  = "realname";
            lbx_Staff.DataValueField = "staff_id";
            lbx_Staff.DataBind();
            dr_staff.Close();

            ControlClientContactHistory1.MyClientID = clientid;
            ControlClientContactHistory1.BindData();
        }
Exemple #37
0
        private void cmdOnPosition_Click(object sender, System.EventArgs e)
        {
            string selectedID = GetSelectedItemID("Staff_ID");

            UDS.Components.Database db = new UDS.Components.Database();
            if (selectedID.Trim() != "")
            {
                SqlParameter[] prams =
                {
                    db.MakeInParam("@StaffIDS", SqlDbType.VarChar, 300, selectedID)
                };
                db.RunProc("sp_StaffRehab", prams);
                if (this.cbRemind.Checked == true)
                {
                    sms_all(1);
                }
            }
            Response.Redirect("Listview.aspx?PositionID=" + PositionID + "&displayType=" + DisplayType.ToString());
        }
Exemple #38
0
    /// <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);
    }
Exemple #39
0
 private void cmdSubmit_ServerClick(object sender, System.EventArgs e)
 {
     if (this.cbRemind.Checked == true)
     {
         sms_all();
     }
     UDS.Components.Database db    = new UDS.Components.Database();
     SqlParameter[]          prams =
     {
         db.MakeInParam("@StaffIDS",      SqlDbType.VarChar, 300, selectedID),
         db.MakeInParam("@NewPositionID", SqlDbType.Int,       4, Int32.Parse(cboPosition.Items[cboPosition.SelectedIndex].Value))
     };
     db.RunProc("sp_StaffMove", prams);
     if (ReturnPage == 0)
     {
         Response.Redirect(backfilepath + "?PositionID=" + PositionID + "&displayType=" + displayType);
     }
     else
     {
         Response.Redirect("../Staff/ManageStaff.aspx?DisplayType=0");
     }
 }
        private void btn_search_Click(object sender, System.EventArgs e)
        {
            string sqlstr = "";
            string id     = "";

            UDS.Components.Database db = new UDS.Components.Database();
            SqlDataReader           dr = null;

            sqlstr = "select top 1 id from UDS_CM_ClientInfo WHERE name like '%" + tbx_quicksearch.Text.Replace("'", "''") + "%' and AddmanID=" + Request.Cookies["UserID"].Value;
            SqlParameter[] prams =
            {
                db.MakeInParam("@SQL", SqlDbType.NText, 5000, sqlstr)
            };
            db.RunProc("sp_RunSQL", prams, out dr);
            while (dr.Read())
            {
                id = dr["id"].ToString();
            }
            dr.Close();
            if (id != "")
            {
                foreach (ListItem lt in ddl_ClientName.Items)
                {
                    if (lt.Value == id)
                    {
                        lt.Selected = true;
                    }
                    else
                    {
                        lt.Selected = false;
                    }
                }
                clientid = Int32.Parse(id);
                DisplayClientInfo();
                BindData();
            }
        }
Exemple #41
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                idtype    = Request.QueryString["idtype"].ToString();
                ids       = Request.QueryString["ids"].ToString();
                begintime = Request.QueryString["begintime"].ToString();
                endtime   = Request.QueryString["endtime"].ToString();

                ViewState["idtype"]    = idtype;
                ViewState["ids"]       = ids;
                ViewState["begintime"] = begintime;
                ViewState["endtime"]   = endtime;
            }
            else
            {
                idtype    = ViewState["idtype"].ToString();
                ids       = ViewState["ids"].ToString();
                begintime = ViewState["begintime"].ToString();
                endtime   = ViewState["endtime"].ToString();
            }

            ds_Duty = (DataSet)Cache["WA_Duty"];
            //从TotalDuty.xsd获得架构
            ds_Report = new DataSet();
            ds_Report.ReadXmlSchema(Request.MapPath(".") + "\\TotalDuty.xsd");

            #region 缓存如果不存在
            if (ds_Duty == null)
            {
                //重新获取ds_Duty
                SqlDataReader           dr, dr1, dr2;
                SqlParameter[]          prams = new SqlParameter[4];
                UDS.Components.Database db    = new UDS.Components.Database();
                DataSet ds = new DataSet();
                //得到考勤数据
                prams[0] = db.MakeInParam("@begintime", SqlDbType.DateTime, 8, begintime);
                prams[1] = db.MakeInParam("@endtime", SqlDbType.DateTime, 8, endtime);
                prams[2] = db.MakeInParam("@ids", SqlDbType.VarChar, 1000, ids);
                prams[3] = db.MakeInParam("@idtype", SqlDbType.VarChar, 50, idtype);
                db.RunProc("sp_WA_GetAttendanceData", prams, out dr);
                DataTable datatable = Tools.ConvertDataReaderToDataTable(dr);
                ds.Tables.Add(datatable);
                db.Dispose();
                dr.Close();
                //得到人员名单
                if (idtype == "staff")
                {
                    SqlParameter[] prams1 = { db.MakeInParam("@ids", SqlDbType.VarChar, 1000, ids) };
                    db.RunProc("sp_WA_GetSelectedStaffFromID", prams1, out dr1);
                    DataTable datatable1 = Tools.ConvertDataReaderToDataTable(dr1);
                    ds.Tables.Add(datatable1);
                    db.Dispose();
                    dr1.Close();
                }
                else if (idtype == "Position")
                {
                    SqlParameter[] prams1 =
                    {
                        db.MakeInParam("@Position_id", SqlDbType.Int, 4, Int32.Parse(ids)),
                        db.MakeInParam("@Dimission",   SqlDbType.Bit, 1, 0)
                    };
                    db.RunProc("sp_GetStaffInPosition", prams1, out dr1);
                    DataTable datatable1 = Tools.ConvertDataReaderToDataTable(dr1);
                    ds.Tables.Add(datatable1);
                    db.Dispose();
                    dr1.Close();
                }
                else if (idtype == "company")
                {
                    SqlParameter[] prams1 =
                    {
                        db.MakeInParam("@StaffType", SqlDbType.Int, 4, 0)
                    };
                    db.RunProc("sp_GetAllStaff", prams1, out dr1);
                    DataTable datatable1 = Tools.ConvertDataReaderToDataTable(dr1);
                    ds.Tables.Add(datatable1);
                    db.Dispose();
                    dr1.Close();
                }

                SqlParameter[] prams2 =
                {
                    db.MakeInParam("@begintime", SqlDbType.DateTime, 8, begintime),
                    db.MakeInParam("@endtime",   SqlDbType.DateTime, 8, endtime)
                };
                db.RunProc("sp_WA_GetDutyDay", prams2, out dr2);
                DataTable datatable2 = Tools.ConvertDataReaderToDataTable(dr2);
                ds.Tables.Add(datatable2);
                db.Dispose();
                dr2.Close();

                //缓存数据
                Cache["WA_Duty"] = ds;

                ds_Duty = (DataSet)Cache["WA_Duty"];
            }
            #endregion

            //生成ds_Report以可以绑定到rpt
            //ds_Duty.Tables[0] 考勤数据
            //ds_Duty.Tables[1] 人员数据
            //ds_Duty.Tables[2] 考勤日期数据

            //遍历人员数据表以生成新的ds_Report
            for (int i = 0; i < ds_Duty.Tables[1].Rows.Count; i++)
            {
                DataRow row = ds_Report.Tables[0].NewRow();
                row[0] = ds_Duty.Tables[1].Rows[i]["RealName"];
                row[1] = GetDutyDateCount(ds_Duty.Tables[0].DefaultView, ds_Duty.Tables[2].DefaultView, ds_Duty.Tables[1].Rows[i]["Staff_ID"].ToString(), 0);
                row[2] = GetDutyDateCount(ds_Duty.Tables[0].DefaultView, ds_Duty.Tables[2].DefaultView, ds_Duty.Tables[1].Rows[i]["Staff_ID"].ToString(), 1);
                row[3] = GetDutyDateCount(ds_Duty.Tables[0].DefaultView, ds_Duty.Tables[2].DefaultView, ds_Duty.Tables[1].Rows[i]["Staff_ID"].ToString(), 2);
                row[4] = GetDutyDateCount(ds_Duty.Tables[0].DefaultView, ds_Duty.Tables[2].DefaultView, ds_Duty.Tables[1].Rows[i]["Staff_ID"].ToString(), 3);
                row[5] = GetDutyDateCount(ds_Duty.Tables[0].DefaultView, ds_Duty.Tables[2].DefaultView, ds_Duty.Tables[1].Rows[i]["Staff_ID"].ToString(), 4);

                ds_Report.Tables[0].Rows.Add(row);
            }

            myreport = new rpt_DutyReport();
            myreport.SetDataSource(ds_Report);
            cv_Duty.ReportSource = myreport;
            cv_Duty.DataBind();
        }
Exemple #42
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 (myposition.Visible == true)
                {
                    PositionID = cboPosition.Items[cboPosition.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("@PositionID",   SqlDbType.Int,        4, Int32.Parse(PositionID)),
                    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.MakeInParam("@Caste",        SqlDbType.Int,        4, Int32.Parse(txtCaste.Text))
                };
                db.RunProc("sp_AddStaff", prams, out dr);
                if (dr.Read())
                {
                    SqlDataReader        dr_isok;             //所有在职人员
                    UDS.Components.Staff sta = new UDS.Components.Staff();
                    dr_isok = sta.GetAllStaffs();
                    //处理短信提醒
                    if (this.cbRemind.Checked == true)
                    {
                        while (dr_isok.Read())
                        {
                            SMS sm = new SMS();
                            sm.SendMsg(Username, dr_isok["Staff_name"].ToString(), cboPosition.SelectedItem.Text + "处新到员工 " + txtRealName.Text + ",特此通知.", 1, DateTime.Now, "", 0, 0);
                            //sm.SendMsg(Username,mailbody.MailReceiverStr+mailbody.MailCcToAddr+mailbody.MailBccToAddr,"您从"+Username+"处收到了一封新的邮件",1,DateTime.Now,"",0,0);
                            sm = null;
                        }
                        dr_isok = null;
                    }
                    if (ReturnPage == 0)
                    {
                        Response.Redirect("ListView.aspx?Position_ID=" + PositionID);
                    }
                    else
                    {
                        Response.Redirect("../Staff/ManageStaff.aspx");
                    }
                    dr = null;
                }
                else
                {
                    message.Text = "<font color=red>该用户已经存在!</font>";
                }
            }
            else
            {
                UDS.Components.Staff person = new UDS.Components.Staff();
                switch (person.UpdateInfo(StaffID, txtRealName.Text, sex, txtBirthday.Text == "-"?"1900-01-01":txtBirthday.Text, txtPassword.Text, txtEmail.Text, txtPhone.Text, txtMobile.Text, Int32.Parse(cboPosition.Items[cboPosition.SelectedIndex].Value), Int32.Parse(txtCaste.Text)))
                {
                case 0:
                    PositionID = Int32.Parse(cboPosition.Items[cboPosition.SelectedIndex].Value).ToString();
                    if (ReturnPage == 0)
                    {
                        Response.Redirect("ListView.aspx?Position_ID=" + PositionID);
                    }
                    else
                    {
                        Response.Redirect("../Staff/ManageStaff.aspx");
                    }
                    message.Text = "修改成功!";
                    break;

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

                default:
                    break;
                }
            }
        }