Beispiel #1
0
 public void ShouldbeAbleToCallUDF()
 {
     using (var db = new SNAPDatabaseDataContext())
     {
        var newDate = db.udf_get_next_business_day(DateTime.Now, 10);
         Assert.IsTrue(newDate != null);
     }
 }
Beispiel #2
0
 public void ShouldOk()
 {
     using(var db = new SNAPDatabaseDataContext())
     {
         DateTime current = DateTime.Parse("3/31/2010 1:00:00 PM");
         for (int i = 1; i < 20; i++)
         {
             Console.WriteLine(db.udf_get_next_business_day(current, i));
         }
     }
 }
Beispiel #3
0
        private static DateTime getDueDate(ActorApprovalType approvalType, WorkflowState fr, WorkflowState to)
        {
            int day = 1;
            DateTime due;
            SLAConfiguration slaCfg = new SLAConfiguration((NameValueCollection)ConfigurationManager.GetSection(
                "Apollo.AIM.SNAP/Workflow.SLA"));

            switch (approvalType)
                {
                    case ActorApprovalType.Manager:
                        day = System.Convert.ToInt16(slaCfg.ManagerApprovalInDays);
                        break;
                    case ActorApprovalType.Team_Approver:
                        day = System.Convert.ToInt16(slaCfg.TeamApprovalInDays);
                        break;
                    case ActorApprovalType.Technical_Approver:
                        day = System.Convert.ToInt16(slaCfg.TechnicalApprovalInDays);
                        break;
                    case ActorApprovalType.Workflow_Admin:
                        if (to == WorkflowState.Workflow_Created) // same as the due day for technical approval since workflow admin depend on it
                            day = System.Convert.ToInt16(slaCfg.TechnicalApprovalInDays);
                        break;
                }

                using (var db = new SNAPDatabaseDataContext())
                {
                    due = db.udf_get_next_business_day(DateTime.Now, day) ?? DateTime.Now.AddDays(-1);
                }

            return due;
        }