예제 #1
0
        public ActionResult _DeleteAjaxEditing(int id)
        {
            CH.Delete <CommentContent>(id);
            List <CommentContent> list = CH.GetAllData <CommentContent>();

            return(View(new GridModel(list)));
        }
예제 #2
0
        public ActionResult DeleteConfirmed(int id)
        {
            var p = CH.GetAllData <Project>(i => i.ID == id).FirstOrDefault();

            p.Templates.ForEach(t =>
            {
                CH.Delete <Template>(t.ID);
            });

            var lcs = CH.GetAllData <LeadCall>(l => l.ProjectID == id);

            lcs.ForEach(l =>
            {
                CH.Delete <LeadCall>(l.ID);
            });

            p.Messages.ForEach(m =>
            {
                CH.Delete <Message>(m.ID);
            });
            p.News.ForEach(m =>
            {
                CH.Delete <News>(m.ID);
            });
            p.TargetOfWeeks.ForEach(t =>
            {
                CH.Delete <TargetOfWeek>(t.ID);
            });
            p.TargetOfMonths.ForEach(t =>
            {
                CH.Delete <TargetOfMonth>(t.ID);
            });

            p.CompanyRelationships.ForEach(t =>
            {
                CH.Delete <CompanyRelationship>(t.ID);
            });
            p.Members.ForEach(t =>
            {
                CH.Delete <Member>(t.ID);
            });
            p.Categorys.ForEach(t =>
            {
                CH.Delete <Category>(t.ID);
            });
            var deals = CH.GetAllData <Deal>(d => d.ProjectID == p.ID);

            deals.ForEach(d =>
            {
                CH.Delete <Deal>(d.ID);
            });
            p.PhoneSaleSupports.ForEach(t =>
            {
                CH.Delete <PhoneSaleSupport>(t.ID);
            });

            CH.Delete <Project>(id);
            return(RedirectToAction("Index"));
        }
        public ActionResult Deleted(int id)
        {
            var item = CH.GetDataById <TargetOfMonthForMember>(id);

            CH.Delete <TargetOfMonthForMember>(id);
            //return View("MyTargetIndexEx", getData(item.ProjectID));
            return(RedirectToAction("MyTargetIndexEx", new { projectid = id }));
        }
예제 #4
0
        public ActionResult DeleteConfirmed(int id)
        {
            var item = CH.GetDataById <Member>(id);
            var pid  = item.ProjectID;

            CH.Delete <Member>(id);
            return(RedirectToAction("Management", "Project", new { id = pid, tabindex = 1 }));
        }
예제 #5
0
        public ActionResult DeleteConfirmed(int id)
        {
            var item = CH.GetDataById <Category>(id);
            var pid  = item.ProjectID;

            CH.Delete <Category>(id);
            return(RedirectToAction("myprojectindex", "productinterface", new { id = pid }));
        }
        public ActionResult DeleteConfirmed(int id)
        {
            var item = CH.GetDataById <TargetOfMonth>(id);
            var pid  = item.ProjectID;

            CH.Delete <TargetOfMonth>(id);
            //return RedirectToAction("TargetOfMonthForProject", "Project");
            return(RedirectToAction("Management", "Project", new { id = pid, tabindex = 2 }));
        }
예제 #7
0
        public ActionResult Delete(_PreCommission model)
        {
            int month = model.StartDate.Month;

            CH.Delete <PreCommission>(model.ID);
            var list = Finance_Logical._PreCommissionBLL.GetPreCommission(model.StartDate.Year, month);
            var data = list.OrderBy(p => p.TargetNameEN).ToList();

            return(View(new GridModel(data)));
        }
예제 #8
0
        public ActionResult DeleteConfirmed(string startdate, int?projectid)
        {
            var tws = CH.GetAllData <TargetOfWeek>(t => t.StartDate.ToShortDateString() == startdate && t.ProjectID == projectid);

            tws.ForEach(ti => {
                CH.Delete <TargetOfWeek>(ti.ID);
            });

            return(RedirectToAction("BreakdownIndex", "teamleader", new { id = projectid }));
        }
예제 #9
0
        public ActionResult LeadDelete(int id, int projectid)
        {
            var calls = CH.GetAllData <LeadCall>(l => l.LeadID == id && l.ProjectID == projectid);

            calls.ForEach(c =>
            {
                CH.Delete <LeadCall>(c.ID);
            });
            ViewBag.ProjectID = projectid;
            return(View(CH.GetDataById <Lead>(id)));
        }
예제 #10
0
        public ActionResult DeleteCommission(_FinalCommission model)
        {
            int?   projectid = model.ProjectID;
            string sale      = model.TargetNameEN;

            CH.Delete <FinalCommission>(model.ID);
            var list = Finance_Logical._PreCommissionBLL.GetFinalCommission(projectid, sale);
            var data = list.OrderBy(p => p.TargetNameEN).ToList();

            return(View(new GridModel(data)));
        }
예제 #11
0
        public ActionResult DeleteConfirmed(int id)
        {
            var item      = CH.GetDataById <Deal>(id);
            var projectid = CH.GetDataById <CompanyRelationship>(item.CompanyRelationshipID).ProjectID;

            foreach (var p in item.Participants)
            {
                CH.Delete <Participant>(p.ID);
            }
            CH.Delete <Deal>(id);

            return(RedirectToAction("index", new { id = projectid }));
        }
        public ActionResult _Delete(int id)
        {
            var d    = CH.GetDataById <UserFavorsCrmGroup>(id);
            var list = d.UserFavorsCRMs;

            for (var i = 0; i < list.Count; i++)
            {
                CH.Delete <UserFavorsCRM>(list[i].ID);
            }
            CH.DB.SaveChanges();
            CH.Delete <UserFavorsCrmGroup>(id);

            return(View(new GridModel(DataQuery())));
        }
예제 #13
0
        public ActionResult Save_LeadPackage(int leadid, int companyrelationshipid, int packageid)
        {
            var old = CH.GetAllData <TargetOfPackage>(i => i.LeadID == leadid).FirstOrDefault();

            if (old != null && old.PackageID != packageid)
            {
                CH.Delete <TargetOfPackage>(old.ID);
            }

            CH.Create <TargetOfPackage>(new TargetOfPackage()
            {
                PackageID = packageid, LeadID = leadid, CompanyRelationshipID = companyrelationshipid
            });
            return(new JsonResult());
        }
예제 #14
0
        public ActionResult DeleteConfirmed(int id)
        {
            var item = CH.GetDataById <Category>(id);
            var pid  = item.ProjectID;

            CH.Delete <Category>(id);
            if (item.ProjectID != null)
            {
                return(RedirectToAction("management", "project", new { id = item.ProjectID, tabindex = 0 }));
            }
            else
            {
                return(RedirectToAction("index", "project"));
            }
        }
        public ActionResult DeleteExConfirmed(int id, int?ProjectSelect)
        {
            var item = CH.GetDataById <TargetOfMonth>(id);

            ViewBag.ProjectSelect = ProjectSelect;
            var pid = item.ProjectID;

            CH.Delete <TargetOfMonth>(id);
            var del = CH.GetAllData <TargetOfWeek>().Where(s => s.TargetOfMonthID == item.ID);

            if (del != null && del.Count() > 0)
            {
                CH.DeleteRange <TargetOfWeek>(del.ToList());
            }
            return(RedirectToAction("TargetOfMonthForProject", "TargetOfMonth", new { ProjectSelect = ProjectSelect }));
        }
예제 #16
0
        public ActionResult DeleteConfirmed(int id)
        {
            var item = CH.GetDataById <CompanyRelationship>(id);
            var pid  = item.ProjectID;

            item.Deals.ForEach(t =>
            {
                CH.Delete <Deal>(t.ID);
            });
            item.LeadCalls.ForEach(t =>
            {
                CH.Delete <LeadCall>(t.ID);
            });

            CH.Delete <CompanyRelationship>(id);
            return(RedirectToAction("management", "project", new { id = pid, tabindex = 3 }));
        }
예제 #17
0
        public ActionResult _UpdateAjaxParticipantNew([Bind(Prefix = "inserted")] IEnumerable <AjaxParticipant> insertedP,
                                                      [Bind(Prefix = "updated")] IEnumerable <AjaxParticipant> updatedP,
                                                      [Bind(Prefix = "deleted")] IEnumerable <AjaxParticipant> deletedP)
        {
            List <AjaxParticipant> pList = new List <AjaxParticipant>();

            if (Session["pList"] != null)
            {
                pList = Session["pList"] as List <AjaxParticipant>;
            }
            if (ModelState.IsValid)
            {
                if (insertedP != null)
                {
                    foreach (var p in insertedP)
                    {
                        if (p.ParticipantTypeID != null)
                        {
                            //var partType = CH.GetAllData<ParticipantType>().Where(pt => pt.Name == p.ParticipantTypeName).FirstOrDefault();

                            pList.Add(p);

                            Participant s = new Participant();
                            s.Name              = string.IsNullOrEmpty(p.Name) ? "" : p.Name.Trim();
                            s.Title             = string.IsNullOrEmpty(p.Title) ? "" : p.Title.Trim();
                            s.Gender            = string.IsNullOrEmpty(p.Gender) ? "" : p.Gender.Trim();
                            s.Mobile            = string.IsNullOrEmpty(p.Mobile) ? "" : p.Mobile.Trim();
                            s.Contact           = string.IsNullOrEmpty(p.Contact) ? "" : p.Contact.Trim();
                            s.Email             = string.IsNullOrEmpty(p.Email) ? "" : p.Email.Trim();
                            s.ParticipantTypeID = p.ParticipantTypeID;
                            s.CancelAttended    = p.CancelAttended;
                            s.ProjectID         = Convert.ToInt32(Session["ProjectID"].ToString());
                            s.DealID            = Convert.ToInt32(Session["DealID"].ToString());


                            //s.ProjectID = p.ProjectID;
                            //s.DealID = p.DealID;
                            if (s.ID == 0)
                            {
                                CH.Create <Participant>(s);
                            }
                        }
                    }
                }

                if (deletedP != null)
                {
                    foreach (var p in deletedP)
                    {
                        int index = pList.FindIndex(ap => ap.Name == p.Name && ap.ParticipantTypeName == p.ParticipantTypeName);
                        if (index != -1)
                        {
                            pList.RemoveAt(index);
                            CH.Delete <Participant>(p.ID);
                        }
                    }
                }

                if (updatedP != null)
                {
                    foreach (var p in updatedP)
                    {
                        //var partType = CH.GetAllData<ParticipantType>().Where(pt => pt.Name == p.ParticipantTypeName).FirstOrDefault();
                        AjaxParticipant a = pList.Find(s => s.ID == p.ID);
                        a.Name    = string.IsNullOrEmpty(p.Name) ? "" : p.Name.Trim();
                        a.Title   = string.IsNullOrEmpty(p.Title) ? "" : p.Title.Trim();
                        a.Gender  = string.IsNullOrEmpty(p.Gender) ? "" : p.Gender.Trim();
                        a.Mobile  = string.IsNullOrEmpty(p.Mobile) ? "" : p.Mobile.Trim();
                        a.Contact = string.IsNullOrEmpty(p.Contact) ? "" : p.Contact.Trim();
                        a.Email   = string.IsNullOrEmpty(p.Email) ? "" : p.Email.Trim();
                        //a.ParticipantTypeName = p.ParticipantTypeName;
                        a.ParticipantTypeID = p.ParticipantTypeID;
                        a.ProjectID         = p.ProjectID;
                        a.DealID            = p.DealID;
                        a.CancelAttended    = p.CancelAttended;
                        Participant sp = CH.GetDataById <Participant>(p.ID);
                        sp.Name              = string.IsNullOrEmpty(p.Name) ? "" : p.Name.Trim();
                        sp.Title             = string.IsNullOrEmpty(p.Title) ? "" : p.Title.Trim();
                        sp.Gender            = string.IsNullOrEmpty(p.Gender) ? "" : p.Gender.Trim();
                        sp.Mobile            = string.IsNullOrEmpty(p.Mobile) ? "" : p.Mobile.Trim();
                        sp.Contact           = string.IsNullOrEmpty(p.Contact) ? "" : p.Contact.Trim();
                        sp.Email             = string.IsNullOrEmpty(p.Email) ? "" : p.Email.Trim();
                        sp.ParticipantTypeID = p.ParticipantTypeID;
                        sp.ProjectID         = p.ProjectID;
                        sp.DealID            = p.DealID;
                        sp.CancelAttended    = p.CancelAttended;
                        CH.Edit <Participant>(sp);
                    }
                }
            }
            return(View(new GridModel(pList)));
        }
예제 #18
0
 public ActionResult DeleteConfirmed(int id, int projectid)
 {
     CH.Delete <Lead>(id);
     return(RedirectToAction("Management", "Project", new { id = projectid, tabindex = 3 }));
 }
예제 #19
0
 public ActionResult DeleteConfirmed(int id)
 {
     CH.Delete <Template>(id);
     return(RedirectToAction("Index"));
 }
예제 #20
0
 public ActionResult DeleteConfirmed(int id)
 {
     CH.Delete <PackageItem>(id);
     return(RedirectToAction("Index", "Package"));
 }
예제 #21
0
 public ActionResult DeleteConfirmed(int id)
 {
     CH.Delete <ExpLevel>(id);
     return(RedirectToAction("Index"));
 }
예제 #22
0
 public ActionResult DeleteConfirmed(int id)
 {
     CH.Delete <Lead>(id);
     return(RedirectToAction("Index", "Company"));
 }
예제 #23
0
 public ActionResult DeleteConfirmed(int id)
 {
     CH.Delete <ProjectRight>(id);
     return(RedirectToAction("Index"));
 }
 public ActionResult DeleteConfirmed(int id)
 {
     CH.Delete <Department>(id);
     return(RedirectToAction("Index"));
 }
예제 #25
0
 public ActionResult DeleteConfirmed(int id)
 {
     CH.Delete <PaymentType>(id);
     return(RedirectToAction("Index"));
 }
 public ActionResult _DeleteAjaxEditing(int id)
 {
     CH.Delete <ProjectReview>(id);
     return(View(new GridModel(GetData())));
 }
예제 #27
0
 public ActionResult DeleteConfirmed(int id)
 {
     CH.Delete <Research>(id);
     return(RedirectToAction("MyIndex"));
 }
예제 #28
0
        private void PreCommByProSales(DateTime ActualPaymentDate, string sale, int projectid)
        {
            var year      = ActualPaymentDate.Year;
            var month     = ActualPaymentDate.Month;
            var startdate = new DateTime(year, month, 1);
            var enddate   = startdate.AddMonths(1).AddDays(-1);
            var deals     = from d in CH.DB.Deals.Where(o => o.ProjectID == projectid && o.Abandoned == false && o.Income > 0 &&
                                                        o.ActualPaymentDate.Value.Month == ActualPaymentDate.Month && o.ActualPaymentDate.Value.Year == year && o.Sales == sale)
                            select d;
            var username    = sale;
            var emps        = CH.DB.EmployeeRoles.Where(w => w.AccountName == username);
            var displayname = emps.Select(s => s.AccountNameCN).FirstOrDefault();
            var roleid      = emps.Select(s => s.RoleID).FirstOrDefault();
            var projects    = from p in deals
                              group p by new { p.Project.ProjectCode } into grp
                select new { projectcode = grp.Key.ProjectCode };
            var proname = "";

            foreach (var name in projects)
            {
                proname = proname + name.projectcode + ",";
            }
            proname = proname.TrimEnd(',');
            string inout = "海外";

            if (roleid != null)
            {
                var name = CH.GetDataById <Role>(roleid).Name;
                if (name.Contains("国内"))
                {
                    inout = "国内";
                }
            }
            decimal standard     = 3000;
            var     sponsorrate  = 5;
            var     delegaterate = 5;
            var     lps          = new PreCommission()
            {
                ProjectID          = projectid,
                Income             = deals.Sum(s => (decimal?)s.Income),
                TargetNameEN       = sale,
                TargetNameCN       = displayname,
                InOut              = inout,
                SponsorIncome      = deals.Where(w => w.Poll == 0).Sum(s => (decimal?)s.Income),
                DelegateIncome     = deals.Where(w => w.Poll > 0).Sum(s => (decimal?)s.Income),
                SponsorRate        = sponsorrate,
                SponsorCommission  = deals.Where(w => w.Poll == 0).Sum(s => (decimal?)s.Income) * sponsorrate / 100,
                DelegateRate       = delegaterate,
                DelegateCommission = deals.Where(w => w.Poll > 0).Sum(s => (decimal?)s.Income) * delegaterate / 100,
            };

            if (lps.SponsorIncome == null)
            {
                lps.SponsorIncome = 0;
            }
            else
            {
                lps.SponsorIncome = (decimal)Math.Round((decimal)lps.SponsorIncome);
            }
            if (lps.DelegateIncome == null)
            {
                lps.DelegateIncome = 0;
            }
            else
            {
                lps.DelegateIncome = (decimal)Math.Round((decimal)lps.DelegateIncome);
            }
            if (lps.SponsorCommission == null)
            {
                lps.SponsorCommission = 0;
            }
            else
            {
                lps.SponsorCommission = (decimal)Math.Round((decimal)lps.SponsorCommission);
            }
            if (lps.DelegateCommission == null)
            {
                lps.DelegateCommission = 0;
            }
            else
            {
                lps.DelegateCommission = (decimal)Math.Round((decimal)lps.DelegateCommission);
            }
            lps.Income     = lps.DelegateIncome + lps.SponsorIncome;
            lps.Commission = lps.SponsorCommission + lps.DelegateCommission;
            if (lps.Commission > 3500)
            {
                lps.Tax = (decimal)Math.Round((((double)lps.Commission - 3500) * 0.07));
            }
            else
            {
                lps.Tax = 0;
            }
            lps.TotalCommission = lps.ActualCommission = lps.Commission - lps.Tax;
            var procode = CH.GetDataById <Project>(projectid).ProjectCode;
            var CommID  = sale + year.ToString() + ActualPaymentDate.Month.ToString().PadLeft(2, '0');

            lps.CommID    = CommID;
            lps.StartDate = startdate;
            lps.EndDate   = enddate;
            var precommission = CH.DB.PreCommissions.Where(x => x.CommID == CommID && x.ProjectID == projectid).FirstOrDefault();

            if (precommission != null)
            {
                CH.Delete <PreCommission>(precommission.ID);
            }
            lps.Creator     = "system";
            lps.CreatedDate = DateTime.Now;
            //CH.Create<PreCommission>(lps);
            CH.DB.Set <PreCommission>().Add(lps);
            CH.DB.SaveChanges();
            //DB.Set<PreCommission>().Add(lps);
            //DB.SaveChanges();
        }
 public ActionResult DeleteConfirmed(int id)
 {
     CH.Delete <OnPhoneBlockType>(id);
     return(RedirectToAction("Index"));
 }
 public ActionResult DeleteConfirmed(int id)
 {
     CH.Delete <DistrictNumber>(id);
     return(RedirectToAction("Index"));
 }