public ActionResult Edit_Get(Guid lgid)
        {
            LeadGeneratorDAL objdal = new LeadGeneratorDAL();
            LeadGenerator    entobj = objdal.GetSingle(lgid);

            return(View(entobj));
        }
        public ActionResult Create_Post(LeadGenerator objen)
        {
            //Employee employee = new Employee();
            //TryUpdateModel(employee);// this method handels exception
            if (ModelState.IsValid)
            {
                LeadGeneratorDAL objdal = new LeadGeneratorDAL();
                //Bussiness layer logic to save data go here
                try
                {
                    objdal.InsertUpdate(objen, 0);
                }
                catch (SqlException se)
                {
                    if (se.Number == 2627)
                    {
                        ModelState.AddModelError("LeadGeneratorName", objen.LeadGeneratorName + " already exists!");
                        return(View("Create", objen));
                    }
                }
                catch (Exception ex)
                {
                }

                return(RedirectToAction("Index"));
            }
            else
            {
                return(View());
            }
        }
        public ActionResult Edit_Post(LeadGenerator objen)
        {
            if (ModelState.IsValid)
            {
                LeadGeneratorDAL objdal = new LeadGeneratorDAL();
                //Bussiness layer logic to save data go here

                try
                {
                    objdal.InsertUpdate(objen, 1);
                }
                catch (SqlException se)
                {
                    if (se.Number == 2627)
                    {
                        ModelState.AddModelError("LeadGeneratorName", objen.LeadGeneratorName + " already exists!");
                        return(View("Edit", objen));
                    }
                }
                catch (Exception ex)
                {
                }

                return(RedirectToAction("Index"));
            }
            else
            {
                return(View(objen));
            }
        }
Пример #4
0
        public ActionResult Edit_Post(Client objen)
        {
            System.Threading.Thread.CurrentThread.CurrentCulture   = new CultureInfo("en-GB");
            System.Threading.Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-GB");

            if (ModelState.IsValid)
            {
                ClientDAL objdal = new ClientDAL();
                bool      errflg = false;
                if (Guid.Empty != objen.LG1 && Guid.Empty != objen.LG2)
                {
                    if (objen.LG1 == objen.LG2)
                    {
                        ModelState.AddModelError("LG2", "Both the Lead Generator can not be same!!");
                        errflg = true;
                    }
                    if (objen.LG1Share.HasValue && objen.LG2Share.HasValue)
                    {
                        if ((objen.LG1Share + objen.LG2Share) > 100)
                        {
                            ModelState.AddModelError("LG2Share", "Share of both the Lead Generator can not be more than 100!!");
                            errflg = true;
                        }
                    }
                    if (errflg == true)
                    {
                        LeadGeneratorDAL objdallg = new LeadGeneratorDAL();
                        objen.LGlist = objdallg.GetAll().ToList();
                        return(View("Edit", objen));
                    }
                }

                try
                {
                    objdal.InsertUpdate(objen, 1);
                }
                catch (SqlException se)
                {
                    if (se.Number == 2627)
                    {
                        LeadGeneratorDAL objdallg = new LeadGeneratorDAL();
                        objen.LGlist = objdallg.GetAll().ToList();
                        ModelState.AddModelError("ClientName", objen.ClientName + " already exists!");
                        return(View("Edit", objen));
                    }
                }
                catch (Exception ex)
                {
                }

                return(RedirectToAction("Index"));
            }
            else
            {
                return(View(objen));
            }
        }
Пример #5
0
        public ActionResult Create_Get()
        {
            LeadGeneratorDAL objdal = new LeadGeneratorDAL();
            var model = new Client()
            {
                LGlist = objdal.GetAll().ToList()
            };

            return(View(model));
        }
        public ActionResult Delete(Guid lgid)
        {
            LeadGeneratorDAL objdal = new LeadGeneratorDAL();

            try
            {
                int i = objdal.Delete(lgid);
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("Error", ex.Message);
            }
            return(RedirectToAction("Index"));
        }
Пример #7
0
        public ActionResult Edit_Get(Guid clientid)
        {
            System.Threading.Thread.CurrentThread.CurrentCulture   = new CultureInfo("en-GB");
            System.Threading.Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-GB");
            ClientDAL        objdal           = new ClientDAL();
            Client           entobj           = objdal.GetSingle(clientid);
            LeadGeneratorDAL objdallg         = new LeadGeneratorDAL();
            ClientAccMapper  listAccontNumber = new ClientAccMapper();
            var model = new Client();

            model                   = entobj;
            model.LGlist            = objdallg.GetAll().ToList();
            model.AccountNumberList = objdal.GetAcountNumberByClinetId(clientid);
            return(View(model));
        }
        //
        // GET: /LeadGenerator/
        public ActionResult Index(string search, int?page)
        {
            LeadGeneratorDAL     objdal        = new LeadGeneratorDAL();
            List <LeadGenerator> leadgenerator = new List <LeadGenerator>();

            try
            {
                if (!string.IsNullOrEmpty(search))
                {
                    leadgenerator = objdal.GetAll().Where(x => x.LeadGeneratorName.StartsWith(search, StringComparison.OrdinalIgnoreCase)).ToList();
                }
                else
                {
                    leadgenerator = objdal.GetAll().ToList();
                }
            }
            catch (Exception ex)
            {
                return(View(leadgenerator));
            }
            return(View(leadgenerator.ToPagedList(page ?? 1, 10)));
        }