Exemplo n.º 1
0
        string GetStatuName(CMO2_Order oreder)
        {
            string name = "";

            if (oreder.reOrder == true)
            {
                name = "Дозаказ";
            }
            else if (oreder.workDateTime == null)
            {
                name = "Не отправлен";
            }
            else if (oreder.manufDate == null)
            {
                name = "Ожидание сроков";
            }
            else if (oreder.finDate == null)
            {
                name = "Производится";
            }
            else
            {
                name = "Оприходован";
            }
            return(name);
        }
Exemplo n.º 2
0
        public JsonResult Update(CMO2_Order cMO2_Order)
        {
            string login = HttpContext.User.Identity.Name;

            new CMOOrederValid().UpdateOrder(cMO2_Order, login);
            return(Json(1, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 3
0
        public JsonResult UpdateReOrder(int id)
        {
            CMO2_Order order = db.CMO2_Order.Find(id);

            order.manufIn         = true;
            db.Entry(order).State = EntityState.Modified;
            db.SaveChanges();
            return(Json(1, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 4
0
        public EmailCMO(CMO2_Order order, string login, int stepNumber)
        {
            mailToList = new List <string>();
            try
            {
                this.login      = login;
                this.stepNumber = stepNumber;
                this.order      = db.CMO2_Order.Find(order.id);
                mail.From       = new MailAddress(login);
                if (stepNumber == 1) //Create - 1
                {
                    GetMailListCreate();
                }
                else if (stepNumber == 2) //work - 2
                {
                    GetMailList();
                    GetMailClient();
                }
                else if (stepNumber == 3) //manuf - 3
                {
                    GetMailList();
                    GetMailClient();
                    GetMailPM();
                }
                else if (stepNumber == 4) // Create ReOrder - 4
                {
                    GetMailListCreate();
                    GetMailClient();
                }
                else if (stepNumber == 5)
                {
                    GetMailPM();
                }
                else if (stepNumber == 6) //Remove
                {
                    GetMailList();
                    GetMailPM();
                }
                else
                {
                }
                GetSubject();
                GetBody();
                SendEmail();

                logger.Debug("EmailCMO: " + order.id);
            }
            catch (Exception ex)
            {
                logger.Error("EmailCMO: " + order.id + " | " + ex);
            }
        }
Exemplo n.º 5
0
        public void UpdateOrder(CMO2_Order cMO2_Order, string login)
        {
            CMO2_Order order = db.CMO2_Order.Find(cMO2_Order.id);

            if (order.reOrder == true)
            {
            }
            else if (cMO2_Order.workIn == false)
            {
                order.id_CMO_Company  = cMO2_Order.id_CMO_Company;
                order.workIn          = true;
                order.workDateTime    = cMO2_Order.workDateTime;
                order.workCost        = cMO2_Order.workCost;
                order.workComplitet   = true;
                db.Entry(order).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();
                try
                {
                    new EmailCMO(cMO2_Order, login, 2);
                    logger.Debug("UpdateOrder / EmailCMO: " + order.id);
                }
                catch (Exception ex)
                {
                    logger.Error("UpdateOrder / EmailCMO: " + order.id + " | " + ex);
                }
            }
            else if (cMO2_Order.manufIn == false)
            {
                bool pushMail = true;
                if (order.manufComplited == true)
                {
                    pushMail = false;
                }
                order.id_CMO_Company  = cMO2_Order.id_CMO_Company;
                order.manufIn         = true;
                order.workDateTime    = DateTime.Now;
                order.manufDate       = cMO2_Order.manufDate;
                order.manufCost       = cMO2_Order.manufCost;
                order.manufComplited  = true;
                db.Entry(order).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();
                if (pushMail == true)
                {
                    try
                    {
                        new EmailCMO(cMO2_Order, login, 3);
                        logger.Debug("UpdateOrder / EmailCMO: " + order.id);
                    }
                    catch (Exception ex)
                    {
                        logger.Error("UpdateOrder / EmailCMO: " + order.id + " | " + ex);
                    }
                }

                else
                {
                    try
                    {
                        new EmailCMO(cMO2_Order, login, 5);
                        logger.Debug("UpdateOrder / EmailCMO: " + order.id);
                    }
                    catch (Exception ex)
                    {
                        logger.Error("UpdateOrder / EmailCMO: " + order.id + " | " + ex);
                    }
                }
            }
            else if (cMO2_Order.finIn == false && cMO2_Order.finDate != null)
            {
                if (cMO2_Order.finDate == null)
                {
                    order.id_CMO_Company = cMO2_Order.id_CMO_Company;
                }
                else
                {
                    order.id_CMO_Company  = cMO2_Order.id_CMO_Company;
                    order.finIn           = true;
                    order.finDate         = cMO2_Order.finDate;
                    order.finCost         = cMO2_Order.finCost;
                    order.finComplited    = true;
                    db.Entry(order).State = System.Data.Entity.EntityState.Modified;
                    db.SaveChanges();
                }
            }
            else if (cMO2_Order.finIn == false && cMO2_Order.finDate == null && cMO2_Order.manufDate != null)
            {
                order.id_CMO_Company  = cMO2_Order.id_CMO_Company;
                order.manufDate       = cMO2_Order.manufDate;
                db.Entry(order).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();
                try
                {
                    new EmailCMO(cMO2_Order, login, 5);
                    logger.Debug("UpdateOrder / EmailCMO: " + order.id);
                }
                catch (Exception ex)
                {
                    logger.Error("UpdateOrder / EmailCMO: " + order.id + " | " + ex);
                }
            }
            else
            {
            }
        }