Exemple #1
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 #2
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 #3
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 #4
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 #5
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 #6
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 #7
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 #8
0
        private void Bangding()
        {
            SqlDataReader dr;
            Database db = new Database();
            SqlParameter[] parms = {
                                        db.MakeInParam("@NewsID",SqlDbType.Int  ,4,BoardID),
                                    };
            db.RunProc("sp_Flow_GetNews", parms, out dr);
            try
            {
                if (dr.Read())
                {
                    // txtBoardName.Text = dr["Board_Name"].ToString();

                    this.board_content.InnerHtml = dr["News_Content"].ToString();
                }

                if (db != null)
                {
                    db.Close();
                    db = null;
                }
            }
            finally
            {
                if (db != null)
                {
                    db.Close();
                }
                if (dr != null)
                {
                    dr.Close();
                }
                dr = null;
            }
        }
Exemple #9
0
        public void BindGrid()
        {
            SqlDataReader dr=null; //���Ȩ������
            string spName;//�洢������
            spName = "";
            Database db = new Database();
            SqlParameter[] prams = new SqlParameter[1];
            try
            {
                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();
            }
            finally
            {
                if (db != null)
                { db.Close(); }
                if (dr != null)
                {

                    dr.Close();
                }
            }
        }
Exemple #10
0
 private void Page_Load(object sender, System.EventArgs e)
 {
     // �ڴ˴������û������Գ�ʼ��ҳ��
     SqlDataReader dr_sellman = null;
     Database db = new Database();
     try
     {
         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();
     }
     finally
     {
         db.Close();
         dr_sellman.Close();
     }
 }
Exemple #11
0
        private void Bingding()
        {
            SqlDataReader dr;
            Database mySQL = new Database();
            SqlParameter[] p2 = {
                                    mySQL.MakeInParam("@StaffName",SqlDbType.VarChar,300,UserName)
            };

            mySQL.RunProc("sp_Flow_GetParentProject",p2,out dr);

            lbProject.Items.Clear();
            while(dr.Read())
            {
                lbProject.Items.Add(new ListItem(dr["ClassName"].ToString(),dr["ClassID"].ToString()));
            }

            dr.Close();
            mySQL.Close();
        }
Exemple #12
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)
                            };
     try
     {
         data.RunProc("sp_BBS_SetupBoardMaster", prams);
     }
     finally
     {
         if (data != null)
         {
             data.Close();
             data.Dispose();
         }
     }
 }
Exemple #13
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 #14
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),
     };
     try
     {
         data.RunProc("sp_BBS_AddCatalog", prams);
     }
     finally
     {
         if (data != null)
         {
             data.Close();
             data.Dispose();
         }
     }
     return true;
 }
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),
                                       data.MakeInParam("@ProjectRemark" , SqlDbType.NVarChar, 400, ProjectRemark),
                                       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
            {
                if (data != null)
                {
                    data.Close();
                    data.Dispose();
                }
                data	   = null;
            }
        }
Exemple #16
0
        private void BindPosition()
        {
            Database db = new Database();
            SqlDataReader dr=null;
            try
            {
                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"));
            }
            finally
            {
                if (db != null)
                { db.Close(); }
                if (dr != null)
                {

                    dr.Close();
                }
            }
        }
Exemple #17
0
        private void FillStep(DropDownList ddStep,long iFlowID)
        {
            SqlDataReader dr; //������������
            Database mySQL = new Database();

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

            mySQL.RunProc("sp_Flow_GetStep",parameters,out dr);
            ddStep.Items.Clear();
            try
            {
                while (dr.Read())
                {
                    ddStep.Items.Add(new ListItem(dr["Step_name"].ToString(), dr["Step_id"].ToString()));
                }
            }
            finally
            {
                if (mySQL != null)
                {
                    mySQL.Close();
                }
                if (dr != null)
                {
                    dr.Close();
                }
                dr = null;
            }

            ddStep.Items.Add(new ListItem("�������ĵ���","0"));
        }
Exemple #18
0
        /// <summary>
        /// 判断用户对对象是否有某个权限
        /// </summary>
        /// <param name="UserName">用户名</param>
        /// <param name="classID">被检查的对象</param>		
        /// <param name="actID">权限ID</param>
        /// <returns>是否有权限</returns>
        public bool GetAccessPermission(string UserName,int classID,int actID)
        {
            int flag = 0;
            // 定义数据库操作类及DataReader
            Database data = new Database();

            // 执行存储过程,并返回SqlDataReader对象
            SqlParameter[] prams = {
                                       data.MakeInParam("@Class_ID" , SqlDbType.Int, 20, classID),
                                       data.MakeInParam("@UserName" , SqlDbType.NVarChar, 20, UserName),
                                       data.MakeInParam("@Act_ID" , SqlDbType.Int, 20, actID),
                                       // data.MakeInParam("@Inheit" , SqlDbType.Bit, 1, 1),
                                       data.MakeOutParam("@ReturnValue",SqlDbType.Int,20)
                                   };

            try
            {
                data.RunProc("sp_GetAccessPermission",prams);
                flag = Int32.Parse(prams[3].Value.ToString());
                return (flag==1)?true:false;
            }
            catch(Exception ex)
            {
                Error.Log(ex.ToString());
                throw new Exception("获取访问权出错",ex);
            }
            finally
            {
                if (data != null)
                {
                    data.Close();
                    data.Dispose();
                    data = null;
                }
            }
        }
Exemple #19
0
        private void DataBindObject(object sender)
        {
            Database db = new Database();
            SqlDataReader dr=null;
            try
            {
                if (sender.GetType().ToString() == "System.Web.UI.WebControls.DropDownList")
                {
                    db.RunProc("SP_Ext_GetPosition", out dr);
                    ((DropDownList)sender).DataSource = dr;
                    ((DropDownList)sender).DataTextField = "Position_Name";
                    ((DropDownList)sender).DataValueField = "Position_ID";
                    ((DropDownList)sender).DataBind();
                }
                else if (sender.GetType().ToString() == "System.Web.UI.WebControls.ListBox")
                {
                    SqlParameter[] prams = {
                                             db.MakeInParam("@StaffType",SqlDbType.Bit,1,0)
                    };
                    db.RunProc("sp_GetAllStaff", prams, out dr);
                    ((ListBox)sender).DataSource = dr;
                    ((ListBox)sender).DataTextField = "realname";
                    ((ListBox)sender).DataValueField = "Staff_ID";
                    ((ListBox)sender).DataBind();
                    ((ListBox)sender).SelectedIndex = 0;
                    dr.Close();
                }
            }
            catch (Exception ex)
            {
                UDS.Components.Error.Log(ex.Message);
                Server.Transfer("../Error.aspx");
            }
            finally //�ر�db
            {
                if (db != null)
                {
                    db.Close();
                }
                if (dr != null)
                {
                    dr.Close();
                }

            }
        }
Exemple #20
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 #21
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            if(!Page.IsPostBack)
            {
                Database db = new Database();
                SqlDataReader dr = null ;

                try
                {
                    db.RunProc("sp_WA_GetCompanyDutyTime",out dr);
                }
                catch(Exception ex)
                {
                    UDS.Components.Error.Log(ex.Message);
                    Server.Transfer("../Error.aspx");
                }
                try
                {
                    while (dr.Read())
                    {
                        tbx_OnDutyTime.Text = DateTime.Parse(dr["OnDutyTime"].ToString()).ToShortTimeString();
                        tbx_OffDutyTime.Text = DateTime.Parse(dr["OffDutyTime"].ToString()).ToShortTimeString();
                    }
                }
                finally
                {
                    if (db != null)
                    {
                        db.Close();
                    }
                    if (dr != null)
                    {
                        dr.Close();
                    }

                }
            }
        }
        private void GetRoleNode(Microsoft.Web.UI.WebControls.TreeNode tv)
        {
            TreeView1.ShowToolTip = true;
            Database db = new Database();
            SqlDataReader dr = null;
            try
            {
                db.RunProc("sp_GetRole", out dr);
                while (dr.Read())
                {
                    Microsoft.Web.UI.WebControls.TreeNode tn = new Microsoft.Web.UI.WebControls.TreeNode();
                    tn.ID = dr["Role_ID"].ToString();
                    tn.Text = "<span onmouseover=javascript:title='" + dr["Role_Description"].ToString() + "'>" + dr["Role_Name"].ToString() + "</span>";
                    tn.ImageUrl = GetIcon("9");
                    tn.NavigateUrl = "ListView.aspx?Role_ID=" + dr["Role_ID"].ToString();
                    tn.Target = "MainFrame";
                    tv.Nodes.Add(tn);
                }
                dr.Close();
            }
            catch (Exception ex)
            {
                Response.Write(ex.ToString());
                UDS.Components.Error.Log(ex.ToString());
            }
            finally
            {
                if (db != null)
                { db.Close(); }
                if (dr != null)
                {

                    dr.Close();
                }

            }
        }
Exemple #23
0
        private void BandFlow()
        {
            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);
                if (dt.Rows.Count < 5)
                {
                    int tmp = 5 - dt.Rows.Count;
                    for (int i = 0; i < tmp; i++)
                    {
                        DataRow myDataRow = dt.NewRow();

                        myDataRow[2] = "-";
                        dt.Rows.Add(myDataRow);

                    }
                }

                dgFlowList.DataSource = dt.DefaultView;
                dgFlowList.DataBind();
            }
            finally
            {
                if (mySQL != null)
                {
                    mySQL.Close();
                }
                if (dr != null)
                {
                    dr.Close();
                }
            }
        }
Exemple #24
0
        //����
        private void BandBoard()
        {
            SqlDataReader dr = null; //������������
            Database mySQL = new Database();
            try
            {
                SqlParameter[] parameters = {
                                            mySQL.MakeInParam("@BoardID",SqlDbType.Int ,4,0)
                                        };

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

                DataTable dt = Tools.ConvertDataReaderToDataTable(dr);
                 //AddBlankRowInDataTable(5, ref dt);
                //DataView dv = new DataView(dt);
                if (dt.Rows.Count < 5)
                {
                    int tmp = 5 - dt.Rows.Count;
                    for (int i = 0; i < tmp; i++)
                    {
                        DataRow myDataRow = dt.NewRow();

                        myDataRow[3] = "-";
                        dt.Rows.Add(myDataRow);

                    }
                }
                dgBoard.DataSource = dt;
                dgBoard.DataBind();
            }
            finally
            {
                if (mySQL != null)
                {
                    mySQL.Close();
                }
                if (dr != null)
                {
                    dr.Close();
                }
            }
        }
Exemple #25
0
 /// <summary>
 /// �ļ��������ݿ����
 /// </summary>
 /// <param name="att">DocAttachFile��</param>
 /// <param name="DocID">�ļ�ID</param>
 public void AddAttach(DocAttachFile att,int DocID)
 {
     Database data = new 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_Ext_AddFile", prams);
     }
     catch (Exception ex)
     {
         Error.Log(ex.ToString());
         throw new Exception("�ļ��������ͳ���!",ex);
     }
     finally
     {
         if (data != null)
         {
             data.Close();
             data.Dispose();
         }
     }
 }
Exemple #26
0
        /// <summary>
        /// ɾ��һ���ĵ�
        /// </summary>
        /// <param name="MailIDStr">�ĵ�ID�������ַ������ö�������</param>
        public bool DocDelete(string DocIDStr,int DeleteType)
        {
            Database data = new Database();
            SqlParameter[] prams = {
                                       data.MakeInParam("@DocIDs",   SqlDbType.VarChar,4000, DocIDStr),
                                       data.MakeInParam("@DeleteType",SqlDbType.Int,1,DeleteType)
                                   };
            try
            {
                data.RunProc("SP_DeleteDocument",prams);
                data = null;
                return true;
            }
            catch(Exception ex)
            {
                Error.Log(ex.ToString());
                return false;
            }
            finally
            {
                if (data != null)
                {
                    data.Close();
                    data.Dispose();
                }

            }
        }
Exemple #27
0
        private void btnsearch_Click(object sender, System.EventArgs e)
        {
            SqlDataReader dr, dr1, dr2;
            dr = null;
            dr1 = null;
            dr2 = null;
            DataSet ds = new DataSet();
            Database db = new Database();
            try
            {
                btn_Report.Style["display"] = "";
                SqlParameter[] prams = new SqlParameter[4];
                string idtype = "";
                string ids = "";
                switch (ddlsearchbound.SelectedIndex)
                {
                    case 0: idtype = "company"; break;
                    case 1: idtype = "Position"; break;
                    case 2: idtype = "staff"; break;
                }
                if (idtype == "staff")
                {
                    foreach (ListItem staffitem in lbstaffs.Items)
                    {
                        if (staffitem.Selected)
                        {
                            ids = ids + staffitem.Value + ",";
                        }
                    }
                    if (ids != "") ids = ids.Substring(0, ids.Length - 1);
                }
                else if (idtype == "Position")
                {
                    ids = ddldepartments.SelectedItem.Value;
                }
                else if (idtype == "company")
                {
                    ids = "";
                }
                try
                {
                    //�õ���������

                    this.txtbegintime.Text = Request.Form["txtbegintime"].ToString();
                    this.txtendtime.Text = Request.Form["txtendtime"].ToString();
                    prams[0] = db.MakeInParam("@begintime", SqlDbType.DateTime, 8, this.txtbegintime.Text);
                    prams[1] = db.MakeInParam("@endtime", SqlDbType.DateTime, 8, this.txtendtime.Text);
                    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);
                    dvw = ds.Tables[0].DefaultView;
                    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);
                        dvwAttGrid = ds.Tables[1].DefaultView;
                        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);
                        dvwAttGrid = ds.Tables[1].DefaultView;
                        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);
                        dvwAttGrid = ds.Tables[1].DefaultView;
                        db.Dispose();
                        dr1.Close();
                    }

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

                    AttendanceGrid.DataSource = dvwAttGrid;
                    AttendanceGrid.DataBind();

                    //��������
                    Cache["WA_Duty"] = ds;

                    btn_Report.Attributes["onclick"] = "window.open('Report/DutyReport.aspx?idtype=" + idtype + "&ids=" + ids + "&begintime=" + txtbegintime.Text + "&endtime=" + txtendtime.Text + "')";
                }
                catch (Exception ex)
                {
                    UDS.Components.Error.Log(ex.Message);
                    Server.Transfer("../Error.aspx");
                }

            }
            finally
            {
                if (db != null)
                {
                    db.Close();
                }
                if (dr != null)
                {
                    dr.Close();
                }
                if (dr1 != null)
                {
                    dr1.Close();
                }
                if (dr2 != null)
                {
                    dr2.Close();
                }
            }
        }
Exemple #28
0
        private void InitDataGrid()
        {
            SqlDataReader dr; //������������
            Database mySQL = new Database();
            SqlParameter[] parameters = {
                                            mySQL.MakeInParam("@FlowID",SqlDbType.Int ,4,FlowID),
                                            mySQL.MakeInParam("@StepID",SqlDbType.Int ,4,StepID),
                                            mySQL.MakeInParam("@Priority",SqlDbType.Int ,4,0)
                                        };

            mySQL.RunProc("sp_Flow_GetJump",parameters,out dr);
            try
            {
                DataTable dt = Tools.ConvertDataReaderToDataTable(dr);
                dr.Close();
                dr = null;
                dgJumpList.DataSource = dt.DefaultView;
                dgJumpList.DataBind();
            }
            finally
            {
                if (mySQL != null)
                {
                    mySQL.Close();
                }
                if (dr != null)
                {
                    dr.Close();
                }
            }
        }
Exemple #29
0
        /// <summary>
        /// �ļ��������
        /// </summary>
        /// <param name="DocBody"> �ļ�������</param>
        public string AddDocBody(DocBody docbody)
        {
            // create data object and params
            Database data = new Database();
            string DocID = "";
            SqlParameter[] prams = {
                                       data.MakeInParam("@ClassID",   SqlDbType.Int, 20, docbody.DocClassID),
                                       data.MakeInParam("@DocTitle",  SqlDbType.NVarChar, 300, docbody.DocTitle),
                                       data.MakeInParam("@DocContent",SqlDbType.NText, 8000,docbody.DocContent),
                                       data.MakeInParam("@DocApprover",  SqlDbType.NVarChar,200, docbody.DocApprover),
                                       data.MakeInParam("@DocApproveDate",  SqlDbType.NVarChar, 20, docbody.DocApproveDate),
                                       data.MakeInParam("@DocApproved",  SqlDbType.Int, 1, docbody.DocApproved),
                                       data.MakeInParam("@DocType",  SqlDbType.Int, 2, docbody.DocType),
                                       data.MakeInParam("@DocAttribute",  SqlDbType.Int , 2, docbody.DocAttribute),
                                       data.MakeInParam("@DocAddedBy",  SqlDbType.NVarChar, 300, docbody.DocAddedBy),
                                       data.MakeInParam("@DocAddedDate",  SqlDbType.DateTime, 300,DateTime.Parse(docbody.DocAddedDate)),
                                       data.MakeOutParam("@CurrentDocID",  SqlDbType.Int, 2)
                                   };

            try
            {
                data.RunProc("SP_Ext_AddDocument", prams);
                DocID = prams[10].Value.ToString();
                if (DocID == string.Empty )
                    return null;
                else
                    return DocID;
            }
            catch (Exception ex)
            {
                Error.Log(ex.ToString());
                throw new Exception("�ĵ��������Ӵ���!",ex);
            }
            finally
            {
                if (data != null)
                {
                    data.Close();
                    data.Dispose();
                }

            }
        }
Exemple #30
0
        private void cmdDelete_Click(object sender, System.EventArgs e)
        {
            if(lstCurRole.SelectedIndex>=0)
            {
                Database mySQL = new Database();
                foreach(ListItem li in lstCurRole.Items)
                {
                    if(li.Selected ==true)
                    {
                        SqlParameter[] parameters = {
                                                        mySQL.MakeInParam("@FlowID",SqlDbType.Int ,4,FlowID),
                                                        mySQL.MakeInParam("@StepID",SqlDbType.Int ,4,StepID),
                                                        //mySQL.MakeInParam("@RoleID",SqlDbType.Int ,4,Int32.Parse(lstCurRole.Items[lstCurRole.SelectedIndex].Value)  )
                                                        mySQL.MakeInParam("@RoleID",SqlDbType.Int ,4,Int32.Parse(li.Value)  )
                                                    };

                        mySQL.RunProc("sp_Flow_DeleteBangdingRole",parameters);
                    }
                }
                mySQL.Close();
                mySQL = null;
                //Response.Write("<script language='javascript'>alert('ȡ���󶨳ɹ���');</script>");
                Bangding();
            }
        }
Exemple #31
0
        /// <summary>
        ///��ȡij��Ŀ�е��ĵ� ����DataTable
        /// </summary>
        /// <param name="ClassID">��ĿID</param>
        public DataTable GetClassDocs(int ClassID)
        {
            SqlDataReader dataReader = null;
            Database data = new Database();
            DataTable datatable = new DataTable();
            SqlParameter[] prams =
                                {
                                    data.MakeInParam("@ClassID",	SqlDbType.Int, 20 ,ClassID)
                                 };
            try
            {
                data.RunProc("sp_GetNewDocument", prams, out dataReader);
                datatable = Tools.ConvertDataReaderToDataTable(dataReader);
                dataReader.Close();
                return datatable;
            }

            catch (Exception ex)
            {
                Error.Log(ex.ToString());
                return null;
            }
            finally
            {
                if (data != null)
                {
                    data.Close();
                    data.Dispose();
                }
                if (dataReader != null)
                {
                    dataReader.Close();
                }
            }
        }
Exemple #32
0
        private void cmdAddPositon_Click(object sender, System.EventArgs e)
        {
            if(lstAllPosition.SelectedIndex >=0)
            {
                Database mySQL = new Database();
                foreach(ListItem li in lstAllPosition.Items )
                {
                    if(li.Selected ==true)
                    {
                        SqlParameter[] parameters = {
                                                        mySQL.MakeInParam("@FlowID",SqlDbType.Int ,4,FlowID),
                                                        mySQL.MakeInParam("@StepID",SqlDbType.Int ,4,StepID),
                                                        mySQL.MakeInParam("@PositionID",SqlDbType.Int ,4,Int32.Parse (li.Value)  )
                                                    };

                        mySQL.RunProc("sp_Flow_AddBangdingPosition",parameters);
                    }
                }
                mySQL.Close();
                mySQL = null;
                Bangding();

            }
        }