Ejemplo n.º 1
0
 private void HistoryPanel_DeleteEvent(TaskRow taskRow)
 {
     Client.Send(JsonConvert.SerializeObject(new JObject
     {
         ["route"] = "history-delete",
         ["id"]    = taskRow.HistoryID.ToString()
     }));
 }
 public static Task ToModel(this TaskRow task)
 {
     return(new Task
     {
         TaskId = task.TaskId,
         ListId = task.ListId,
         DueDate = task.DueDate,
         IsComplete = task.IsComplete,
         StartDate = task.StartDate,
         Subject = task.Subject,
     });
 }
Ejemplo n.º 3
0
        private void HistoryPanel_RestoreEvent(TaskRow taskRow)
        {
            NoahTask noahTask = TaskList.Find(task => Equals(task.ID, taskRow.TaskID));

            if (noahTask == null)
            {
                return;
            }

            string[][] taskTable = JsonConvert.DeserializeObject <string[][]>(taskRow.Table);

            List <string> alphaTable = new List <string>();

            int cha = 65;
            int Z   = 90;

            while (cha <= Z)
            {
                alphaTable.Add(((char)cha).ToString());
                ++cha;
            }

            List <TaskData> taskDatas = new List <TaskData>();

            for (int i = 0; i < taskTable.GetLength(0); i++)
            {
                for (int j = 0; j < taskTable[i].Length; j++)
                {
                    string dataID = "@" + alphaTable[j] + i;
                    string value  = taskTable[i][j];
                    if (string.IsNullOrEmpty(value))
                    {
                        continue;
                    }
                    taskDatas.Add(new TaskData
                    {
                        dataID = dataID,
                        name   = dataID,
                        ID     = noahTask.ID,
                        table  = taskRow.Table,
                        value  = value
                    });
                }
            }

            taskRow.TaskDatas.ForEach(data => taskDatas.Add(data));

            noahTask.dataList  = taskDatas;
            noahTask.dataTable = taskRow.Table;

            TaskRunner(noahTask, true);
        }
Ejemplo n.º 4
0
 private void HistoryPanel_StoreEvent(TaskRow taskRow)
 {
     Client.Send(JsonConvert.SerializeObject(new JObject
     {
         ["route"]     = "history-store",
         ["id"]        = taskRow.HistoryID.ToString(),
         ["task"]      = taskRow.TaskID.ToString(),
         ["title"]     = taskRow.title,
         ["memo"]      = taskRow.memo,
         ["table"]     = taskRow.Table,
         ["taskData"]  = JsonConvert.SerializeObject(taskRow.TaskDatas),
         ["thumbnail"] = taskRow.thumbnail.ToByteArray(ImageFormat.Png),
         ["img"]       = taskRow.BigBitmap.ToByteArray(ImageFormat.Png)
     }));
 }
Ejemplo n.º 5
0
            public TaskRow AddTaskRow(string Name, string Execute, string Args, string StdOut, string StdErr, uint KillAfter)
            {
                TaskRow rowTaskRow = ((TaskRow)(this.NewRow()));

                rowTaskRow.ItemArray = new object[] {
                    Name,
                    Execute,
                    Args,
                    StdOut,
                    StdErr,
                    KillAfter,
                    null
                };
                this.Rows.Add(rowTaskRow);
                return(rowTaskRow);
            }
Ejemplo n.º 6
0
        private void OnReloadButtonClick(object sender, RoutedEventArgs e)
        {
            var latestTaskRows = new List <TaskRow>();

            using (var db = new TimeLoggerContext()) {
                foreach (var task in db.Tasks.Where(t => t.IsEnabled).OrderBy(t => t.TaskCode))
                {
                    var row = new TaskRow(task);
                    row.OnTaskStart += onTaskStart;
                    row.OnTaskStop  += onTaskStop;
                    latestTaskRows.Add(row);
                }
            }
            TaskList.Children.Clear();
            latestTaskRows.ForEach(r => TaskList.Children.Add(r));
        }
    private void StateToReady()
    {
        TaskRow topRow = TopRow;

        BotRow.transform.Translate(0, 2, 0);
        TopRow      = BotRow;
        BotRow      = topRow;
        TimeLeft    = TimePerTask;
        ActiveTasks = BotRow.GetTasks();
        State       = READY;
        TopRow.SetTasks(RollNewTasks());
        for (int i = 0; i < 4; i++)
        {
            Task t = ActiveTasks[i];
            playerManager.PlayerGOs[t.Player.Id].GetComponentInChildren <GrindPlayerCtrl>().ShowAction(t.Name);
        }
    }
Ejemplo n.º 8
0
        private static TaskRowArray GetHierRows()
        {
            //build rows
            Dictionary <string, string> top1 = new Dictionary <string, string>();

            top1.Add("a", "21");
            top1.Add("b", "22");
            Dictionary <string, string> child11 = new Dictionary <string, string>();

            child11.Add("batch", "ED10-1:1");
            child11.Add("conc", "10");
            Dictionary <string, string> child12 = new Dictionary <string, string>();

            child12.Add("batch", "ED10-1:1");
            child12.Add("conc", "20");
            Dictionary <string, string> child13 = new Dictionary <string, string>();

            child13.Add("batch", "ED10-1:1");
            child13.Add("conc", "20");
            TaskRow row_top1 = new TaskRow(
                "top.1",
                null,
                top1
                );
            TaskRow row_child11 = new TaskRow(
                "well.1.1",
                null,
                child11
                );
            TaskRow row_child12 = new TaskRow(
                "well.1.2",
                null,
                child12
                );
            TaskRow row_child13 = new TaskRow(
                "well.1.3",
                null,
                child13
                );

            TaskRowArray rows = new TaskRowArray {
                row_top1, row_child11, row_child12, row_child13
            };

            return(rows);
        }
Ejemplo n.º 9
0
        private static TaskRowArray GetFlatRows()
        {
            //build rows
            Dictionary <string, string> vals = new Dictionary <string, string>();

            vals.Add("batch", "ED10-1:1");
            vals.Add("conc", "10 mM");
            TaskRow row = new TaskRow(Label: "top.1",
                                      Parent: null,
                                      Values: vals
                                      );
            TaskRowArray rows = new TaskRowArray {
                row
            };

            return(rows);
        }
Ejemplo n.º 10
0
 public void ThenTheTaskWillAppearAsCompleted(TaskRow taskRow) => Assert.IsTrue(taskRow.IsCompleted);
Ejemplo n.º 11
0
 public void RemoveTaskRow(TaskRow row)
 {
     this.Rows.Remove(row);
 }
Ejemplo n.º 12
0
 public void AddTaskRow(TaskRow row)
 {
     this.Rows.Add(row);
 }
Ejemplo n.º 13
0
 public TaskRowChangeEvent(TaskRow row, DataRowAction action)
 {
     this.eventRow = row;
     this.eventAction = action;
 }
Ejemplo n.º 14
0
 public void AddTaskRow(TaskRow row)
 {
     this.Rows.Add(row);
 }
        public RedirectToRouteResult NewTaskFromCart(string TaskDeliveryCustomerAddress, string TaskDeliveryCustomerPhone, string TaskDeliveryCustomerName, string TaskPaymentMethod, string CustomerComment, DateTime?TaskDeliveryTime)
        {
            //TaskDeliveryDateTime
            //IEnumerable<Tasks> Tasks = db.TasksDbSet;
            Task task = new Task();
            Cart cart = new Cart();

            //Contact contact = new Contact();
            //Customer customer = new Customer();
            //int i = 0; // индикатор использования пользователем контакта
            if ((Cart)Session["cart"] != null)
            {
                cart = (Cart)Session["cart"];
            }
            var      hiscontacts = db.Customers.Where(e => e.CustomerEmail == User.Identity.Name).Include(e => e.Contacts);
            Customer mycustomer  = hiscontacts.First(e => e.CustomerEmail == User.Identity.Name);
            Contact  mycontact   = db.Contacts.FirstOrDefault(e => e.ContactAddress == TaskDeliveryCustomerAddress);
            DateTime comparetime = DateTime.Now.AddHours(1);

            if (TaskDeliveryTime == null)
            {
                TaskDeliveryTime = comparetime;
            }
            else if (TaskDeliveryTime.Value.Hour < 6 && DateTime.Now.Hour > 19)
            {
                TaskDeliveryTime = TaskDeliveryTime.Value.AddDays(1);
            }
            else if (TaskDeliveryTime < comparetime)
            {
                TaskDeliveryTime = comparetime;
            }

            if (mycontact == null) //если такого контакта не существует то добавляем со связью с текущим пользователем
            {
                //    i = 2;
                mycontact = new Contact {
                    ContactAddress = TaskDeliveryCustomerAddress, ContactDateLatestOrder = TaskDeliveryTime.Value, Customers = new List <Customer>()
                    {
                        mycustomer
                    }
                };
                db.Contacts.Add(mycontact);
                db.SaveChanges();
            }
            else if (!(mycustomer.Contacts.Contains(mycontact)))
            {
                mycontact.Customers = new List <Customer> {
                    mycustomer
                };
                mycontact.ContactDateLatestOrder = TaskDeliveryTime.Value;
                db.Entry(mycontact).State        = EntityState.Modified;
                db.SaveChanges();
            }
            else
            {
                mycontact.ContactDateLatestOrder = TaskDeliveryTime.Value;
                db.Entry(mycontact).State        = EntityState.Modified;
                db.SaveChanges();
            }
            ////if (mycustomer == null) // это блок для незалогиненых пользователей, вдруг решим вернуть
            ////{
            ////    if (i == 2) //нет контакта есть клиент
            ////    {
            ////        i = 3; //нет ни того ни другого
            ////    }
            ////    else
            ////    {
            ////        i = 1; //есть контакт нет клиента
            ////    }
            ////    mycustomer = new Customer { CustomerFirstName = TaskDeliveryCustomerName, CustomerPhone = TaskDeliveryCustomerPhone, CustomerBirthDate = DateTime.Now, Contacts = new List<Contact>() { mycontact } };
            ////    db.Customers.Add(mycustomer); //Пока всегда добавляем нового касмомера с неполными данными (как хотели), потом когда будет готова авторизация надо пересмотреть чтобы брал текущего
            ////}

            task.Contact   = mycontact;
            task.ContactId = mycontact.ContactId;
            double sum = 0;

            task.TaskStatus = Status.processed.ToString();
            db.StatusHistories.Add(new StatusHistory {
                StatusChangeTime = DateTime.Now, StatusChangedTo = Status.processed.ToString(), ForTask = task, DominosUser = mycustomer
            });
            task.TaskDate      = TaskDeliveryTime.Value;
            task.TaskPayMethod = Convert.ToInt32(TaskPaymentMethod);
            foreach (var m in cart.cartlist)
            {
                var      mydish   = db.Products.FirstOrDefault(k => k.ProductId == m.Key);
                DateTime birthday = mycustomer.CustomerBirthDate;
                DateTime date     = DateTime.Now;
                //int k = 0;
                if (birthday.Day == date.Day && birthday.Month == date.Month && m.Key == 7 && m.Value == 1 && cart.Counter == 1)
                {
                    sum = mydish.ProductPrice * m.Value * 0.7;
                }
                else if (birthday.Day == date.Day && birthday.Month == date.Month && m.Key != 7 && m.Value == 1 && cart.Counter == 1)
                {
                    sum = mydish.ProductPrice * m.Value * 0.85;
                }
                else if (date.DayOfWeek != DayOfWeek.Saturday && date.DayOfWeek != DayOfWeek.Sunday && date.Hour > 11 && date.Hour < 16)
                {
                    sum = mydish.ProductPrice * m.Value * 0.9 + sum;
                }
                else if ((date.DayOfWeek == DayOfWeek.Saturday || date.DayOfWeek == DayOfWeek.Sunday) && (m.Value == 2 || cart.Counter == 2))
                {
                    sum = mydish.ProductPrice * m.Value * 0.85 + sum;
                }
                else
                {
                    sum = mydish.ProductPrice * m.Value + sum;
                }
            }
            task.TaskTotalSum        = sum;
            task.TaskCustomerComment = CustomerComment;
            task.Customers           = new List <Customer>()
            {
                mycustomer
            };
            task.CustomerId = mycustomer.CustomerId;
            db.Tasks.Add(task);
            db.SaveChanges();
            IEnumerable <Task> tasks = db.Tasks;
            var tid = tasks.Last().TaskId;

            foreach (KeyValuePair <int, int> keyValue in cart.cartlist)
            {
                TaskRow productList = new TaskRow();
                productList.TaskId    = tid;
                productList.ProductId = keyValue.Key;
                productList.Quantity  = keyValue.Value;
                db.TaskRows.Add(productList);
            }
            db.SaveChanges();

            Session["orderSuccess"] = true; //надо сделать проверку добавления заказа

            if (Convert.ToInt32(TaskPaymentMethod) != 1)
            {
                //заказ отправлен менеджеру
                Session["cart"] = null;
                return(RedirectToRoute(new { controller = "Home", action = "SuccessOrder" }));
            }
            else
            {   //переход к онлайн оплате
                return(RedirectToRoute(new { controller = "Home", action = "PayOnline" }));
            }
        }
Ejemplo n.º 16
0
 public TaskRowChangeEvent(TaskRow row, global::System.Data.DataRowAction action)
 {
     this.eventRow    = row;
     this.eventAction = action;
 }
Ejemplo n.º 17
0
 public void RemoveTaskRow(TaskRow row)
 {
     this.Rows.Remove(row);
 }
Ejemplo n.º 18
0
 public void WhenIMakeTheTaskActive(TaskRow taskRow) => taskRow.MarkActive();
Ejemplo n.º 19
0
 public void WhenIMakeTheTaskCompleted(TaskRow taskRow) => taskRow.MarkCompleted();
Ejemplo n.º 20
0
            public ScheduleRow AddScheduleRow(uint Interval, string Days, string Time, TaskRow parentTaskRowByTask_Schedule)
            {
                ScheduleRow rowScheduleRow = ((ScheduleRow)(this.NewRow()));

                rowScheduleRow.ItemArray = new object[] {
                    Interval,
                    Days,
                    Time,
                    parentTaskRowByTask_Schedule[6]
                };
                this.Rows.Add(rowScheduleRow);
                return(rowScheduleRow);
            }