コード例 #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 New(string title, string Id = "")
        {
            if (Id == "")
            {
                return(RedirectToAction("All"));
            }
            SWI.AirView.Common.SelectedList sl = new SWI.AirView.Common.SelectedList();
            Sec_UserBL ud = new Sec_UserBL();

            ViewBag.tit      = title;
            ViewBag.Id       = 0;
            ViewBag.Reports  = sl.User("All");
            ViewBag.ReportTo = ud.ToList("All");

            if (Id != "")
            {
                ViewBag.Id = Convert.ToInt64(Id);
            }

            ClientsBL ub = new ClientsBL();

            ViewBag.Clients2 = sl.Clients("AllRecords");
            NewData();


            return(View());
        }
コード例 #3
0
        public ActionResult Edit(decimal Id = 0)
        {
            ViewBag.tit = "Edit";
            ViewBag.Id  = Id;
            SWI.AirView.Common.SelectedList sl = new SWI.AirView.Common.SelectedList();
            var Clienttypes = sl.Definations("byDefinationType", "Profile Type");

            ViewBag.SelectedClientTypes = Clienttypes;
            ViewBag.SelectedPClient     = sl.Clients("AllVendors");
            ClientsBL  ud      = new ClientsBL();
            AD_Clients Company = ud.Single1("ById", Id.ToString());

            if (Company == null)
            {
                TempData["msg_error"] = "Record Not Exist or You Are Not Authorize to access !";
                return(RedirectToAction("All", "Client"));
            }
            foreach (var item in Clienttypes)
            {
                if (item.Text != "Company" && (item.Value == Company.ClientTypeId.ToString()))
                {
                    return(RedirectToAction("Edit", "Client", new { Id = Id }));
                }
            }
            return(View("Edit", Company));
        }
コード例 #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string    idFromSearch   = (string)Session["IdFromSearch"];   //
            string    CityFromSearch = (string)Session["CityFromSearch"]; //
            ClientsBL cbl            = new ClientsBL();

            if (cbl.ClientExist(idFromSearch))
            {
                Client clientToDisplay = cbl.getClientByID(idFromSearch);
            }
        }
コード例 #5
0
        public ActionResult Edit(Int64 id)
        {
            AD_DefinationBL db = new AD_DefinationBL();

            ViewBag.UETypes = db.SelectedList("byDefinationType", "UE Type", "-select Device-");
            AD_UserEquipmentsBL ueb = new AD_UserEquipmentsBL();

            ClientsBL cBl = new ClientsBL();

            ViewBag.UEOwner = cBl.SelectedList("All", null, "-Select Owner-");

            return(View("new", ueb.ToSingle("ById", id.ToString())));
        }
コード例 #6
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));;
        }
コード例 #7
0
 protected void SendNewSeller(object sender, EventArgs e)
 {
     if (validUserField() && validEstateField())
     {
         ClientsBL      cbl = new ClientsBL();
         SellerEstateBL sbl = new SellerEstateBL();
         if (!RadioButtonExist.Checked)
         {
             cbl.NewClient(TextBoxID.Text, TextBoxFName.Text, TextBoxLName.Text, TextBoxP1.Text, TextBoxP2.Text, TextBoxP3.Text);
         }
         //Add To DB
         sbl.NewSellerEstate(TextBoxID.Text, ddlEstateKind.SelectedItem.Text, TextBox9.Text, ddlCities.SelectedItem.Text, ddlHood.SelectedItem.Text, ddlStreet.SelectedItem.Text, TextBox13.Text, ddlBedroomNum.SelectedItem.Text, TextBox15.Text, ddlFloorNumber.SelectedItem.Text, ddlStairs.SelectedItem.Text, ddlElavator.SelectedItem.Text, ddlBalcony.SelectedItem.Text, ddlToilet.SelectedItem.Text, ddlShowers.SelectedItem.Text, ddlStorge.SelectedItem.Text, ddlParking.SelectedItem.Text, TextBox24.Text, ddlRenovated.SelectedItem.Text, ddlBoyler.SelectedItem.Text, ddlBars.SelectedItem.Text, ddlPladelet.SelectedItem.Text);
         Response.Redirect("MainPage.aspx", false);
     }
 }
コード例 #8
0
        public ActionResult New()
        {
            AD_DefinationBL db = new AD_DefinationBL();

            ViewBag.UETypes = db.SelectedList("byDefinationType", "UE Type", "-Select Device-");

            //TempData["CompanyId"] = Convert.ToString(ViewBag.CompId);
            //ViewBag.UEOwner = Convert.ToString(ViewBag.CompId);

            ClientsBL cBl = new ClientsBL();

            ViewBag.UEOwner = cBl.SelectedList("All", null, "-Select Owner-");


            return(View());
        }
コード例 #9
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());
            }
        }
コード例 #10
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);
        }
コード例 #11
0
        public ActionResult NewSingle(AD_Clients cl, AD_ClientContacts con, AD_ClientAddress claddress)
        {
            Response res = new Response();

            try
            {
                ClientsBL           rb        = new ClientsBL();
                AD_ClientContactsBL clcon     = new AD_ClientContactsBL();
                AD_ClientAddressBL  addressbl = new AD_ClientAddressBL();

                int ClientId  = 0;
                int ContactId = 0;
                int AddressId = 0;
                if (cl.ClientId > 0 || con.ContactId > 0 || claddress.AddressId > 0)
                {
                    ClientId    = rb.Manage("Update", cl);
                    ContactId   = clcon.Manage("Update", con, null);
                    AddressId   = addressbl.Manage("Update", claddress);
                    res.Status  = "success";
                    res.Message = "update successfully";
                    return(Json(res, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    ClientId           = rb.Manage("Insert", cl);
                    con.ClientId       = ClientId;
                    ContactId          = clcon.Manage("Insert", con, null);
                    claddress.ClientId = ClientId;
                    AddressId          = addressbl.Manage("Insert", claddress);
                    res.Status         = "success";
                    res.Message        = "save successfully";
                    return(Json(res, JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception ex)
            {
                res.Status  = "danger";
                res.Message = ex.Message;
                return(Json(res, JsonRequestBehavior.AllowGet));
            }
        }
コード例 #12
0
        protected void SendNewBuyer(object sender, EventArgs e)
        {
            if (validUserField() && validEstateField())
            {
                ClientsBL     cbl = new ClientsBL();
                BuyerEstateBL sbl = new BuyerEstateBL();
                string        id;
                if (!RadioButtonExist.Checked)
                {
                    cbl.NewClient(TextBoxID.Text, TextBoxFName.Text, TextBoxLName.Text, TextBoxP1.Text, TextBoxP2.Text, TextBoxP3.Text);
                }

                string hoodCheck = ddlHood.SelectedItem.Text;
                if (ddlHood.SelectedIndex == 0)
                {
                    hoodCheck = "";
                }
                //Add To DB
                sbl.NewBuyerEstate(TextBoxID.Text, ddlEstateKind.SelectedItem.Text, ddlCities.SelectedItem.Text, hoodCheck, ddlBedroomNumFrom.SelectedItem.Text, ddlBedroomNumTo.SelectedItem.Text, TextBox13.Text, TextBox14.Text, ddlFloorFrom.SelectedItem.Text, ddlFloorTo.SelectedItem.Text, ddlGarden.SelectedItem.Text, TextBox18.Text, TextBox19.Text);
                Response.Redirect("MainPage.aspx", false);
            }
        }
コード例 #13
0
        public ActionResult All()
        {
            string     Id = null;
            Sec_UserBL ub = new Sec_UserBL();
            ClientsBL  cl = new ClientsBL();

            TempData["CompanyId"] = Id;
            ViewBag.Id            = Id;
            var User = Session["user"] as LoginInformation;

            TempData["UserId"] = User.UserId.ToString();
            if (User.IsAdmin == true)
            {
                ViewBag.Client = null;
                if (Id == null)
                {
                    TempData["CompanyId"] = Convert.ToString(ViewBag.CompId);
                    ViewBag.Id            = Convert.ToString(ViewBag.CompId);
                    // var Client = cl.Single("ById", Id).ClientName;
                    //ViewBag.Client =Client;
                }
                var Data = ub.ToList("All", Convert.ToString(ViewBag.UserId));
                return(View(Data));
            }
            else
            {
                ViewBag.Client = null;
                if (Id == null)
                {
                    TempData["CompanyId"] = Convert.ToString(ViewBag.CompId);
                    ViewBag.Id            = Convert.ToString(ViewBag.CompId);
                    // var Client = cl.Single("ById", Id).ClientName;
                    //ViewBag.Client =Client;
                }

                return(View(ub.ToList("UserByUserId", Convert.ToString(User.UserId))));
            }
        }
コード例 #14
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));
            }
        }
コード例 #15
0
 public clientsEntity GetOneByUserName(string UserName)
 {
     return(ClientsBL.GetOneByUserName(UserName));
 }
コード例 #16
0
 public bool CheckIfExist([FromBody] clientsEntity c)
 {
     return(ClientsBL.CheckIfExist(c));
 }
コード例 #17
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());
        }
コード例 #18
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));
        }
コード例 #19
0
        protected bool validUserField()
        {
            ExistUserErrorLabel.Visible = false;
            NewUserErrorLabel.Visible   = false;
            ClientsBL cbl = new ClientsBL();

            if (RadioButtonExist.Checked)
            {
                if (TextBoxID.Text != "") // Only If The Word Isnt Empty Do The Rest
                {
                    if (GeneralMethods.IsDigitsOnly(TextBoxID.Text))
                    {
                        if (!cbl.ClientExist(TextBoxID.Text))
                        {
                            ExistUserErrorLabel.Text    = "מספר הזהות שגוי או שאינו קיים במערכת";
                            ExistUserErrorLabel.Visible = true;
                            return(false);
                        }
                    }
                    else
                    {
                        ExistUserErrorLabel.Text    = "אנא הכנס ספרות בלבד בתעודת הזהות";
                        ExistUserErrorLabel.Visible = true;
                        return(false);
                    }
                }
                else
                {
                    ExistUserErrorLabel.Text    = "חובה להכניס תעודת זהות";
                    ExistUserErrorLabel.Visible = true;
                    return(false);
                }
            } // End Of Existing User

            else if (RadioButtonNew.Checked)
            {
                if (TextBoxID.Text != "" && TextBoxFName.Text != "" && TextBoxLName.Text != "" && TextBoxP1.Text != "")
                // Check If Id ,fName ,Lname And Phone1 TextBoxes Are Filled
                {
                    if (cbl.ClientExist(TextBoxID.Text))
                    {
                        NewUserErrorLabel.Text    = "מספר הזהות כבר קיים במערכת";
                        NewUserErrorLabel.Visible = true;
                        return(false);
                    }
                    else
                    {
                        if (!GeneralMethods.IsDigitsOnly(TextBoxID.Text) || !GeneralMethods.IsDigitsOnly(TextBoxP1.Text) || !GeneralMethods.IsDigitsOnly(TextBoxP2.Text) || !GeneralMethods.IsDigitsOnly(TextBoxP3.Text))
                        {
                            NewUserErrorLabel.Text    = "תעודת זהות ומספרי טלפון חייבים להכיל ספרות בלבד";
                            NewUserErrorLabel.Visible = true;
                            return(false);
                        }
                        else if (!((Regex.IsMatch(TextBoxFName.Text, @"^[a-zA-Z ]+$") && Regex.IsMatch(TextBoxLName.Text, @"^[a-zA-Z ]+$")) || (Regex.IsMatch(TextBoxFName.Text, @"^[א-ת ]+$") && Regex.IsMatch(TextBoxLName.Text, @"^[א-ת ]+$"))))// Check If Only Letters In The FirstName And LastNmae TextBoxes Hebrow And English
                        {
                            NewUserErrorLabel.Text    = "שם פרטי ומשפחה חייבים להכיל אותיות בלבד";
                            NewUserErrorLabel.Visible = true;
                            return(false);
                        }
                    }
                }
                else
                {
                    NewUserErrorLabel.Text    = "חובה למלא את השדות הבאים : תעודת זהות , שם פרטי , שם משפחה ושדה טלפון1 לפחות";
                    NewUserErrorLabel.Visible = true;
                    return(false);
                }
            }
            return(true);
        }
コード例 #20
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));
        }
コード例 #21
0
        public ActionResult Edit(AD_Clients cl, List <AD_ClientContacts> con, List <AD_ClientAddress> add)
        {
            Response res   = new Response();
            string   fname = string.Empty;

            try
            {
                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);
                    }
                }
                int       Id = 0;
                ClientsBL rb = new ClientsBL();
                cl.Logo = fname;
                Id      = rb.Manage("Update", cl);
                dbDataTable ddt = new dbDataTable();
                //DataTable dtcon = ddt.List();
                //foreach (var item in con)
                //{
                //    myDataTable.AddRow(dtcon, "Value1", item.ContactPerson, "Value2", item.Designation, "Value3", item.Gender, "Value4", item.Title, "Value5", item.ContactNo,
                //                        "Value6", item.ContactType, "Value7", item.IsPrimary, "Value8", Id, "Value9", item.UserId, "Value10", item.RegionId, "Value11", item.CityId, "Value12", item.IsActive, "Value13", item.ReportToId, "Value14",item.ContactId);
                //}
                //AD_ClientContactsDL ccb = new AD_ClientContactsDL();
                //AD_ClientContacts clobj = new AD_ClientContacts();
                //ccb.Manage("UpdateBulk", dtcon);

                DataTable dt = ddt.List();
                foreach (var item in add)
                {
                    if (item.Address != null || item.Address != "")
                    {
                        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, "Value10", item.AddressId);
                    }
                }
                AD_ClientAddressDL classaddress = new AD_ClientAddressDL();
                classaddress.Manage("UpdateBulk", dt);

                //res.Status = "success";
                // res.Message = "save successfully";
                TempData["msg_success"] = "Update successfully";
            }
            catch (Exception ex)
            {
                // res.Status = "danger";
                //  res.Message = ex.Message;
                TempData["msg_error"] = ex.Message;
            }
            return(RedirectToAction("Edit", new { @Id = cl.ClientId }));
            //Json(res, JsonRequestBehavior.AllowGet);
        }
コード例 #22
0
 public bool AddClient([FromBody] clientsEntity c)
 {
     return(ClientsBL.AddClient(c));
 }