예제 #1
0
        public CommunityResource GetServiceData(string Agencyid, CommunityResource communityInfo = null)
        {
            CommunityResource Info = new CommunityResource();

            try
            {
                DataSet ds = null;
                using (SqlConnection Connection = connection.returnConnection())
                {
                    using (SqlCommand command = new SqlCommand())
                    {
                        ds = new DataSet();
                        command.Connection  = Connection;
                        command.CommandText = "Sp_Sel_Service_Dropdowndata";
                        command.Parameters.AddWithValue("@AgencyId", Agencyid);
                        command.CommandType = CommandType.StoredProcedure;
                        SqlDataAdapter da = new SqlDataAdapter(command);
                        da.Fill(ds);
                    }
                    try
                    {
                        List <CommunityResource.CategoryServiceInfo>           Services    = new List <CommunityResource.CategoryServiceInfo>();
                        List <FingerprintsModel.CommunityResource.ServiceInfo> listservice = null;
                        DataTable dv = ds.Tables[0].DefaultView.ToTable(true, "Category");
                        for (int i = 0; i < dv.Rows.Count; i++)
                        {
                            DataRow[] drs = ds.Tables[0].Select("Category=" + dv.Rows[i]["Category"].ToString());
                            CommunityResource.CategoryServiceInfo           obj = new CommunityResource.CategoryServiceInfo();
                            FingerprintsModel.CommunityResource.ServiceInfo objservice;
                            obj.CategoryName = drs[0]["Description"].ToString();
                            obj.CategoryId   = drs[0]["Category"].ToString();
                            listservice      = new List <FingerprintsModel.CommunityResource.ServiceInfo>();
                            foreach (DataRow dr in drs)
                            {
                                objservice      = new FingerprintsModel.CommunityResource.ServiceInfo();
                                objservice.Id   = Convert.ToInt32(dr["ServiceID"]);
                                objservice.Name = dr["Services"].ToString();
                                listservice.Add(objservice);
                            }
                            obj.ServiceInfoDetail = listservice;
                            Services.Add(obj);
                        }
                        if (ds.Tables[1] != null && ds.Tables[1].Rows.Count > 0)
                        {
                            List <HrCenterInfo> centerList = new List <HrCenterInfo>();
                            foreach (DataRow dr in ds.Tables[1].Rows)
                            {
                                HrCenterInfo obj = new HrCenterInfo();
                                obj.CenterId  = dr["CenterId"].ToString();
                                obj.Name      = dr["CenterName"].ToString();
                                obj.Homebased = Convert.ToBoolean(dr["HomeBased"].ToString());

                                centerList.Add(obj);
                            }
                            Info.HrcenterList = centerList;
                        }


                        Info.AvailableService = Services;
                    }
                    catch (Exception ex)
                    {
                        clsError.WriteException(ex);
                    }
                }
            }
            catch (Exception ex)
            {
                clsError.WriteException(ex);
            }
            return(Info);
        }
예제 #2
0
        public CommunityResource GetcommunityDetails(string CommunityId, string AgencyId)
        {
            CommunityResource obj = new CommunityResource();

            try
            {
                if (Connection.State == ConnectionState.Open)
                {
                    Connection.Close();
                }

                command.Parameters.Clear();
                command.Parameters.Add(new SqlParameter("@CommunityId", CommunityId));
                command.Parameters.Add(new SqlParameter("@AgencyId", AgencyId));
                command.Connection  = Connection;
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "SP_communityinfo";
                Connection.Open();
                DataAdapter = new SqlDataAdapter(command);
                _dataset    = new DataSet();
                DataAdapter.Fill(_dataset);
                Connection.Close();
                if (_dataset != null && _dataset.Tables[0].Rows.Count > 0)
                {
                    obj.CommunityID = Convert.ToInt32(_dataset.Tables[0].Rows[0]["ID"]);
                    obj.Fname       = _dataset.Tables[0].Rows[0]["Fname"].ToString();
                    obj.Lname       = _dataset.Tables[0].Rows[0]["Lname"].ToString();
                    obj.CreatedDate = Convert.ToDateTime(_dataset.Tables[0].Rows[0]["DateEntered"]).ToString("MM/dd/yyyy");
                    obj.Companyname = _dataset.Tables[0].Rows[0]["CompanyName"].ToString();
                    if (!string.IsNullOrEmpty(_dataset.Tables[0].Rows[0]["Community"].ToString()))
                    {
                        obj.Community = _dataset.Tables[0].Rows[0]["Community"].ToString();
                    }
                    else
                    {
                        obj.Community = string.Empty;
                    }
                    if (!string.IsNullOrEmpty(_dataset.Tables[0].Rows[0]["Region"].ToString()))
                    {
                        obj.Region = _dataset.Tables[0].Rows[0]["Region"].ToString();
                    }
                    else
                    {
                        obj.Region = string.Empty;
                    }
                    if (!string.IsNullOrEmpty(_dataset.Tables[0].Rows[0]["Title"].ToString()))
                    {
                        obj.Title = _dataset.Tables[0].Rows[0]["Title"].ToString();
                    }
                    else
                    {
                        obj.Title = string.Empty;
                    }
                    if (!string.IsNullOrEmpty(_dataset.Tables[0].Rows[0]["Address"].ToString()))
                    {
                        obj.Address = Convert.ToString(_dataset.Tables[0].Rows[0]["Address"]);
                    }
                    else
                    {
                        obj.Address = string.Empty;
                    }
                    if (!string.IsNullOrEmpty(_dataset.Tables[0].Rows[0]["City"].ToString()))
                    {
                        obj.City = Convert.ToString(_dataset.Tables[0].Rows[0]["City"]);
                    }
                    else
                    {
                        obj.City = string.Empty;
                    }
                    if (!string.IsNullOrEmpty(_dataset.Tables[0].Rows[0]["State"].ToString()))
                    {
                        obj.State = Convert.ToString(_dataset.Tables[0].Rows[0]["State"]);
                    }
                    else
                    {
                        obj.State = string.Empty;
                    }
                    if (!string.IsNullOrEmpty(_dataset.Tables[0].Rows[0]["County"].ToString()))
                    {
                        obj.County = Convert.ToString(_dataset.Tables[0].Rows[0]["County"]);
                    }
                    else
                    {
                        obj.County = string.Empty;
                    }
                    if (!string.IsNullOrEmpty(_dataset.Tables[0].Rows[0]["Email"].ToString()))
                    {
                        obj.Email = Convert.ToString(_dataset.Tables[0].Rows[0]["Email"]);
                    }
                    else
                    {
                        obj.Email = string.Empty;
                    }
                    if (!string.IsNullOrEmpty(_dataset.Tables[0].Rows[0]["Comments"].ToString()))
                    {
                        obj.Comments = Convert.ToString(_dataset.Tables[0].Rows[0]["Comments"]);
                    }
                    else
                    {
                        obj.Comments = string.Empty;
                    }
                    if (!string.IsNullOrEmpty(_dataset.Tables[0].Rows[0]["PhoneNo"].ToString()))
                    {
                        obj.Phoneno = Convert.ToString(_dataset.Tables[0].Rows[0]["PhoneNo"]);
                    }
                    else
                    {
                        obj.Phoneno = string.Empty;
                    }

                    obj.ZipCode = Convert.ToInt32(_dataset.Tables[0].Rows[0]["ZipCode"]);
                    if (!DBNull.Value.Equals(_dataset.Tables[0].Rows[0]["Office24Hours"]))
                    {
                        obj.office24hours = Convert.ToBoolean(_dataset.Tables[0].Rows[0]["Office24Hours"]);
                    }
                    else
                    {
                        obj.office24hours = false;
                    }
                    if (!DBNull.Value.Equals(_dataset.Tables[0].Rows[0]["MonOffice"]))
                    {
                        obj.Mon = Convert.ToBoolean(_dataset.Tables[0].Rows[0]["MonOffice"]);
                    }
                    else
                    {
                        obj.Mon = false;
                    }
                    if (!DBNull.Value.Equals(_dataset.Tables[0].Rows[0]["TueOffice"]))
                    {
                        obj.Tue = Convert.ToBoolean(_dataset.Tables[0].Rows[0]["TueOffice"]);
                    }
                    else
                    {
                        obj.Tue = false;
                    }
                    if (!DBNull.Value.Equals(_dataset.Tables[0].Rows[0]["WedOffice"]))
                    {
                        obj.Wed = Convert.ToBoolean(_dataset.Tables[0].Rows[0]["WedOffice"]);
                    }
                    else
                    {
                        obj.Wed = false;
                    }
                    if (!DBNull.Value.Equals(_dataset.Tables[0].Rows[0]["ThursOffice"]))
                    {
                        obj.Thurs = Convert.ToBoolean(_dataset.Tables[0].Rows[0]["ThursOffice"]);
                    }
                    else
                    {
                        obj.Thurs = false;
                    }
                    if (!DBNull.Value.Equals(_dataset.Tables[0].Rows[0]["FriOffice"]))
                    {
                        obj.Fri = Convert.ToBoolean(_dataset.Tables[0].Rows[0]["FriOffice"]);
                    }
                    else
                    {
                        obj.Fri = false;
                    }
                    if (!DBNull.Value.Equals(_dataset.Tables[0].Rows[0]["SatOffice"]))
                    {
                        obj.Sat = Convert.ToBoolean(_dataset.Tables[0].Rows[0]["SatOffice"]);
                    }
                    else
                    {
                        obj.Sat = false;
                    }
                    if (!DBNull.Value.Equals(_dataset.Tables[0].Rows[0]["SunOffice"]))
                    {
                        obj.Sun = Convert.ToBoolean(_dataset.Tables[0].Rows[0]["SunOffice"]);
                    }
                    else
                    {
                        obj.Sun = false;
                    }
                    if (!DBNull.Value.Equals((_dataset.Tables[0].Rows[0]["MonTo"])))
                    {
                        obj.MonTo = _dataset.Tables[0].Rows[0]["MonTo"].ToString();
                    }
                    else
                    {
                        obj.MonTo = string.Empty;
                    }
                    if (!DBNull.Value.Equals((_dataset.Tables[0].Rows[0]["MonFrom"])))
                    {
                        obj.MonFrom = _dataset.Tables[0].Rows[0]["MonFrom"].ToString();
                    }
                    else
                    {
                        obj.MonFrom = string.Empty;
                    }
                    if (!DBNull.Value.Equals((_dataset.Tables[0].Rows[0]["TueTo"])))
                    {
                        obj.TueTo = _dataset.Tables[0].Rows[0]["TueTo"].ToString();
                    }
                    else
                    {
                        obj.TueTo = string.Empty;
                    }
                    if (!DBNull.Value.Equals((_dataset.Tables[0].Rows[0]["TueFrom"])))
                    {
                        obj.TueFrom = _dataset.Tables[0].Rows[0]["TueFrom"].ToString();
                    }
                    else
                    {
                        obj.TueFrom = string.Empty;
                    }
                    if (!DBNull.Value.Equals((_dataset.Tables[0].Rows[0]["WedTo"])))
                    {
                        obj.WedTo = _dataset.Tables[0].Rows[0]["WedTo"].ToString();
                    }
                    else
                    {
                        obj.WedTo = string.Empty;
                    }
                    if (!DBNull.Value.Equals((_dataset.Tables[0].Rows[0]["WedFrom"])))
                    {
                        obj.WedFrom = _dataset.Tables[0].Rows[0]["WedFrom"].ToString();
                    }
                    else
                    {
                        obj.WedFrom = string.Empty;
                    }
                    if (!DBNull.Value.Equals((_dataset.Tables[0].Rows[0]["ThursTo"])))
                    {
                        obj.ThursTo = _dataset.Tables[0].Rows[0]["ThursTo"].ToString();
                    }
                    else
                    {
                        obj.ThursTo = string.Empty;
                    }
                    if (!DBNull.Value.Equals((_dataset.Tables[0].Rows[0]["ThursFrom"])))
                    {
                        obj.ThursFrom = _dataset.Tables[0].Rows[0]["ThursFrom"].ToString();
                    }
                    else
                    {
                        obj.ThursFrom = string.Empty;
                    }
                    if (!DBNull.Value.Equals((_dataset.Tables[0].Rows[0]["FriTo"])))
                    {
                        obj.FriTo = _dataset.Tables[0].Rows[0]["FriTo"].ToString();
                    }
                    else
                    {
                        obj.FriTo = string.Empty;
                    }
                    if (!DBNull.Value.Equals((_dataset.Tables[0].Rows[0]["FriFrom"])))
                    {
                        obj.FriFrom = _dataset.Tables[0].Rows[0]["FriFrom"].ToString();
                    }
                    else
                    {
                        obj.FriFrom = string.Empty;
                    }
                    if (!DBNull.Value.Equals((_dataset.Tables[0].Rows[0]["SatTo"])))
                    {
                        obj.SatTo = _dataset.Tables[0].Rows[0]["SatTo"].ToString();
                    }
                    else
                    {
                        obj.SatTo = string.Empty;
                    }
                    if (!DBNull.Value.Equals((_dataset.Tables[0].Rows[0]["SatFrom"])))
                    {
                        obj.SatFrom = _dataset.Tables[0].Rows[0]["SatFrom"].ToString();
                    }
                    else
                    {
                        obj.SatFrom = string.Empty;
                    }
                    if (!DBNull.Value.Equals((_dataset.Tables[0].Rows[0]["SunTo"])))
                    {
                        obj.SunTo = _dataset.Tables[0].Rows[0]["SunTo"].ToString();
                    }
                    else
                    {
                        obj.SunTo = string.Empty;
                    }
                    if (!DBNull.Value.Equals((_dataset.Tables[0].Rows[0]["SunFrom"])))
                    {
                        obj.SunFrom = _dataset.Tables[0].Rows[0]["SunFrom"].ToString();
                    }
                    else
                    {
                        obj.SunFrom = string.Empty;
                    }
                    if (!DBNull.Value.Equals((_dataset.Tables[0].Rows[0]["Gender"])))
                    {
                        obj.gender = Convert.ToInt32(_dataset.Tables[0].Rows[0]["Gender"].ToString());
                    }
                    else
                    {
                        obj.gender = 0;
                    }
                    //Added by Akansha on 14Dec2016
                    if (!string.IsNullOrEmpty(_dataset.Tables[0].Rows[0]["MedicalCenter"].ToString()))
                    {
                        obj.MedicalCenter = _dataset.Tables[0].Rows[0]["MedicalCenter"].ToString();
                    }
                    else
                    {
                        obj.MedicalCenter = string.Empty;
                    }
                    if (!string.IsNullOrEmpty(_dataset.Tables[0].Rows[0]["DentalCenter"].ToString()))
                    {
                        obj.DentalCenter = _dataset.Tables[0].Rows[0]["DentalCenter"].ToString();
                    }
                    else
                    {
                        obj.DentalCenter = string.Empty;
                    }

                    if (!string.IsNullOrEmpty(_dataset.Tables[0].Rows[0]["OtherCenter"].ToString()))
                    {
                        obj.OtherCenter = _dataset.Tables[0].Rows[0]["OtherCenter"].ToString();
                    }
                    else
                    {
                        obj.OtherCenter = string.Empty;
                    }
                    if (!string.IsNullOrEmpty(_dataset.Tables[0].Rows[0]["MedicalNotes"].ToString()))
                    {
                        obj.MedicalNotes = _dataset.Tables[0].Rows[0]["MedicalNotes"].ToString();
                    }
                    else
                    {
                        obj.MedicalNotes = string.Empty;
                    }
                    if (!string.IsNullOrEmpty(_dataset.Tables[0].Rows[0]["DentalNotes"].ToString()))
                    {
                        obj.DentalNotes = _dataset.Tables[0].Rows[0]["DentalNotes"].ToString();
                    }
                    else
                    {
                        obj.DentalNotes = string.Empty;
                    }

                    if (!string.IsNullOrEmpty(_dataset.Tables[0].Rows[0]["OtherNotes"].ToString()))
                    {
                        obj.OtherNotes = _dataset.Tables[0].Rows[0]["OtherNotes"].ToString();
                    }
                    else
                    {
                        obj.OtherNotes = string.Empty;
                    }
                    //End


                    if (_dataset.Tables[1] != null && _dataset.Tables[1].Rows.Count > 0)
                    {
                        List <CommunityResource.CategoryServiceInfo> Services             = new List <CommunityResource.CategoryServiceInfo>();
                        List <CommunityResource.ServiceInfo>         ServicedetailRecords = new List <CommunityResource.ServiceInfo>();
                        CommunityResource.CategoryServiceInfo        objService           = new CommunityResource.CategoryServiceInfo();
                        CommunityResource.ServiceInfo obj1;
                        foreach (DataRow dr in _dataset.Tables[1].Rows)
                        {
                            obj1    = new CommunityResource.ServiceInfo();
                            obj1.Id = Convert.ToInt32(dr["Services"]);
                            ServicedetailRecords.Add(obj1);
                        }
                        objService.ServiceInfoDetail = ServicedetailRecords;
                        Services.Add(objService);
                        obj.AvailableService = Services;
                    }
                    if (_dataset.Tables[2] != null && _dataset.Tables[2].Rows.Count > 0)
                    {
                        List <HrCenterInfo> centerList = new List <HrCenterInfo>();
                        foreach (DataRow dr in _dataset.Tables[2].Rows)
                        {
                            HrCenterInfo center = new HrCenterInfo();
                            center.CenterId = dr["CenterId"].ToString();
                            centerList.Add(center);
                        }
                        obj.HrcenterList = centerList;
                    }
                }


                return(obj);
            }
            catch (Exception ex)
            {
                clsError.WriteException(ex);
                return(obj);
            }
            finally
            {
                DataAdapter.Dispose();
                command.Dispose();
                _dataset.Dispose();
            }
        }