Пример #1
0
        public Int32 UpdateProjectClassInfo(ProjectClassInfo projectClassInfo)
        {
            String sql    = ORMapping.GetUpdateSql(projectClassInfo, BuilderEx.TSqlBuilderInstance);
            int    result = _DataHelper.ExecuteSql(sql);

            return(result);
        }
Пример #2
0
        public List <ProjectClassInfo> GetProjectClassInfoList(WhereSqlClauseBuilder builder)
        {
            String    sql = String.Format("SELECT * FROM {0} WHERE {1} ORDER BY PROJECT_CLASS_ID", ProjectClassInfoDBConst.TableName, builder.ToSqlString());
            DataTable dt  = _DataHelper.GetDataTable(sql);
            List <ProjectClassInfo> result = new List <ProjectClassInfo>();

            for (Int32 i = 0; i < dt.Rows.Count; i++)
            {
                ProjectClassInfo info = new ProjectClassInfo();
                ORMapping.DataRowToObject(dt.Rows[i], info);
                result.Add(info);
            }
            return(result);
        }
 private ProjectClassInfo GetInfoFromPageControl()
 {
     ProjectClassInfo info = null;
     switch (action)
     {
         case ActionType.Add:
             info = new ProjectClassInfo();
             info.ProjectClassID = this.tbProjectClassCode.Text;
             break;
         case ActionType.Edit:
             info = ProjectClassInfoAdapter.Instance.LoadProjectClassInfo(projectClassId);
             //info.ProjectClassId = this.tbProjectClassCode.Text;//CZ
             break;
     }
     info.ProjectClassName = this.tbProjectClassName.Text.Trim();
     if (this.ddlProjectClass.SelectedIndex > 0)
     {
         info.ParentClassID = this.ddlProjectClass.SelectedValue;
         String nm = this.ddlProjectClass.SelectedItem.Text.Replace(" ", "").Trim();
         info.ParentClassName = nm.StartsWith("-") ? nm.Substring(1).Trim() : nm;
     }
     return info;
 }
Пример #4
0
        public Boolean IsProjectClassIDUsed(ProjectClassInfo projectClassInfo, Boolean isAdd)
        {
            WhereSqlClauseBuilder builder = new WhereSqlClauseBuilder();

            builder.AppendItem(ProjectClassInfoDBConst.ProjectClassID, projectClassInfo.ProjectClassID);
            ProjectClassInfo info = GetProjectClassInfoList(builder).FirstOrDefault();

            if (info == null)
            {
                return(false);
            }
            else
            {
                if (isAdd)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
 public Int32 InsertProjectClassInfo(ProjectClassInfo projectClassInfo)
 {
     String sql = ORMapping.GetInsertSql(projectClassInfo, BuilderEx.TSqlBuilderInstance);
     int result = _DataHelper.ExecuteSql(sql);
     return result;
 }
 public List<ProjectClassInfo> GetProjectClassInfoList(WhereSqlClauseBuilder builder)
 {
     String sql = String.Format("SELECT * FROM {0} WHERE {1} ORDER BY PROJECT_CLASS_ID", ProjectClassInfoDBConst.TableName, builder.ToSqlString());
     DataTable dt = _DataHelper.GetDataTable(sql);
     List<ProjectClassInfo> result = new List<ProjectClassInfo>();
     for (Int32 i = 0; i < dt.Rows.Count; i++)
     {
         ProjectClassInfo info = new ProjectClassInfo();
         ORMapping.DataRowToObject(dt.Rows[i], info);
         result.Add(info);
     }
     return result;
 }
 public Boolean IsProjectClassNameUsed(ProjectClassInfo projectClassInfo, Boolean isAdd)
 {
     WhereSqlClauseBuilder builder = new WhereSqlClauseBuilder();
     builder.AppendItem(ProjectClassInfoDBConst.ProjectClassName, projectClassInfo.ProjectClassName);
     ProjectClassInfo info = GetProjectClassInfoList(builder).FirstOrDefault();
     if (info == null)
     {
         return false;
     }
     else
     {
         if (isAdd)
         {
             return true;
         }
         else
         {
             return info.ProjectClassID.Equals(projectClassInfo.ProjectClassID) ? false : true;
         }
     }
 }