Exemple #1
0
        private void UpdateServicePropertyNameWithTextbox(System.Windows.Controls.TextBox textBox)
        {
            if (LiveServiceInfo == null)
            {
                return;
            }
            LabServiceInfo liveService = textBox.DataContext as LabServiceInfo;

            if (liveService.ServiceInfo.ServiceFullName == textBox.Text)
            {
                return;
            }
            if (String.IsNullOrWhiteSpace(textBox.Text))
            {
                return;
            }

            DetailedOperationResult r = ServiceInfoManager.RenameService(liveService.ServiceInfo, textBox.Text);

            if (!r)
            {
                textBox.Text = liveService.ServiceInfo.ServiceFullName;
                MessageBox.Show(String.Format("Couldn't change service name.\n{0}", r.Reason), "Couldn't change service name", MessageBoxButton.OK, MessageBoxImage.Exclamation, MessageBoxResult.OK);
            }
        }
Exemple #2
0
        public string FillServiceInfo()
        {
            string             returnString        = "";
            ServiceInfoManager _ServiceInfoManager = new ServiceInfoManager();

            if (queryStringId != 0)
            {
                var    data = _ServiceInfoManager.GetAllBySSAId(queryStringId);
                string ServiceCategoryValue = ddlServiceCategory.SelectedItem.Value;
                int    ServiceCategoryId    = 0;
                if (int.TryParse(ServiceCategoryValue, out ServiceCategoryId) && ServiceCategoryId != 0)
                {
                    data = data.Where(w => w.ServiceCategoryId == ServiceCategoryId).ToList();
                }
                var returnData = (from obj in data
                                  select new
                {
                    Title = obj.Title,
                    Longitude = obj.Longitude,
                    Latitude = obj.Latitude,
                    ServiceCategory = obj.ServiceCategory.Name
                }).ToList();
                returnString = new JavaScriptSerializer().Serialize(returnData);
            }
            return(returnString);
        }
Exemple #3
0
        private void FillData()
        {
            ServiceInfoManager _ServiceInfoManager = new ServiceInfoManager();
            SSAManager         _SSAManager         = new SSAManager();
            var user = AspNetSecurityHelper.currentAppUser;

            if (user != null)
            {
                var obj = _ServiceInfoManager.GetAllServiceInfo();
                if (user.UserTypeId == 2) // Supervisor
                {
                    if (user.UniversityId.HasValue)
                    {
                        var ssa = _SSAManager.GetSSAByUniversityId(user.UniversityId.Value);
                        //var ssa = _SSAManager.GetSSAByAdministratorId(user.Id);
                        if (ssa != null)
                        {
                            obj = _ServiceInfoManager.GetAllBySSAId(ssa.Id);
                        }
                        else
                        {
                            obj = null;
                        }
                    }
                }
                if (obj != null)
                {
                    var data = from tbl in obj
                               select new
                    {
                        tbl.Id,
                        tbl.Title,
                        tbl.Description,
                        tbl.Section,
                        tbl.Address,
                        ServiceCategory     = tbl.ServiceCategory.Name,
                        SSA                 = (String.IsNullOrEmpty(tbl.SaudiStudentAssociation.Name) ? "" : tbl.SaudiStudentAssociation.Name + " - ") + tbl.SaudiStudentAssociation.University.Name + (tbl.SaudiStudentAssociation.State != null ? " - " + tbl.SaudiStudentAssociation.State.Name : "") + (tbl.SaudiStudentAssociation.City != null ? " - " + tbl.SaudiStudentAssociation.City.Name : ""),
                        ssaId               = tbl.SaudiStudentAssociationId,
                        ServiceDetailsCount = tbl.ServiceDetails.Where(w => w.DeletedFlag == false).Count()
                    };
                    string ssa   = ddlSSA.SelectedValue;
                    int    ssaId = 0;
                    if (int.TryParse(ssa, out ssaId) && ssaId != 0)
                    {
                        data = data.Where(w => w.ssaId == ssaId).ToList();
                    }
                    GridView1.DataSource = data.ToList();
                }
            }
            GridView1.DataBind();
        }
Exemple #4
0
        private void FillData()
        {
            if (!String.IsNullOrEmpty(queryStringIdStr))
            {
                ServiceInfoManager _ServiceInfoManager = new ServiceInfoManager();
                var obj = _ServiceInfoManager.GetServiceInfo(queryStringId);
                if (obj != null)
                {
                    txtTitle.Text       = obj.Title;
                    txtDescription.Text = obj.Description.Replace("<br/>", "\r\n");
                    txtSection.Text     = obj.Section;
                    txtAddress.Text     = obj.Address.Replace("<br/>", "\r\n");

                    string lat = obj.Latitude;
                    string lng = obj.Longitude;

                    if (!String.IsNullOrEmpty(lat) && !String.IsNullOrEmpty(lng))
                    {
                        ucLocation.Lat = lat;
                        ucLocation.Lng = lng;
                    }

                    if (obj.SaudiStudentAssociationId.HasValue)
                    {
                        ddlSSA.Items.FindByValue(obj.SaudiStudentAssociationId.Value.ToString()).Selected = true;
                    }

                    if (obj.ServiceCategoryId.HasValue)
                    {
                        ddlServiceCategory.Items.FindByValue(obj.ServiceCategoryId.Value.ToString()).Selected = true;
                    }

                    Operation = (String)GetGlobalResourceObject("HCMResource", "UpdateExisting");
                }
                else
                {
                    Operation       = (String)GetGlobalResourceObject("HCMResource", "AddNew");
                    ucLocation.Lat  = "36.63209344924568";
                    ucLocation.Lng  = "-101.74928646693019";
                    ucLocation.Zoom = 5;
                }
            }
            else
            {
                Operation       = (String)GetGlobalResourceObject("HCMResource", "AddNew");
                ucLocation.Lat  = "36.63209344924568";
                ucLocation.Lng  = "-101.74928646693019";
                ucLocation.Zoom = 5;
            }
        }
Exemple #5
0
        private void FillData()
        {
            SSAManager _SSAManager = new SSAManager();
            var        obj         = _SSAManager.GetAllSSA();

            if (obj != null)
            {
                var data = from tbl in obj
                           where tbl.DeletedFlag == false
                           select new
                {
                    tbl.Id,
                    tbl.Name,
                    University = (tbl.University != null ? tbl.University.Name : ""),
                    State      = (tbl.State != null ? tbl.State.Name : ""),
                    City       = (tbl.City != null ? tbl.City.Name : ""),
                    tbl.ZipCode,
                    tbl.Phone,
                    tbl.Fax,
                    tbl.Email,
                    tbl.Website,
                    tbl.SocialInfo,
                    tbl.Street,
                    ServiceCount = tbl.ServiceInformations.Where(w => w.DeletedFlag == false).Count()
                };
                //rptdata.DataSource = data;
                AssCount = obj.Count().ToString();
            }
            else
            {
                AssCount = "0";
            }
            //rptdata.DataBind();

            ServiceInfoManager _ServiceInfoManager = new ServiceInfoManager();
            var svc = _ServiceInfoManager.GetAllServiceInfo().Where(w => w.DeletedFlag == false);

            if (svc != null)
            {
                SvcInfoCount = svc.Count().ToString();
            }
            else
            {
                SvcInfoCount = "0";
            }
        }
        protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            string             un = AspNetSecurityHelper.GetCurrentUserName;
            ServiceInfoManager _ServiceInfoManager = new ServiceInfoManager();

            if (e.CommandName == "Details")
            {
                string Id = e.CommandArgument.ToString();
                int    id = 0;
                if (int.TryParse(Id, out id) && id != 0)
                {
                    ucServiceDetails.Visible   = true;
                    ucServiceDetails.svcInfoId = id;
                    ucServiceDetails.FillServiceDetails();
                    FillServiceInfo();
                }
            }
        }
Exemple #7
0
        protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            string             un = AspNetSecurityHelper.GetCurrentUserName;
            ServiceInfoManager _ServiceInfoManager = new ServiceInfoManager();

            if (e.CommandName == "DeleteUpdate")
            {
                string Id = e.CommandArgument.ToString();
                int    id = 0;
                if (int.TryParse(Id, out id))
                {
                    bool chk = _ServiceInfoManager.CheckCanDeleted(id);
                    if (chk)
                    {
                        string operation = (String)GetGlobalResourceObject("HCMResource", "Delete");
                        int    i         = 0;//_ServiceInfoManager.DeleteServiceInfo(id);
                        DAL.Entity.ServiceInformation obj = _ServiceInfoManager.GetServiceInfo(id);
                        if (obj != null)
                        {
                            obj.DeletedFlag     = true;
                            obj.LastUpdatedBy   = un;
                            obj.LastUpdatedDate = DateTime.Now;
                            i = _ServiceInfoManager.UpdateServiceInfo(obj);
                        }
                        if (i != 0)
                        {
                            ucAlertMessage.AlertMessage(String.Format((String)GetGlobalResourceObject("HCMResource", "OperationSuccess"), operation), "", Common.msgType.alertMessageSuccess);
                        }
                        else
                        {
                            ucAlertMessage.AlertMessage(String.Format((String)GetGlobalResourceObject("HCMResource", "OperationError"), operation), "", Common.msgType.alertMessageDanger);
                        }
                    }
                    else
                    {
                        ucAlertMessage.AlertMessage((String)GetGlobalResourceObject("HCMResource", "CantDelete"), "", Common.msgType.alertMessageDanger);
                    }
                    FillData();
                }
            }
        }
        public void FillServiceInfo()
        {
            ServiceInfoManager _ServiceInfoManager = new ServiceInfoManager();

            if (queryStringId != 0)
            {
                var    data = _ServiceInfoManager.GetAllBySSAId(queryStringId);
                string ServiceCategoryValue = ddlServiceCategory.SelectedItem.Value;
                int    ServiceCategoryId    = 0;
                if (int.TryParse(ServiceCategoryValue, out ServiceCategoryId) && ServiceCategoryId != 0)
                {
                    data = data.Where(w => w.ServiceCategoryId == ServiceCategoryId).ToList();
                }
                var returnData = (from obj in data
                                  select new
                {
                    Id = obj.Id,
                    Title = obj.Title,
                    Description = obj.Description,
                    Section = obj.Section,
                    Address = obj.Address,
                    Longitude = obj.Longitude,
                    Latitude = obj.Latitude,
                    ServiceCategory = obj.ServiceCategory.Name,
                    ServiceDetailsCount = obj.ServiceDetails.Where(w => w.DeletedFlag == false).Count()
                }).ToList();
                GridView1.DataSource = returnData;

                var locationData = (from obj in returnData
                                    select new
                {
                    obj.Title,
                    obj.Longitude,
                    obj.Latitude,
                    obj.ServiceCategory
                }).ToList();
                ucLocationsMap.Locations = new JavaScriptSerializer().Serialize(locationData);
            }
            GridView1.DataBind();
        }
        private void FillData()
        {
            SSAManager         _SSAManager         = new SSAManager();
            ServiceInfoManager _ServiceInfoManager = new ServiceInfoManager();
            string             str = txtSearch.Text;

            if (!String.IsNullOrEmpty(str))
            {
                using (HajjCrawdsMngEntities cntx = new HajjCrawdsMngEntities())
                {
                    var obj = (from m in cntx.SaudiStudentAssociations
                               join d in cntx.ServiceInformations
                               on m.Id equals d.SaudiStudentAssociationId
                               where (m.Name.Contains(str)) || (m.Email.Contains(str)) || (m.SocialInfo.Contains(str)) ||
                               (m.State != null && m.State.Name.Contains(str)) ||
                               (m.City != null && m.City.Name.Contains(str)) ||
                               (m.University != null && m.University.Name.Contains(str)) ||
                               (d != null && d.ServiceCategory != null && d.ServiceCategory.Name.Contains(str)) ||
                               (d != null && d.Title.Contains(str))
                               select new
                    {
                        Id = m.Id,
                        Name = m.Name,
                        University = m.University.Name,
                        State = m.State.Name,
                        City = m.City.Name,
                        m.ZipCode,
                        ServiceCount = m.ServiceInformations.Where(w => w.DeletedFlag == false).Count()
                    }).Distinct().ToList();
                    if (obj != null)
                    {
                        rptdata.DataSource = obj;
                    }
                }
            }
            rptdata.DataBind();
        }
Exemple #10
0
        private void FillData()
        {
            ServiceDetailsManager _ServiceDetailsManager = new ServiceDetailsManager();
            ServiceInfoManager    _ServiceInfoManager    = new ServiceInfoManager();
            SSAManager            _SSAManager            = new SSAManager();
            var user = AspNetSecurityHelper.currentAppUser;

            if (user != null)
            {
                sessionId = queryStringId;
                var mster = _ServiceInfoManager.GetServiceInfo(queryStringId);
                var obj   = _ServiceDetailsManager.GetAllByServiceInfoId(queryStringId);
                if (mster != null)
                {
                    lblSSA.Text         = mster.SaudiStudentAssociation.Name;
                    lblServiceInfo.Text = mster.Title;
                }
                if (obj != null)
                {
                    var data = from tbl in obj
                               select new
                    {
                        tbl.Id,
                        tbl.InfoTypeId,
                        tbl.FileExt,
                        InfoType = tbl.InfoType.Name,
                        tbl.InformationContent,
                        svcInfoId = tbl.ServiceInformationId,
                        SSA       = tbl.ServiceInformation.SaudiStudentAssociation.Name,
                        SvcInfo   = tbl.ServiceInformation.Title
                    };
                    GridView1.DataSource = data.ToList();
                }
            }
            GridView1.DataBind();
        }
Exemple #11
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            var user = AspNetSecurityHelper.currentAppUser;

            if (user != null)
            {
                ServiceInfoManager _ServiceInfoManager = new ServiceInfoManager();
                SSAManager         _SSAManager         = new SSAManager();

                DAL.Entity.ServiceInformation obj = _ServiceInfoManager.GetServiceInfo(queryStringId);
                if (obj == null)
                {
                    obj = new DAL.Entity.ServiceInformation();
                }

                obj.Title       = txtTitle.Text;
                obj.Description = txtDescription.Text.Replace("\r\n", "<br/>");
                obj.Section     = txtSection.Text;
                obj.Address     = txtAddress.Text.Replace("\r\n", "<br/>");

                string lat = ucLocation.Lat;
                string lng = ucLocation.Lng;

                if (!String.IsNullOrEmpty(lat) && !String.IsNullOrEmpty(lng))
                {
                    obj.Latitude  = lat;
                    obj.Longitude = lng;
                }

                int cat = 0;
                if (int.TryParse(ddlServiceCategory.SelectedValue, out cat) && cat != 0)
                {
                    obj.ServiceCategoryId = cat;
                }

                if (user.UserTypeId == 2) // Supervisor
                {
                    if (user.UniversityId.HasValue)
                    {
                        var ssa = _SSAManager.GetSSAByUniversityId(user.UniversityId.Value);
                        if (ssa != null)
                        {
                            obj.SaudiStudentAssociationId = ssa.Id;
                        }
                    }
                }
                else // Administrator
                {
                    string SSA = ddlSSA.SelectedValue;
                    int    ssa = 0;
                    if (int.TryParse(SSA, out ssa) && ssa != 0)
                    {
                        obj.SaudiStudentAssociationId = ssa;
                    }
                }

                int i = 0;
                if (obj.Id == 0)
                {
                    obj.CreatedBy   = user.UserName;
                    obj.CreatedDate = DateTime.Now;
                    obj.DeletedFlag = false;
                    i               = _ServiceInfoManager.AddServiceInfo(obj);
                    Operation       = (String)GetGlobalResourceObject("HCMResource", "Add");
                    btnSave.Visible = false;
                }
                else
                {
                    obj.LastUpdatedBy   = user.UserName;
                    obj.LastUpdatedDate = DateTime.Now;
                    i         = _ServiceInfoManager.UpdateServiceInfo(obj);
                    Operation = (String)GetGlobalResourceObject("HCMResource", "Update");
                }
                if (i != 0)
                {
                    ucAlertMessage.AlertMessage(String.Format((String)GetGlobalResourceObject("HCMResource", "OperationSuccess"), Operation), "", Common.msgType.alertMessageSuccess);
                    FillData();
                }
                else
                {
                    ucAlertMessage.AlertMessage(String.Format((String)GetGlobalResourceObject("HCMResource", "OperationError"), Operation), "", Common.msgType.alertMessageDanger);
                }
            }
            else
            {
                Response.Redirect("/");
            }
        }