Exemple #1
0
        public static bool AddValue(Value value)
        {
            bool returnValue = false;

            int ValueID = getNextValueID();

            List<IBaseQueryData> queryDatum = new List<IBaseQueryData>();

            IBaseQueryData queryData = new InsertQueryData();
            queryData.TableName = "PLN_Values";
            queryData.Fields.Add(new FieldData { FieldName = "ValueID", FieldType = SqlDbType.Int, FieldValue = ValueID.ToString() });
            queryData.Fields.Add(new FieldData { FieldName = "ValueTitle", FieldType = SqlDbType.NVarChar, FieldValue = value.ValueTitle.Trim() });
            queryData.Fields.Add(new FieldData { FieldName = "ValueNotes", FieldType = SqlDbType.NVarChar, FieldValue = value.ValueNotes.Trim() });
            queryData.Fields.Add(new FieldData { FieldName = "UserId", FieldType = SqlDbType.Int, FieldValue = value.ForUser.UserID.ToString() });
            queryData.Fields.Add(new FieldData { FieldName = "Sequence", FieldType = SqlDbType.Int, FieldValue = getNextSequenceID(value.ForUser.UserID).ToString() });
            queryDatum.Add(queryData);

            if (value.Categories != null)
            {
                for (int i = 0; i <= value.Categories.Count - 1; i++)
                {
                    queryData = new InsertQueryData();

                    queryData.TableName = "PLN_ValueCategories";
                    queryData.Fields.Add(new FieldData { FieldName = "ValueID", FieldType = SqlDbType.Int, FieldValue = ValueID.ToString() });
                    queryData.Fields.Add(new FieldData { FieldName = "CategoryID", FieldType = SqlDbType.Int, FieldValue = value.Categories[i].CategoryID.ToString() });
                    queryData.Fields.Add(new FieldData { FieldName = "Sequence", FieldType = SqlDbType.Int, FieldValue = (i + 1).ToString() });
                    queryDatum.Add(queryData);
                }

            }
            returnValue = SQLWrapper.ExecuteQuery(queryDatum);

            return returnValue;
        }
Exemple #2
0
        public static bool DeleteValue(Value value)
        {
            bool returnValue = false;

            List<IBaseQueryData> queryDatum = new List<IBaseQueryData>();

            DeleteQueryData queryData = new DeleteQueryData();
            queryData.TableName = "PLN_ValueCategories";
            queryData.KeyFields.Add(new FieldData { FieldName = "ValueID", FieldType = SqlDbType.Int, FieldValue = value.ValueID.ToString() });
            queryDatum.Add(queryData);

            queryData = new DeleteQueryData();
            queryData.TableName = "PLN_Values";
            queryData.KeyFields.Add(new FieldData { FieldName = "ValueID", FieldType = SqlDbType.Int, FieldValue = value.ValueID.ToString() });
            queryDatum.Add(queryData);

            returnValue = SQLWrapper.ExecuteQuery(queryDatum);

            return returnValue;
        }
Exemple #3
0
 public static bool UpdateValue(Value value)
 {
     return MyPlanner.DAL.DALValue.UpdateValue(value);
 }
Exemple #4
0
 public static bool AddValue(Value value)
 {
     return MyPlanner.DAL.DALValue.AddValue(value);
 }
Exemple #5
0
 public static bool DeleteValue(int ValueID)
 {
     Value value = new Value();
     value.ValueID = ValueID;
     return DeleteValue(value);
 }
Exemple #6
0
 private static Value loadValue(DataTable dtValues, int RowNo)
 {
     Value value = new Value();
     value.ValueID = Convert.ToInt32(dtValues.Rows[RowNo]["ValueID"]);
     value.ValueTitle = dtValues.Rows[RowNo]["ValueTitle"].ToString();
     value.ValueNotes = dtValues.Rows[RowNo]["ValueNotes"].ToString();
     value.Sequence = Convert.ToInt32(dtValues.Rows[RowNo]["Sequence"]);
     value.Categories = loadValueCategories(value.ValueID);
     value.ForUser = DALAppUser.GetUserByID(Convert.ToInt32(dtValues.Rows[RowNo]["UserID"]));
     return value;
 }