Beispiel #1
0
    protected void EBtnSubmit_Click(object sender, EventArgs e)
    {
        int           power        = 0;
        bool          addwork      = false;
        bool          workrole     = false;
        M_ProjectWork mprojectwork = new M_ProjectWork();
        B_ProjectWork bprojecwork  = new B_ProjectWork();
        M_WorkRole    mworkrole    = new M_WorkRole();
        B_WorkRole    bworkrole    = new B_WorkRole();

        if (Request.QueryString["Pid"] != null)
        {
            mprojectwork.WorkName  = TxtWorkName.Text.Trim();
            mprojectwork.WorkIntro = TxtWorkIntro.Text.Trim();
            mprojectwork.ProjectID = DataConverter.CLng(Request.QueryString["pid"].Trim());
            mprojectwork.Approving = 0;//默认值
            mprojectwork.Status    = 0;
            mprojectwork.EndDate   = DataConverter.CDate(txtEndDay.Value.Trim());
            addwork = bprojecwork.AddProjectWork(mprojectwork);
            for (int t = 0; t < this.cblRoleList.Items.Count; t++)
            {
                power = Convert.ToInt32(this.cblRoleList.Items[t].Value);
                if (this.cblRoleList.Items[t].Selected)
                {
                    mworkrole.RoleID = power;
                    mworkrole.WorkID = bprojecwork.GetMaxWorkID(DataConverter.CLng(Request.QueryString["Pid"].Trim()));// GetMaxWorkID(int projectid).ge;
                    workrole         = bworkrole.AddWorkRole(mworkrole);
                }
            }
            if (addwork)//&&&& workrole
            {
                Response.Write("<script language=javascript> alert('内容添加成功!');window.document.location.href='WorkManage.aspx?Pid=" + mprojectwork.ProjectID + "';</script>");
            }
        }
    }
Beispiel #2
0
        public bool AddWorkRole(M_WorkRole m_workrole)
        {
            string sqlStr = "INSERT INTO ZL_WorkRole(WorkID,RoleID) VALUES(@WorkID,@RoleID)";

            SqlParameter[] parameter = new SqlParameter[2];
            parameter[0]       = new SqlParameter("@WorkID", SqlDbType.Int, 4);
            parameter[0].Value = m_workrole.WorkID;
            parameter[1]       = new SqlParameter("@RoleID", SqlDbType.Int, 4);
            parameter[1].Value = m_workrole.RoleID;
            return(SqlHelper.ExecuteSql(sqlStr, parameter));
        }
Beispiel #3
0
        public bool UpdateWorkRole(M_WorkRole m_workrole)
        {
            string sqlStr = "Update ZL_WorkRole set WorkID=@WorkID,RoleID=@RoleID where ID=@ID";

            SqlParameter[] parameter = new SqlParameter[3];
            parameter[0]       = new SqlParameter("@WorkID", SqlDbType.Int, 4);
            parameter[0].Value = m_workrole.WorkID;
            parameter[1]       = new SqlParameter("@RoleID", SqlDbType.Int, 4);
            parameter[1].Value = m_workrole.RoleID;
            parameter[2]       = new SqlParameter("@ID", SqlDbType.Int, 4);
            parameter[2].Value = m_workrole.ID;
            return(SqlHelper.ExecuteSql(sqlStr, parameter));
        }
Beispiel #4
0
    protected void EBtnModify_Click(object sender, EventArgs e)
    {
        B_ProjectWork bprojecwork  = new B_ProjectWork();
        M_ProjectWork mprojectwork = bprojecwork.SelectWorkByWID(DataConverter.CLng(HFWid.Value));// new M_ProjectWork();
        bool          updatework   = false;
        bool          updaterole   = false;
        bool          deleterole   = false;
        B_WorkRole    bworkrole    = new B_WorkRole();
        M_WorkRole    mworkrole    = new M_WorkRole();
        int           power        = 0;

        mprojectwork.WorkName  = TxtWorkName.Text.Trim();
        mprojectwork.WorkIntro = TxtWorkIntro.Text.Trim();
        mprojectwork.EndDate   = DataConverter.CDate(txtEndDay.Value.Trim());
        updatework             = bprojecwork.UpdateProjectWork(mprojectwork);
        for (int t = 0; t < this.cblRoleList.Items.Count; t++) //先删除所有
        {
            if (this.cblRoleList.Items[t].Selected)
            {
                deleterole = bworkrole.DelWorkRole(Convert.ToInt32(mprojectwork.WorkID));
                t          = this.cblRoleList.Items.Count - 1;
            }
        }

        for (int t = 0; t < this.cblRoleList.Items.Count; t++)//再添加
        {
            power = Convert.ToInt32(this.cblRoleList.Items[t].Value);
            if (this.cblRoleList.Items[t].Selected)
            {
                mworkrole.RoleID = power;
                mworkrole.WorkID = bprojecwork.GetMaxWorkID(DataConverter.CLng(mprojectwork.ProjectID));    // GetMaxWorkID(int projectid).ge;
                updaterole       = bworkrole.AddWorkRole(mworkrole);;
            }
        }
        if (updatework)// && deleterole && updaterole
        {
            Response.Write("<script language=javascript> alert('内容修改成功!');window.document.location.href='WorkManage.aspx?Pid=" + mprojectwork.ProjectID + "';</script>");
        }
    }
Beispiel #5
0
 public bool UpdateWorkRole(M_WorkRole m_workrole)
 {
     return(dal.UpdateWorkRole(m_workrole));
 }
Beispiel #6
0
 public bool AddWorkRole(M_WorkRole m_workrole)
 {
     return(dal.AddWorkRole(m_workrole));
 }