Пример #1
0
        public static PMProject GetItemByID(String projectCD, int CompanyID)
        {
            PMProject item      = new PMProject();
            var       sqlParams = new SqlParameter[2];

            sqlParams[0] = new SqlParameter("@ProjectCD", projectCD);
            sqlParams[1] = new SqlParameter("@CompanyID", CompanyID);
            using (var reader = SqlHelper.ExecuteReader("PMProject_GetByID", sqlParams))
            {
                while (reader.Read())
                {
                    item = GetItemFromReader(reader);
                }
            }
            return(item);
        }
Пример #2
0
        public static PMProject UpdateItem(PMProject model)
        {
            String result = String.Empty;

            try
            {
                using (var reader = SqlHelper.ExecuteReader(CommandType.StoredProcedure, "PMProject_Update", CreateSqlParameter(model)))
                {
                    while (reader.Read())
                    {
                        result = (String)reader[0];
                    }
                }
            }catch (Exception Objecx)
            {
            }
            return(GetItemByID(model.ProjectCD, model.CompanyID));
        }
Пример #3
0
        public static PMProjectCollection GetAllItem(int CompanyID)
        {
            PMProjectCollection collection = new PMProjectCollection();
            var sqlParams = new SqlParameter[]
            {
                new SqlParameter("@CompanyID", CompanyID),
            };

            using (var reader = SqlHelper.ExecuteReader("PMProject_GetAll", sqlParams))
            {
                while (reader.Read())
                {
                    PMProject obj = new PMProject();
                    obj = GetItemFromReader(reader);
                    collection.Add(obj);
                }
            }
            return(collection);
        }
Пример #4
0
 private static SqlParameter[] CreateSqlParameter(PMProject model)
 {
     return(new SqlParameter[]
     {
         new SqlParameter("@ProjectCD", model.ProjectCD),
         new SqlParameter("@CompanyID", model.CompanyID),
         new SqlParameter("@Status", model.Status),
         new SqlParameter("@Description", model.Description),
         new SqlParameter("@StartDate", model.StartDate),
         new SqlParameter("@ActivationDate", model.ActivationDate),
         new SqlParameter("@ExpireDate", model.ExpireDate),
         new SqlParameter("@CalendarID", model.CalendarID),
         new SqlParameter("@Duration", model.Duration),
         new SqlParameter("@DurationType", model.DurationType),
         new SqlParameter("@CreatedUser", model.CreatedUser),
         new SqlParameter("@CreatedDate", model.CreatedDate),
         new SqlParameter("@CreatedByScreenID", model.CreatedByScreenID),
         new SqlParameter("@OverTimeItemID", model.OverTimeItemID),
         new SqlParameter("@LocationID", model.LocationID),
         new SqlParameter("@IsContinuous", model.IsContinuous),
         new SqlParameter("@Approved", model.Approved),
         new SqlParameter("@Rejected", model.Rejected),
         new SqlParameter("@isActive", model.isActive),
         new SqlParameter("@isCompleted", model.isCompleted),
         new SqlParameter("@isCancelled", model.isCancelled),
         new SqlParameter("@OwnerID", model.OwnerID),
         new SqlParameter("@EffectiveFrom", model.EffectiveFrom),
         new SqlParameter("@CuryID", model.CuryID),
         new SqlParameter("@RateTypeID", model.RateTypeID),
         new SqlParameter("@AutoRenew", model.AutoRenew),
         new SqlParameter("@CustomerID", model.CustomerID),
         new SqlParameter("@CompletePercent", model.CompletePercent),
         new SqlParameter("@CompletedDate", model.CompletedDate),
         new SqlParameter("@ImgUrl", model.ImgUrl),
     });
 }
Пример #5
0
        private static PMProject GetItemFromReader(IDataReader dataReader)
        {
            PMProject objItem = new PMProject();

            objItem.ProjectCD = SqlHelper.GetString(dataReader, "ProjectCD");

            objItem.CompanyID = SqlHelper.GetInt(dataReader, "CompanyID");

            objItem.Status = SqlHelper.GetString(dataReader, "Status");

            objItem.Description = SqlHelper.GetString(dataReader, "Description");

            objItem.StartDate = SqlHelper.GetDateTime(dataReader, "StartDate");

            objItem.ActivationDate = SqlHelper.GetDateTime(dataReader, "ActivationDate");

            objItem.ExpireDate = SqlHelper.GetDateTime(dataReader, "ExpireDate");

            objItem.CalendarID = SqlHelper.GetInt(dataReader, "CalendarID");

            objItem.Duration = SqlHelper.GetInt(dataReader, "Duration");

            objItem.DurationType = SqlHelper.GetString(dataReader, "DurationType");

            objItem.CreatedUser = SqlHelper.GetString(dataReader, "CreatedUser");

            objItem.CreatedDate = SqlHelper.GetDateTime(dataReader, "CreatedDate");

            objItem.CreatedByScreenID = SqlHelper.GetString(dataReader, "CreatedByScreenID");

            objItem.OverTimeItemID = SqlHelper.GetInt(dataReader, "OverTimeItemID");

            objItem.LocationID = SqlHelper.GetInt(dataReader, "LocationID");

            objItem.IsContinuous = SqlHelper.GetBoolean(dataReader, "IsContinuous");

            objItem.Approved = SqlHelper.GetBoolean(dataReader, "Approved");

            objItem.Rejected = SqlHelper.GetBoolean(dataReader, "Rejected");

            objItem.isActive = SqlHelper.GetBoolean(dataReader, "isActive");

            objItem.isCompleted = SqlHelper.GetBoolean(dataReader, "isCompleted");

            objItem.isCancelled = SqlHelper.GetBoolean(dataReader, "isCancelled");

            objItem.OwnerID = SqlHelper.GetString(dataReader, "OwnerID");

            objItem.EffectiveFrom = SqlHelper.GetDateTime(dataReader, "EffectiveFrom");

            objItem.CuryID = SqlHelper.GetString(dataReader, "CuryID");

            objItem.RateTypeID = SqlHelper.GetString(dataReader, "RateTypeID");

            objItem.AutoRenew = SqlHelper.GetBoolean(dataReader, "AutoRenew");

            objItem.CustomerID = SqlHelper.GetInt(dataReader, "CustomerID");

            objItem.CompletePercent = SqlHelper.GetInt(dataReader, "CompletePercent");

            objItem.CompletedDate = SqlHelper.GetDateTime(dataReader, "CompletedDate");
            objItem.ImgUrl        = SqlHelper.GetString(dataReader, "ImgUrl");

            return(objItem);
        }