private static void InsertTypeInterval(ServiceReference1.MainClient a,ServiceReference2.StaticClient b, User usr) { var cat = b.GetAllCategories(usr.UserId); var typeTransReason = b.GetAllTypeTransactionReasons(usr.UserId); var typeIntervals = b.GetAllTypeIntervals(usr.UserId); var recurrenceRules = b.GetAllRecurrenceRules(); var typeTransactions = b.GetAllTypeTransactions(usr.UserId); var catList = new CategoryList(); cat.ForEach(x => catList.Add(x)); var typeTransReasonList = new TypeTransactionReasonList(); typeTransReason.ForEach(x => typeTransReasonList.Add(x)); var typeTransactionsList = new TypeTransactionList(); typeTransactions.ForEach(x => typeTransactionsList.Add(x)); // INSERT // var intervals = new TypeIntervalList { new TypeInterval(catList, typeTransReasonList, typeTransactionsList, usr) }; //intervals[0].RecurrenceRule = staticData.RecurrenceRules.FirstOrDefault(x => x.Name == "RuleDailyEveryDays"); var found = recurrenceRules.FirstOrDefault(x => x.Name == "RuleDailyEveryDays"); intervals[0].RecurrenceRuleValue.RecurrenceRule = found; intervals[0].RecurrenceRuleValue.RulePartValueList[0].Value = "aaa"; intervals[0].RecurrenceRuleValue.RulePartValueList[1].Value = "bbb"; intervals[0].RecurrenceRangeRuleValue.RecurrenceRule = recurrenceRules.FirstOrDefault(x => x.Name == Const.Rule.RuleRangeTotalOcurrences.ToString()); intervals[0].RecurrenceRangeRuleValue.RulePartValueList[0].Value = "20111111"; intervals[0].RecurrenceRangeRuleValue.RulePartValueList[1].Value = "234"; var result = b.SaveTypeIntervals(intervals.ToList()); }
private static void UpdateTypeInterval(ServiceReference1.MainClient a, ServiceReference2.StaticClient b, User usr) { var cat = b.GetAllCategories(usr.UserId); var typeIntervals = b.GetAllTypeIntervals(usr.UserId); var recurrenceRules = b.GetAllRecurrenceRules(); var typeTransactions = b.GetAllTypeTransactions(usr.UserId); // UPDATE // typeIntervals[0].Amount = 19d; typeIntervals[0].TransactionType = typeTransactions[1]; typeIntervals[0].RecurrenceRuleValue.RulePartValueList[0].Value = "9123"; typeIntervals[0].ModifiedDate = DateTime.Now; //staticData.TypeIntervals[1].ModifiedDate = DateTime.Now; typeIntervals[0].RecurrenceRangeRuleValue.RecurrenceRule = recurrenceRules.FirstOrDefault(x => x.Name == Const.Rule.RuleRangeTotalOcurrences.ToString()); typeIntervals[0].RecurrenceRangeRuleValue.RulePartValueList[0].Value = "20100202"; typeIntervals[0].RecurrenceRangeRuleValue.RulePartValueList[1].Value = "3"; //staticData.TypeIntervals[0].RecurrenceRangeRuleValue.RulePartValueList[1].Value = "b22"; //staticData.TypeIntervals[0].RecurrenceRangeRuleValue.RulePartValueList[1].Value = "c22"; var k = new List<TypeInterval>(); k.Add(typeIntervals[0]); var update = b.SaveTypeIntervals(k); }