コード例 #1
0
        public JsonResult ToList(string filter, string value)
        {
            ClientsBL ub  = new ClientsBL();
            var       rec = ub.ToList(filter, value);

            return(Json(rec, JsonRequestBehavior.AllowGet));
        }
コード例 #2
0
        public ActionResult Clients(int CountryId)
        {
            List <SelectListItem> items = new List <SelectListItem>();
            ClientsBL             cb    = new ClientsBL();
            var lst = cb.ToList("ByCountryId", CountryId.ToString());

            //  items.Add(new SelectListItem { Text = "Select Client", Value = "0" });
            foreach (var item in lst)
            {
                items.Add(new SelectListItem {
                    Text = item.ClientName, Value = item.ClientId.ToString()
                });
            }
            return(Json(new SelectList(items, "Value", "Text"), JsonRequestBehavior.AllowGet));;
        }
コード例 #3
0
        public ActionResult New()
        {
            ClientsBL ub   = new ClientsBL();
            var       List = ub.ToList("Company");

            SWI.AirView.Common.SelectedList sl = new SWI.AirView.Common.SelectedList();
            ViewBag.SelectedClientTypes = sl.Definations("byDefinationType", "Profile Type");
            ViewBag.SelectedPClient     = sl.Clients("AllVendors");
            if (List.Count > 0)
            {
                return(RedirectToAction("Edit", new { @Id = List[0].ClientId }));
            }
            else
            {
                return(View());
            }
        }
コード例 #4
0
        public List <SelectListItem> Clients(string filter)
        {
            List <SelectListItem> items = new List <SelectListItem>();
            ClientsBL             cb    = new ClientsBL();
            var lst = cb.ToList(filter);

            items.Add(new SelectListItem {
                Text = "Select Client", Value = "0"
            });
            foreach (var item in lst)
            {
                items.Add(new SelectListItem {
                    Text = item.ClientName, Value = item.ClientId.ToString()
                });
            }
            return(items);
        }
コード例 #5
0
        public ActionResult New(AD_Clients cl, List <AD_ClientContacts> con, List <AD_ClientAddress> add)
        {
            decimal  Id    = 0;
            Response res   = new Response();
            string   fname = string.Empty;

            try
            {
                ClientsBL rb   = new ClientsBL();
                var       List = rb.ToList("Company");

                if (List.Count > 0)
                {
                    res.Status  = "danger";
                    res.Message = "Company Already Exist !";
                    return(Json(res, JsonRequestBehavior.AllowGet));
                }
                string Extension = "";
                if (Request.Files.Count > 0)
                {
                    HttpFileCollectionBase files = Request.Files;
                    for (int i = 0; i < files.Count; i++)
                    {
                        HttpPostedFileBase file = files[i];

                        // Checking for Internet Explorer
                        if (Request.Browser.Browser.ToUpper() == "IE" || Request.Browser.Browser.ToUpper() == "INTERNETEXPLORER")
                        {
                            string[] testfiles = file.FileName.Split(new char[] { '\\' });
                            fname = testfiles[testfiles.Length - 1];
                        }
                        else
                        {
                            fname = cl.ClientPrefix;
                        }
                        fname = Path.Combine(Server.MapPath("~/Content/Images/ClientLogo"), fname + "_logo" + Path.GetExtension(file.FileName));
                        file.SaveAs(fname);
                        Extension = Path.GetExtension(file.FileName);
                    }
                }

                cl.Logo = "/Content/Images/ClientLogo/" + cl.ClientPrefix + "_logo" + Extension;
                Id      = rb.Manage("Insert", cl);
                dbDataTable ddt   = new dbDataTable();
                DataTable   dtcon = ddt.List();
                DataTable   dt    = ddt.List();
                foreach (var item in add)
                {
                    myDataTable.AddRow(dt, "Value1", item.Address, "Value2", item.Street, "Value3", item.CityId, "Value4", item.StateId, "Value5", item.CountryId,
                                       "Value6", item.ZipCode, "Value7", item.IsHeadOffice, "Value8", Id, "Value9", item.IsActive);
                }
                AD_ClientAddressDL claddress = new AD_ClientAddressDL();
                claddress.Manage("Insert", dt);
                res.Status  = "success";
                res.Value   = Id;
                res.Message = "Save successfully";
                res.Value   = Id.ToString();
            }
            catch (Exception ex)
            {
                res.Status  = "danger";
                res.Message = ex.Message;
            }

            if (res.Status == "success")
            {
                return(Json(res, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(res, JsonRequestBehavior.AllowGet));
            }
        }
コード例 #6
0
        public ActionResult Edit(string Id = "")
        {
            ClientsBL       cb   = new ClientsBL();
            UserClientsBL   uchb = new UserClientsBL();
            UserCityBL      ucb  = new UserCityBL();
            AD_DefinationBL db   = new AD_DefinationBL();
            Sec_User        user = new Sec_User();

            Sec_UserBL               ubl = new Sec_UserBL();
            Sec_UserSettingsDL       udl = new Sec_UserSettingsDL();
            Sec_PermissionBL         pl  = new Sec_PermissionBL();
            Sec_UserDefinationTypeBL udt = new Sec_UserDefinationTypeBL();

            ViewBag.Titles = new List <SelectListItem> {
                new SelectListItem {
                    Text = "Mr.", Value = "1"
                },
                new SelectListItem {
                    Text = "Mrs.", Value = "2"
                },
                new SelectListItem {
                    Text = "Miss.", Value = "3"
                },
                new SelectListItem {
                    Text = "Ms.", Value = "4"
                },
                new SelectListItem {
                    Text = "Sir.", Value = "5"
                },
                new SelectListItem {
                    Text = "DR", Value = "6"
                }
            };
            ViewBag.Hide = false;
            ViewBag.Team = false;
            if (Id == Convert.ToString(ViewBag.UserId))
            {
                ViewBag.Hide = true;
                List <OrgChart> rec   = ubl.hierarchy("ByCompanyId", Convert.ToString(ViewBag.CompId));
                List <Chart>    Data2 = FlatToHierarchy(rec, ViewBag.UserId);
                if (Data2.Count > 0)
                {
                    ViewBag.Team = true;
                }
                else
                {
                    ViewBag.Team = false;
                }
            }
            SWI.AirView.Common.SelectedList sl = new SWI.AirView.Common.SelectedList();
            Sec_UserBL ud   = new Sec_UserBL();
            Sec_User   User = ud.Single("ById", Id.ToString());

            ViewBag.UserTitle = User.Title;
            ViewBag.Hide2     = true;
            if (User.ReportToId.ToString() == Convert.ToString(ViewBag.UserId))
            {
                ViewBag.Hide2 = false;
            }
            if (Id == Convert.ToString(ViewBag.UserId))
            {
                ViewBag.Hide2 = false;
            }
            ViewBag.User = User;
            if (User == null)
            {
            }
            if (User.IsAdmin == true)
            {
                ViewBag.Hide  = false;
                ViewBag.Hide2 = false;
                ViewBag.Team  = true;
            }
            NewData();
            ViewBag.Id       = User.CompanyId;
            ViewBag.RoleId   = User.RoleId;
            ViewBag.Reports  = sl.User("All");
            ViewBag.ReportTo = ud.ToList("All");
            ViewBag.Clients2 = sl.Clients("AllRecords");
            /////permissions
            user = ubl.Single("ById", Id.ToString());
            ///Project
            DataTable Table = udl.GetDataTable("All_Projects", User.ReportToId.ToString(), null, null);

            ViewBag.Projects = Table.ToList <PM_Projects>();
            DataTable Table1 = udl.GetDataTable("UserProjects", Id.ToString(), null, null);

            ViewBag.UserProjects = Table1.ToList <PM_Projects>();
            var    r          = pl.ToList("byUserId", Id.ToString());
            var    d          = udt.ToList("GetByUserId", Id.ToString());
            string UDSelected = null;

            foreach (var item in d)
            {
                UDSelected += item.DefinationTypeId + ",";
            }
            ViewBag.DIds = UDSelected;
            string Selected = null;

            foreach (var item in r)
            {
                Selected += item.Id + ",";
            }
            ViewBag.PIds = Selected;
            ViewBag.UId  = Id;

            #region user Permissions on tab
            //Clients
            //ViewBag.Clients = cb.ToList("byStatus", User.ReportToId.ToString());
            ViewBag.Clients     = cb.ToList("byStatus", "True", User.ReportToId.ToString());
            ViewBag.UserClients = uchb.ToList("byUserId", Id.ToString());
            //Cities

            ViewBag.Cities = db.ToList("AllCities");
            //db.ToList("UserCities",User.ReportToId.ToString());
            ViewBag.UserCities = ucb.ToList("byUserId", Id.ToString());

            ViewBag.Region = db.RegionsToList(User.ReportToId.ToString());
            //scope
            ViewBag.Scopes = db.ToList("Scopes", User.ReportToId.ToString());
            //ViewBag.Scopes = db.ToList("Scopes");
            ViewBag.UserScopes = db.ToList("UserScopes", Id.ToString());

            ViewBag.Permissions = pl.ToList("byRoleId", user.RoleId.ToString(), User.ReportToId.ToString());

            #endregion
            AD_DefinationTypesBL dtd = new AD_DefinationTypesBL();
            ViewBag.DefinationTypes = dtd.ToList("All", User.ReportToId.ToString());

            //User.RoleName = ViewBag.RoleName;
            return(View("edit", User));
        }
コード例 #7
0
        public ActionResult New(Workorder wo, List <Workorder> wolst, List <AV_TSSCheckList> tss, long SiteTypeIds = 0, long SiteClassIds = 0, long ProjectIds = 0, string Clonetype = "")
        {
            Response res = new Response();

            try
            {
                if (Clonetype == "Clone")
                {
                    wo.SiteTypeId  = SiteTypeIds.ToString();
                    wo.SiteClassId = SiteClassIds;
                    wo.ProjectId   = ProjectIds;
                }

                if (wo.SiteId != 0)
                {
                    wo.SiteTypeId  = SiteTypeIds.ToString();
                    wo.SiteClassId = SiteClassIds;
                    wo.ProjectId   = ProjectIds;
                }
                ClientsBL ub           = new ClientsBL();
                var       ClientPrefix = ub.ToList("AllRecords").Where(x => x.ClientId == Convert.ToDecimal(wo.Client)).FirstOrDefault().ClientPrefix;
                wolst[0].ClientPrefix = ClientPrefix;
                Common.SelectedList sl = new Common.SelectedList();
                var obj = sl.Definations("UserScopes", Convert.ToString(ViewBag.UserId));// sl.Scopes();

                TempData["clusters"]    = wolst;
                TempData["SiteCluster"] = wo.siteCode + "," + wo.clusterCode + "," + ClientPrefix;
                foreach (var df in obj)
                {
                    if (wo.Scope == df.Value && df.Text == "TSS" || wo.Scope == df.Value && df.Text == "CLS")
                    {
                        foreach (var item in wolst)
                        {
                            item.VerticalBeamWidth = "0";
                            item.RFHeight          = 0;
                            item.MTilt             = 0;
                            item.ETilt             = 0;
                            item.BandWidth         = "0";
                            item.SectorLatitude    = 0;
                            item.SectorLongitude   = 0;
                            item.CellId            = "0";
                            item.MRBTS             = "0";
                        }
                    }
                }
                WorkOrderBL wb = new WorkOrderBL();
                if (wolst.Count > 0 && wolst[0].clusterId != null)
                {
                    var fname = wo.siteCode + "," + wo.clusterCode;
                    if (wo.SiteId == 0)
                    {
                        wb.Insert("NewWorkOrder", wo, wolst, ViewBag.UserId, null, fname);
                    }
                    else
                    {
                        wb.ChangeFolderName(wo, wolst);
                        wb.Insert("Edit_Work_Order", wo, wolst, ViewBag.UserId, null, fname);
                    }
                }
                else
                {
                    if (wo.SiteId == 0)
                    {
                        wb.Insert("NewWorkOrder", wo, wolst, ViewBag.UserId, null);
                    }
                    else
                    {
                        wb.ChangeFolderName(wo, wolst);
                        wb.Insert("Edit_Work_Order", wo, wolst, ViewBag.UserId, null);
                    }
                }
                res.Status  = "success";
                res.Message = "save successfully";
            }
            catch (Exception ex)
            {
                res.Status  = "danger";
                res.Message = ex.Message;
            }
            return(Json(new { response = res }, JsonRequestBehavior.AllowGet));
        }
コード例 #8
0
ファイル: ClientController.cs プロジェクト: swigithub/MVC
 public ActionResult All()
 {
     return(View(BL.ToList("AllRecords")));
 }
コード例 #9
0
        public ActionResult ByUser(int id = 0)
        {
            Sec_User   user = new Sec_User();
            Sec_UserBL ubl  = new Sec_UserBL();

            user = ubl.Single("ById", id.ToString());
            if (user != null)
            {
                Sec_UserSettingsDL       udl = new Sec_UserSettingsDL();
                Sec_PermissionBL         pl  = new Sec_PermissionBL();
                Sec_UserDefinationTypeBL ud  = new Sec_UserDefinationTypeBL();
                ///Projects and User projects
                DataTable Table = udl.GetDataTable("All_Projects", null, null, null);
                ViewBag.Projects = Table.ToList <PM_Projects>();
                DataTable Table1 = udl.GetDataTable("UserProjects", id.ToString(), null, null);
                ViewBag.UserProjects = Table1.ToList <PM_Projects>();
                var    r          = pl.ToList("byUserId", id.ToString());
                var    d          = ud.ToList("GetByUserId", id.ToString());
                string UDSelected = null;
                foreach (var item in d)
                {
                    UDSelected += item.DefinationTypeId + ",";
                }
                ViewBag.DIds = UDSelected;
                string Selected = null;
                foreach (var item in r)
                {
                    Selected += item.Id + ",";
                }
                ViewBag.PIds = Selected;
                ViewBag.UId  = id;


                // User Clients
                ClientsBL cb = new ClientsBL();
                ViewBag.Clients = cb.ToList("byStatus", "True");

                // get selected user Clients
                UserClientsBL uchb = new UserClientsBL();
                ViewBag.UserClients = uchb.ToList("byUserId", id.ToString());


                // get selected user Cities
                UserCityBL ucb = new UserCityBL();

                ViewBag.UserCities = ucb.ToList("byUserId", id.ToString());

                // get Regions
                AD_DefinationBL db = new AD_DefinationBL();
                ViewBag.Region = db.RegionsToList();

                ViewBag.Cities = db.ToList("AllCities");

                ViewBag.Scopes     = db.ToList("Scopes");
                ViewBag.UserScopes = db.ToList("UserScopes", id.ToString());
                // ViewBag.UserScopes = string.Join(",", Scopes.Select(n => n.DefinationId.ToString()).ToArray());

                var Permissions = pl.ToList("byRoleId", user.RoleId.ToString());
                return(View(Permissions));
            }
            else
            {
                TempData["msg_error"] = "User not Found.";
            }

            return(View());
        }