Ejemplo n.º 1
0
 public static IBaseQueryData GetDeleteBillInstancesByIDQuery(long billID)
 {
     IBaseQueryData query = new DeleteQueryData();
     query.TableName = "BillInstance";
     query.KeyFields.Add(new FieldData { FieldName = "BillID", FieldValue = billID.ToString(), FieldType = SqlDbType.BigInt });
     return query;
 }
Ejemplo n.º 2
0
 public static IBaseQueryData GetDeleteScheduleByIDQuery(long scheduleID)
 {
     IBaseQueryData query = new DeleteQueryData();
     query.TableName = "Schedules";
     query.KeyFields.Add(new FieldData { FieldName = "ScheduleID", FieldValue = scheduleID.ToString(), FieldType = SqlDbType.BigInt });
     return query;
 }
Ejemplo n.º 3
0
 public static bool DeleteScheduleByID(long scheduleID)
 {
     IBaseQueryData query = new DeleteQueryData();
     query.TableName = "Schedules";
     query.KeyFields.Add(new FieldData { FieldName = "ScheduleID", FieldValue = scheduleID.ToString(), FieldType = SqlDbType.BigInt });
     return SQLWrapper.ExecuteQuery(query);
 }
Ejemplo n.º 4
0
        public static bool DeleteBiller(int billerID)
        {
            bool returnValue = true;

            List<IBaseQueryData> queryData = DALBill.GetDeleteBillQuerysByBiller(billerID);

            IBaseQueryData query = new DeleteQueryData();
            query.TableName = "Biller";
            query.KeyFields.Add(new FieldData { FieldName = "BillerID", FieldValue = billerID.ToString(), FieldType = SqlDbType.BigInt });
            queryData.Add(query);

            returnValue = SQLWrapper.ExecuteQuery(queryData);

            return returnValue;
        }
Ejemplo n.º 5
0
 public static List<IBaseQueryData> GetDeleteBillQuerysByBillID(long billID)
 {
     List<IBaseQueryData> queryData = new List<IBaseQueryData>();
     BillItem olditm = GetBillByID(billID);
     if (olditm != null)
     {
         if (olditm.BillSchedule != null)
         {
             queryData.Add(DALSchedule.GetDeleteScheduleByIDQuery(olditm.BillSchedule.ScheduleID));
         }
     }
     queryData.Add(DALBillInstance.GetDeleteBillInstancesByIDQuery(billID));
     IBaseQueryData query = new DeleteQueryData();
     query.TableName = "Bill";
     query.KeyFields.Add(new FieldData { FieldName = "BillID", FieldValue = billID.ToString(), FieldType = SqlDbType.BigInt });
     queryData.Add(query);
     return queryData;
 }
Ejemplo n.º 6
0
        public static List<IBaseQueryData> GetUpsertBillInstanceQueryData(long billID, List<BillInstanceItem> itms)
        {
            long billInstanceID = getNextBillInstanceID();
            List<BillInstanceItem> oldInstances = GetBillInstancesByID(billID);
            List<IBaseQueryData> queryData = new List<IBaseQueryData>();

            IBaseQueryData query = new DeleteQueryData();
            query.TableName = "BillInstance";
            query.KeyFields.Add(new FieldData { FieldName = "BillID", FieldValue = billID.ToString(), FieldType = SqlDbType.BigInt });

            queryData.Add(query);

            for (int i = 0; i <= itms.Count - 1; i++)
            {
                query = new InsertQueryData();
                query.TableName = "BillInstance";
                query.Fields.Add(new FieldData { FieldName = "BillInstanceID", FieldValue = billInstanceID.ToString(), FieldType = SqlDbType.BigInt });
                query.Fields.Add(new FieldData { FieldName = "BillID", FieldValue = billID.ToString(), FieldType = SqlDbType.BigInt });
                query.Fields.Add(new FieldData { FieldName = "InstanceDate", FieldValue = itms[i].InstanceDate.ToString(Constants.DATE_FORMAT_SQL), FieldType = SqlDbType.Date });
                bool isCompleted = false;
                if (itms != null)
                {
                    if (itms[i] != null)
                    {
                        isCompleted = itms[i].IsCompleted;
                    }
                }
                BillInstanceItem tmpItem = oldInstances.FindAll(x => x.BillID == billID && x.InstanceDate == itms[i].InstanceDate).FirstOrDefault();
                if (tmpItem != null)
                {
                    isCompleted = tmpItem.IsCompleted;
                }
                query.Fields.Add(new FieldData { FieldName = "InstanceCompleted", FieldValue = isCompleted.ToString(), FieldType = SqlDbType.Bit });
                queryData.Add(query);
                billInstanceID++;
            }
            return queryData;
        }