コード例 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            app = new ProjectApplication();
            ((Pop)this.Master).Width = 540;
            if (!IsPostBack)
            {
                int id = QS("ID", 0);

                if (id == 0)
                {
                    ShowFailMessageToClient("unauthorized access.");
                    return;
                }
                ProjectPrincipalEntity principalEntity = app.GetProjectPrincipalInfo(id);
                if (principalEntity == null)
                {
                    ShowFailMessageToClient("unauthorized access.");
                    return;
                }
                else
                {
                    this.txtModule.Value = principalEntity.Module;
                    this.txtPM.Value     = principalEntity.PM;
                    this.txtDEV.Value    = principalEntity.DEV;
                    this.txtQA.Value     = principalEntity.QA;
                }
            }
        }
コード例 #2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            int id = QS("ID", 0);

            if (id == 0)
            {
                ShowFailMessageToClient("unauthorized access.");
                return;
            }
            else
            {
                ProjectPrincipalEntity principalEntity = app.GetProjectPrincipalInfo(id);
                if (principalEntity == null)
                {
                    ShowFailMessageToClient("unauthorized access.");
                    return;
                }

                principalEntity.Module = this.txtModule.Value;
                principalEntity.PM     = this.txtPM.Value;
                principalEntity.DEV    = this.txtDEV.Value;
                principalEntity.QA     = this.txtQA.Value;
                if (app.UpdateProjectPrincipal(principalEntity))
                {
                    Redirect(EmptyPopPageUrl, false, true);
                }
                else
                {
                    ShowFailMessageToClient(app.BrokenRuleMessages);
                }
            }
        }
コード例 #3
0
        public bool Update(ProjectPrincipalEntity model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update ProjectPrincipal ");
            strSql.Append(" set Module=@Module ,PM=@PM,DEV=@DEV,QA=@QA ");
            strSql.AppendFormat(" where id = {0}", model.ID);

            Database db = DatabaseFactory.CreateDatabase();

            using (DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString()))
            {
                try
                {
                    db.AddInParameter(dbCommand, "Module", DbType.String, model.Module);
                    db.AddInParameter(dbCommand, "PM", DbType.String, model.PM);
                    db.AddInParameter(dbCommand, "DEV", DbType.String, model.DEV);
                    db.AddInParameter(dbCommand, "QA", DbType.String, model.QA);

                    return(db.ExecuteNonQuery(dbCommand) > 0);
                }
                catch (Exception ex)
                {
                    WebLogAgent.Write(string.Format("[SQLText:{0},{1}Messages:\r\n{2}]", strSql.ToString(), base.FormatParameters(dbCommand.Parameters), ex.Message));
                    return(false);
                }
            }
        }
コード例 #4
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            int id = QS("ID", 0);

            if (id == 0)
            {
                ShowFailMessageToClient("unauthorized access.");
                return;
            }
            else
            {
                ProjectsEntity projectEntity = new ProjectApplication().Get(id);
                if (projectEntity == null)
                {
                    ShowFailMessageToClient("unauthorized access.");
                    return;
                }

                ProjectPrincipalEntity entity = new ProjectPrincipalEntity();
                entity.Module = this.txtModule.Value;
                entity.PM = this.txtPM.Value;
                entity.DEV = this.txtDEV.Value;
                entity.QA = this.txtQA.Value;
                entity.ProjectID = projectEntity.ProjectID;
                if (app.AddPrincipal(entity) > 0)
                {
                    Redirect(EmptyPopPageUrl, false, true);
                }
                else
                {
                    ShowFailMessageToClient(app.BrokenRuleMessages);
                }
            }
        }
コード例 #5
0
        public int Insert(ProjectPrincipalEntity model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into ProjectPrincipal(");
            strSql.Append("ProjectID,Module,PM,DEV,QA)");
            strSql.Append(" values (");
            strSql.Append("@ProjectID,@Module,@PM,@DEV,@QA)");
            strSql.Append(";select ISNULL( SCOPE_IDENTITY(),0);");
            Database db = DatabaseFactory.CreateDatabase();

            using (DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString()))
            {
                try
                {
                    db.AddInParameter(dbCommand, "ProjectID", DbType.Int32, model.ProjectID);
                    db.AddInParameter(dbCommand, "Module", DbType.String, model.Module);
                    db.AddInParameter(dbCommand, "PM", DbType.String, model.PM);
                    db.AddInParameter(dbCommand, "DEV", DbType.String, model.DEV);
                    db.AddInParameter(dbCommand, "QA", DbType.String, model.QA);
                    int    result;
                    object obj = db.ExecuteScalar(dbCommand);
                    if (!int.TryParse(obj.ToString(), out result))
                    {
                        return(0);
                    }
                    return(result);
                }
                catch (Exception ex)
                {
                    WebLogAgent.Write(string.Format("[SQLText:{0},{1}Messages:\r\n{2}]", strSql.ToString(), base.FormatParameters(dbCommand.Parameters), ex.Message));
                    return(0);
                }
            }
        }
コード例 #6
0
        public int AddPrincipal(ProjectPrincipalEntity model)
        {
            this.ClearBrokenRuleMessages();
            int id = mgr.AddPrincipal(model);

            this.AddBrokenRuleMessages(mgr.BrokenRuleMessages);
            return(id);
        }
コード例 #7
0
 public int AddPrincipal(ProjectPrincipalEntity entity)
 {
     if (string.IsNullOrEmpty(entity.Module))
     {
         this.AddBrokenRuleMessage("Module/Function not null", "please input the Module/Function!");
         return(0);
     }
     return(proPriResp.Insert(entity));
 }
コード例 #8
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            ProjectPrincipalEntity entity = new ProjectPrincipalEntity();

            entity.Module    = this.txtModule.Value;
            entity.PM        = this.txtPM.Value;
            entity.DEV       = this.txtDEV.Value;
            entity.QA        = this.txtQA.Value;
            entity.ProjectID = (int)QS("id", 0);
            if (app.AddPrincipal(entity) > 0)
            {
                ShowSuccessMessageToClient();
            }
            else
            {
                ShowFailMessageToClient(app.BrokenRuleMessages);
            }
        }
コード例 #9
0
        public string AddPrincipal(HttpRequest Request, int projectId)
        {
            ProjectPrincipalEntity entity = new ProjectPrincipalEntity();

            entity.Module    = Request.Form["ctl00$ContentPlaceHolder1$txtModule"].Replace("\n", "<br />");
            entity.PM        = Request.Form["ctl00$ContentPlaceHolder1$txtPM"].Replace("\n", "<br />");
            entity.DEV       = Request.Form["ctl00$ContentPlaceHolder1$txtDEV"].Replace("\n", "<br />");
            entity.QA        = Request.Form["ctl00$ContentPlaceHolder1$txtQA"].Replace("\n", "<br />");
            entity.ProjectID = projectId;
            int count = new ProjectApplication().AddPrincipal(entity);

            if (count > 0)
            {
                return("1");
            }
            else
            {
                return("0");
            }
        }
コード例 #10
0
        public List <ProjectPrincipalEntity> GetProjectPrincipal(int projectId)
        {
            List <ProjectPrincipalEntity> list = new List <ProjectPrincipalEntity>();
            StringBuilder sb = new StringBuilder();

            sb.Append("select id,projectid,module,pm,dev,qa from ProjectPrincipal ")
            .AppendFormat(" where ProjectID=@ProjectID ");

            Database db = DatabaseFactory.CreateDatabase();

            using (DbCommand dbCommand = db.GetSqlStringCommand(sb.ToString()))
            {
                db.AddInParameter(dbCommand, "ProjectID", DbType.Int32, projectId);
                using (IDataReader dataReader = db.ExecuteReader(dbCommand))
                {
                    while (dataReader.Read())
                    {
                        list.Add(ProjectPrincipalEntity.ReaderBind(dataReader));
                    }
                }
            }
            return(list);
        }
コード例 #11
0
        public ProjectPrincipalEntity Get(int ID)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("select * from ProjectPrincipal ")
            .AppendFormat(" where ID={0} ", ID);

            Database db = DatabaseFactory.CreateDatabase();

            using (DbCommand dbCommand = db.GetSqlStringCommand(sb.ToString()))
            {
                using (IDataReader dataReader = db.ExecuteReader(dbCommand))
                {
                    if (dataReader.Read())
                    {
                        return(ProjectPrincipalEntity.ReaderBind(dataReader));
                    }
                    else
                    {
                        return(null);
                    }
                }
            }
        }
コード例 #12
0
 public bool UpdateProjectPrincipal(ProjectPrincipalEntity entity)
 {
     return(mgr.UpdateProjectPrincipal(entity));
 }
コード例 #13
0
 public bool UpdateProjectPrincipal(ProjectPrincipalEntity entity)
 {
     return(proPriResp.Update(entity));
 }