コード例 #1
0
ファイル: COATApproverController.cs プロジェクト: MyRSG/COAT
 public override ActionResult Wrong(Deal deal, FormCollection collection)
 {
     deal.NotifySalesId = GetAssignToId(collection);
     UpdateDeal(deal, new[] {"ChinaRegion", "ProvinceId", "Industry2Id"});
     Db.SaveChanges();
     return base.Wrong(deal, collection);
 }
コード例 #2
0
ファイル: BaseController.cs プロジェクト: MyRSG/COAT
        protected void UpdateDeal(Deal deal, string[] properties)
        {
            Deal dbDeal = Db.Deals.FirstOrDefault(a => a.Id == deal.Id);
            if (dbDeal == null)
                return;

            dbDeal.UpdateInclude(deal, properties);
        }
コード例 #3
0
ファイル: COATApproverController.cs プロジェクト: MyRSG/COAT
 protected override void OnApproving(Deal deal, FormCollection collection)
 {
     deal.ApproverId = GetCurrentMemberShipUser().COATUser.Id;
     deal.ApproveDate = DateTime.Now;
     deal.NotifySalesId = GetAssignToId(collection);
     UpdateDeal(deal,
                new[] {"ChinaRegion", "ProvinceId", "Industry2Id", "NotifySalesId", "ApproverId", "ApproveDate"});
     base.OnApproving(deal, collection);
 }
コード例 #4
0
ファイル: COATApproverController.cs プロジェクト: MyRSG/COAT
        public override ActionResult Reject(Deal deal, FormCollection collection)
        {
            deal.ApproverId = GetCurrentMemberShipUser().COATUser.Id;
            deal.ApproveDate = DateTime.Now;
            deal.NotifySalesId = GetAssignToId(collection);
            UpdateDeal(deal, new[] {"NotifySalesId", "ApproverId", "ApproveDate"});
            Db.SaveChanges();
            return base.Reject(deal, collection);

               /* var view = base.Reject(deal, collection);
            SendRejectMail(deal, collection);
            return view;*/
        }
コード例 #5
0
        protected override void OnApproved(Deal deal, FormCollection collection)
        {
            base.OnApproved(deal, collection);

            Deal dbDeal = GetDeal(deal.Id);
            string url = Url.AbsoluteAction("Details", "Deals", new {id = deal.Id});
            string tmp = new MailTempleteHepler().GetTemplete(MailTempleteHepler.DealApproved);
            string msg = string.Format(tmp, dbDeal.Customer.Name, url);
            MHelper.SendMail(
                new[] {deal.Notifier.Email, deal.Approver.Email},
                new[] {GetCurrentMemberShipUser().Email},
                "合作伙伴业务机会已经获得渠道部门批准",
                msg);
        }
コード例 #6
0
ファイル: COATController.cs プロジェクト: MyRSG/COAT
        public virtual ActionResult Approve(Deal deal, FormCollection collection)
        {
            OnApproving(deal, collection);

            Deal dbDeal = GetDeal(deal.Id);
            dbDeal.StatusId = NextStatusId;

            UpdateProducts(collection);
            SaveApproveHistory(dbDeal.Id, ApproveActionName, GetComment(collection));

            Db.SaveChanges();

            OnApproved(dbDeal, collection);
            return Redirect("../Index");
        }
コード例 #7
0
        public override ActionResult Reject(Deal deal, FormCollection collection)
        {
            deal.DirectorId = GetCurrentMemberShipUser().COATUser.Id;
            deal.DirectorDate = DateTime.Now;
            UpdateDeal(deal, new[] {"DirectorId", "DirectorDate"});

            ActionResult rslt = base.Reject(deal, collection);
            Deal dbDeal = GetDeal(deal.Id);
            string url = Url.AbsoluteAction("Details", "Deals", new {id = deal.Id});
            MHelper.SendMail(
                new[] {dbDeal.Approver.Email},
                new[] {GetCurrentMemberShipUser().Email},
                "A new ORP Deal was rejectd by director in COAT",
                string.Format("Name:{0}\r\nURL:{1}", dbDeal.Name, url));

            return rslt;
        }
コード例 #8
0
ファイル: COATController.cs プロジェクト: MyRSG/COAT
        public virtual ActionResult Reject(Deal deal, FormCollection collection)
        {
            Deal dbDeal = GetDeal(deal.Id);
            //var products = dbDeal.DealProducts;
            //var productActive = new Dictionary<int, bool>();
            //foreach (var p in products)
            //{
            //    productActive.Add(p.Id, false);
            //}
            //UpdateProducts(productActive);
            Status firstOrDefault = Db.Status.FirstOrDefault(a => a.ActionName == "R");
            if (firstOrDefault != null)
                dbDeal.StatusId = firstOrDefault.Id;
            SaveApproveHistory(dbDeal.Id, "Reject", GetComment(collection));
            Db.SaveChanges();

            return Redirect("../Index");
        }
コード例 #9
0
ファイル: ExportGenerator.cs プロジェクト: MyRSG/COAT
 private IEnumerable<ExportObject> GenerateExportObject(Deal d)
 {
     var rslt = new List<ExportObject>();
     foreach (var pd in d.DealProducts)
     {
         var obj = new ExportObject();
         try
         {
             obj.DealId = d.Id;
             obj.EndUserCHS = d.Customer == null ? "" : d.Customer.NameCHS;
             obj.EndUserENG = d.Customer == null ? "" : d.Customer.NameENG;
             obj.Country = "China";
             obj.Province1 = d.Customer == null ? "" : d.Customer.Province;
             obj.Province2 = d.Province == null ? "" : d.Province.Name;
             obj.Industry1 = d.Industry == null ? "" : d.Industry.Name;
             obj.Industry2 = d.Industry2 == null ? "" : d.Industry2.Name;
             obj.ORPName = d.Name;
             obj.ProductName = pd.ProductName;
             obj.ProductStatus = GetProductStatus(pd);
             obj.PartnerName = d.Partner == null ? "" : d.Partner.Name;
             obj.PartnerType = d.Partner == null ? "" : d.Partner.Qualification;
             obj.TotalPrice = d.TotalPrice.ToString(CultureInfo.InvariantCulture);
             obj.DealSize = d.DealSize;
             obj.Assigner = d.Assigner == null ? "" : d.Assigner.Name;
             obj.AssignDate = d.AssignDate.ToString();
             obj.Approver = d.Approver == null ? "" : d.Approver.Name;
             obj.ApproveDate = d.ApproveDate.ToString();
             obj.ChannelDirector = d.Director == null ? "" : d.Director.Name;
             obj.DirectorDate = d.DirectorDate.ToString();
             obj.Status = d.Status == null ? "" : d.Status.Name;
             obj.ContractUploaded = (d.DealContracts.Any()).ToString();
             obj.AssignedSalesName = d.Notifier == null ? "" : d.Notifier.Name;
             rslt.Add(obj);
         }
         catch (Exception e)
         {
             _logger.Error(e.Message);
         }
     }
     return rslt.ToArray();
 }
コード例 #10
0
ファイル: COATApproverController.cs プロジェクト: MyRSG/COAT
        public ActionResult PendingSales(Deal deal, FormCollection collection)
        {
            deal.NotifySalesId = GetAssignToId(collection);
            UpdateDeal(deal, new[] {"ChinaRegion", "ProvinceId", "Industry2Id", "NotifySalesId"});

            var dbDeal = GetDeal(deal.Id);
            dbDeal.StatusId = PendingSalesStatusId;
            SaveApproveHistory(dbDeal.Id, "Wait for Sales Confirmation", GetComment(collection));
            Db.SaveChanges();

            var url = Url.AbsoluteAction("Details", "Deals", new {id = deal.Id});
            var tmp = new MailTempleteHepler().GetTemplete(MailTempleteHepler.SalesCofirm);
            var msg = string.Format(tmp, dbDeal.Name, url);
            MHelper.SendMail(
                new[] {GetAssignUser(collection).Email},
                new[] {GetCurrentMemberShipUser().Email},
                new[] {GetCurrentMemberShipUser().Email},
                "新的合作伙伴业务机会正在等待你的回复确认",
                msg);

            return Redirect("../Index");
        }
コード例 #11
0
ファイル: COATApproverController.cs プロジェクト: MyRSG/COAT
 protected void SendApprovedMail(Deal deal, FormCollection collection)
 {
     var dbDeal = GetDeal(deal.Id);
     var url = Url.AbsoluteAction("Details", "Deals", new {id = deal.Id});
     var tmp = new MailTempleteHepler().GetTemplete(MailTempleteHepler.DealApproved);
     var msg = string.Format(tmp, dbDeal.Customer.Name, url,deal.Partner.Name);
     MHelper.SendMail(
         new[] {GetAssignUser(collection).Email},
         new[] {GetCurrentMemberShipUser().Email},
         new[] {GetCurrentMemberShipUser().Email},
         "合作伙伴业务机会已经获得渠道部门批准",
         msg);
 }
コード例 #12
0
ファイル: COATController.cs プロジェクト: MyRSG/COAT
 protected virtual void OnApproving(Deal deal, FormCollection collection)
 {
 }
コード例 #13
0
 //[Authorize]
 //public ActionResult PendingSales(Deal deal, FormCollection collection)
 //{
 //    deal.NotifySalesId = GetAssignToId(collection);
 //    UpdateDeal(deal, new string[] { "ChinaRegion", "ProvinceId", "Industry2Id", "NotifySalesId" });
 //    var dbDeal = GetDeal(deal.Id);
 //    dbDeal.StatusId = db.Status.FirstOrDefault(a => a.ActionName == "PSC").Id;
 //    SaveApproveHistory(dbDeal.Id, "Wait for Sales Confirmation", GetComment(collection));
 //    db.SaveChanges();
 //    var url = Url.AbsoluteAction("Details", "Deals", new { id = deal.Id });
 //    var addtion = new MailTempleteHepler().GetTemplete(MailTempleteHepler.SalesCofirm);
 //    mHelper.SendMail(
 //        new string[] { GetAssignUser(collection).Email },
 //        new string[] { GetCurrentMemberShipUser().Email },
 //        new string[] { GetCurrentMemberShipUser().Email },
 //        "A new ORP Deal is waitting for your confirmation",
 //        string.Format("Name:{0}\r\nURL:{1}\r\n{2}", dbDeal.Name, url, addtion));
 //    return Redirect("../Index");
 //}
 protected override void OnApproving(Deal deal, FormCollection collection)
 {
     SetNextStatus(collection);
     base.OnApproving(deal, collection);
 }
コード例 #14
0
        protected override void OnApproved(Deal deal, FormCollection collection)
        {
            base.OnApproved(deal, collection);
            Deal dbDeal = GetDeal(deal.Id);

            if (dbDeal.Status.ActionName == "PDA")
                return;

            SendApprovedMail(deal, collection);
        }
コード例 #15
0
ファイル: SalesApproverController.cs プロジェクト: MyRSG/COAT
        protected override void OnApproved(Deal deal, FormCollection collection)
        {
            base.OnApproved(deal, collection);

            SendApprovedMail(deal, collection);
        }
コード例 #16
0
ファイル: COAT.Designer.cs プロジェクト: MyRSG/COAT
 /// <summary>
 /// Deprecated Method for adding a new object to the Deals EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToDeals(Deal deal)
 {
     base.AddObject("Deals", deal);
 }
コード例 #17
0
ファイル: COATController.cs プロジェクト: MyRSG/COAT
        public virtual ActionResult Wrong(Deal deal, FormCollection collection)
        {
            Deal dbDeal = GetDeal(deal.Id);
            EntityCollection<DealProduct> products = dbDeal.DealProducts;
            Dictionary<int, bool> productActive = products.ToDictionary(p => p.Id, p => true);
            UpdateProducts(productActive);
            dbDeal.StatusId = PreviousStatusId;
            dbDeal.ApproveDate = null;
            SaveApproveHistory(dbDeal.Id, "Assign Wrong", GetComment(collection));
            Db.SaveChanges();

            return Redirect("../Index");
        }
コード例 #18
0
ファイル: COAT.Designer.cs プロジェクト: MyRSG/COAT
 /// <summary>
 /// Create a new Deal object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 public static Deal CreateDeal(global::System.String id)
 {
     Deal deal = new Deal();
     deal.Id = id;
     return deal;
 }
コード例 #19
0
 protected override void OnApproving(Deal deal, FormCollection collection)
 {
     deal.DirectorId = GetCurrentMemberShipUser().COATUser.Id;
     deal.DirectorDate = DateTime.Now;
     UpdateDeal(deal, new[] {"DirectorId", "DirectorDate"});
     base.OnApproving(deal, collection);
 }
コード例 #20
0
        protected override void OnApproving(Deal deal, FormCollection collection)
        {
            //DoSetRegion(collection);
            //db.SaveChanges();

            //deal.ApproverId = GetAssignToId(collection);

            SetNextStatus(deal.ApproverId);
            deal.AssignerId = GetCurrentMemberShipUser().COATUser.Id;
            deal.AssignDate = DateTime.Now;
            UpdateDeal(deal,
                       new[] {"ChinaRegion", "ProvinceId", "Industry2Id", "ApproverId", "AssignerId", "AssignDate"});
            base.OnApproving(deal, collection);
        }
コード例 #21
0
ファイル: COATApproverController.cs プロジェクト: MyRSG/COAT
 protected void SendRejectMail(Deal deal, FormCollection collection)
 {
     try
     {
         var dbDeal = GetDeal(deal.Id);
         var url = Url.AbsoluteAction("Details", "Deals", new {id = deal.Id});
         var tmp = new MailTempleteHepler().GetTemplete(MailTempleteHepler.DealRejected);
         var msg = string.Format(tmp, dbDeal.Customer.Name, url, deal.Partner.Name);
         MHelper.SendMail(
             new[] {GetAssignUser(collection).Email},
             new[] {GetCurrentMemberShipUser().Email},
             new[] {GetCurrentMemberShipUser().Email},
             "合作伙伴业务机会已经被拒绝",
             msg);
     }
     catch (Exception e)
     {
         Logger.Error(e.Message);
     }
 }