Exemplo n.º 1
0
        public ActionResult Create(ServiceorderModel serviceorder)
        {
            //try
            //{
            //    DB_BLL.ServiceorderDB(serviceorder, 1);

            //    ViewBag.Success = "Заявка '" + serviceorder.Name + "' создана";
            //    return View();
            //}
            //catch (Exception exc)
            //{
            return(View(new ServiceorderModel()));
            //}
        }
Exemplo n.º 2
0
        private static void ServiceorderCreate(ServiceorderModel serviceorder)
        {
            //try
            //{
            //    using (var context = new CRMServiceEntities())
            //    {
            //        var currentUser = (from c in context.Systemuser select c).Where(x => x.ADName == Environment.UserDomainName + @"\" + Environment.UserName).FirstOrDefault();

            //        var serviceorderId = Guid.NewGuid();

            //        var serviceorderBase = new Serviceorder()
            //        {
            //            ServiceorderId = serviceorderId,
            //            CreatedOn = DateTime.Now,
            //            CreatedBy = currentUser.SystemuserId,
            //            ModifiedOn = DateTime.Now,
            //            ModifiedBy = currentUser.SystemuserId,
            //            DeletionStateCode = 0
            //        };

            //        var serviceorderExtensionBase = new ServiceorderExtension()
            //        {
            //            ServiceorderId = serviceorderId,
            //            Name = serviceorder.Name,
            //            Date = serviceorder.Date,
            //            Serviceman_start = new Guid(serviceorder.ServicemanStart),
            //            Serviceman_end = new Guid(serviceorder.ServicemanEnd),
            //            Income = serviceorder.Income,
            //            Outgone = serviceorder.Outgone,
            //            Comment = serviceorder.Comment,
            //            Category = serviceorder.Category,
            //            Who_init = serviceorder.WhoInit,
            //            Moved = serviceorder.Moved,
            //            Result = serviceorder.Result,
            //            //Moved_reason = serviceorder.MovedReason,
            //            ResultId = serviceorder.ResultId
            //        };

            //        context.Serviceorder.Add(serviceorderBase);
            //        context.ServiceorderExtension.Add(serviceorderExtensionBase);

            //        context.SaveChanges();
            //    }
            //}
            //catch (Exception exc)
            //{
            //    throw new Exception();
            //}
        }
Exemplo n.º 3
0
        private static void ServiceorderEdit(ServiceorderModel serviceorder)
        {
            //try
            //{
            //    using (var context = new CRMServiceEntities())
            //    {
            //        var currentUser = (from c in context.Systemuser select c).Where(x => x.ADName == Environment.UserDomainName + @"\" + Environment.UserName).FirstOrDefault();

            //        var currentServiceorderId = new Guid(serviceorder.ServiceorderId);

            //        var currentServiceorder = (from c in context.ServiceorderExtension select c).Where(x => x.ServiceorderId == currentServiceorderId).FirstOrDefault();

            //        if (currentServiceorder != null)
            //        {
            //            currentServiceorder.Name = serviceorder.Name;
            //            currentServiceorder.Date = serviceorder.Date;
            //            currentServiceorder.Serviceman_start = new Guid(serviceorder.ServicemanStart);
            //            currentServiceorder.Serviceman_end = new Guid(serviceorder.ServicemanEnd);
            //            currentServiceorder.Income = serviceorder.Income;
            //            currentServiceorder.Outgone = serviceorder.Outgone;
            //            currentServiceorder.Comment = serviceorder.Comment;
            //            currentServiceorder.Category = serviceorder.Category;
            //            currentServiceorder.Who_init = serviceorder.WhoInit;
            //            currentServiceorder.Moved = serviceorder.Moved;
            //            currentServiceorder.Result = serviceorder.Result;
            //            //Moved_reason = serviceorder.MovedReason;
            //            currentServiceorder.ResultId = serviceorder.ResultId;
            //        }

            //        context.SaveChanges();
            //    }
            //}
            //catch (Exception exc)
            //{
            //    throw new Exception();
            //}
        }
Exemplo n.º 4
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        public static void ServiceorderDB(ServiceorderModel serviceorder, int flag)            //1 - create, 2 - edit, 3 - delete
        {
            try
            {
                switch (flag)
                {
                case 1:
                {
                    ServiceorderCreate(serviceorder);
                    break;
                }

                case 2:
                {
                    ServiceorderEdit(serviceorder);
                    break;
                }
                }
            }
            catch (Exception exc)
            {
                throw new Exception();
            }
        }