コード例 #1
0
ファイル: AddWork.aspx.cs プロジェクト: caisimongit/cms-1
    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>");
        }
    }
コード例 #2
0
ファイル: AddWork.aspx.cs プロジェクト: caisimongit/cms-1
 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>");
         }
     }
 }