Example #1
0
        //added by Akansha on 15Dec2016
        public CommunityResource GetCommunityInfo(string community, string agenycyid)
        {
            //  List<AgencyStaff> _agencyStafflist = new List<AgencyStaff>();
            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_Get_CommunityInfo_Dropdowndata";
                        command.CommandType = CommandType.StoredProcedure;
                        command.Parameters.Add(new SqlParameter("@agenycyid", agenycyid));
                        command.Parameters.Add(new SqlParameter("@community", community));//Added by Akansha
                        SqlDataAdapter da = new SqlDataAdapter(command);
                        da.Fill(ds);
                    }
                    try
                    {
                        List <FingerprintsModel.CommunityResource.DoctorInfo> _doctorlist = new List <FingerprintsModel.CommunityResource.DoctorInfo>();
                        foreach (DataRow dr in ds.Tables[0].Rows)
                        {
                            FingerprintsModel.CommunityResource.DoctorInfo obj = new FingerprintsModel.CommunityResource.DoctorInfo();
                            obj.Id   = dr["Id"].ToString();
                            obj.Name = dr["Center"].ToString();
                            _doctorlist.Add(obj);
                        }
                        //  _rolelist.Insert(0, new Role() { RoleId = "0", RoleName = "Select" });
                        Info.doctorList = _doctorlist;
                    }
                    catch (Exception ex)
                    {
                        clsError.WriteException(ex);
                    }
                }
            }
            catch (Exception ex)
            {
                clsError.WriteException(ex);
            }
            return(Info);
        }
Example #2
0
        //Changes on 1Feb2017
        public string AddCommunityAjax(CommunityResource Info, string Fname, string Lname, string CompanyName, string Address, string Zip, string Phoneno,
                                       string City, string State, string County, string userId, string AgencyId, string mode, string Community, string DentalCenter, string DentalNotes, string MedicalNotes, string MedicalCenter, string CompanyNameden, string DocCheck, string DenCheck)
        {
            try
            {
                command.Connection  = Connection;
                command.CommandText = "SP_addcommunity";
                command.Parameters.AddWithValue("@mode", mode);
                command.Parameters.AddWithValue("@CommunityID", Info.CommunityID);
                command.Parameters.AddWithValue("@AgencyId", AgencyId);
                command.Parameters.AddWithValue("@Community", Community);
                //command.Parameters.AddWithValue("@Title", Title);
                command.Parameters.AddWithValue("@Fname", Fname);
                command.Parameters.AddWithValue("@Lname", Lname);
                if (Community == "1")
                {
                    command.Parameters.AddWithValue("@CompanyName", CompanyName);
                }
                else if (Community == "2")
                {
                    command.Parameters.AddWithValue("@CompanyName", CompanyNameden);
                }
                command.Parameters.AddWithValue("@Address", Address);
                command.Parameters.AddWithValue("@ZipCode", Zip);
                command.Parameters.AddWithValue("@Phoneno", Phoneno);
                command.Parameters.AddWithValue("@City", City);
                command.Parameters.AddWithValue("@State", State);
                command.Parameters.AddWithValue("@County", County);
                //command.Parameters.AddWithValue("@Notes", Notes);
                command.Parameters.AddWithValue("@CreatedBy", userId);
                //Added by Akansha on 14Dec2016
                command.Parameters.AddWithValue("@DentalCenter", DentalCenter);
                command.Parameters.AddWithValue("@DentalNotes", DentalNotes);
                command.Parameters.AddWithValue("@MedicalNotes", MedicalNotes);
                command.Parameters.AddWithValue("@MedicalCenter", MedicalCenter);
                command.Parameters.AddWithValue("@DocCheck", DocCheck);
                command.Parameters.AddWithValue("@DenCheck", DenCheck);

                //End
                command.Parameters.AddWithValue("@result", "").Direction = ParameterDirection.Output;
                command.CommandType = CommandType.StoredProcedure;
                _dataset            = new DataSet();
                SqlDataAdapter da = new SqlDataAdapter(command);
                da.Fill(_dataset);
                try
                {
                    List <FingerprintsModel.CommunityResource.DoctorInfo> _doctorlist = new List <FingerprintsModel.CommunityResource.DoctorInfo>();
                    //if (_dataset.Tables[0] != null && _dataset.Tables[0].Rows.Count > 0)
                    //    foreach (DataRow dr in _dataset.Tables[0].Rows)
                    //    {
                    //        FingerprintsModel.CommunityResource.DoctorInfo obj = new FingerprintsModel.CommunityResource.DoctorInfo();
                    //        obj.Id = dr["Id"].ToString();
                    //        //obj.Name = dr["DoctorName"].ToString();
                    //        //  if (obj.Community == "1")
                    //        obj.Community = dr["Community"].ToString();
                    //        if (obj.Community == "1")
                    //        {
                    //            obj.Name = dr["MedicalCenter"].ToString();
                    //        }
                    //        if (obj.Community == "2")
                    //        {
                    //            obj.Name = dr["DentalCenter"].ToString();
                    //        }
                    //        _doctorlist.Add(obj);
                    //    }
                    if (string.IsNullOrEmpty(Community))
                    {
                        if (_dataset.Tables[0] != null)
                        {
                            if (_dataset.Tables[0].Rows.Count > 0)
                            {
                                foreach (DataRow dr in _dataset.Tables[0].Rows)
                                {
                                    FingerprintsModel.CommunityResource.DoctorInfo obj = new FingerprintsModel.CommunityResource.DoctorInfo();
                                    obj.Id = dr["Id"].ToString();
                                    //obj.Name = dr["DoctorName"].ToString();
                                    //  if (obj.Community == "1")
                                    obj.Community = dr["Community"].ToString();
                                    if (obj.Community == "1")
                                    {
                                        obj.Name = dr["DoctorName"].ToString();
                                    }

                                    _doctorlist.Add(obj);
                                }
                            }
                        }
                    }

                    else if (_dataset.Tables[1] != null)
                    {
                        if (_dataset.Tables[1].Rows.Count > 0)
                        {
                            if (Community == "1")
                            {
                                foreach (DataRow dr in _dataset.Tables[1].Rows)
                                {
                                    FingerprintsModel.CommunityResource.DoctorInfo obj = new FingerprintsModel.CommunityResource.DoctorInfo();
                                    obj.Id = dr["Id"].ToString();
                                    //obj.Name = dr["DoctorName"].ToString();
                                    //  if (obj.Community == "1")
                                    obj.Community = dr["Community"].ToString();
                                    if (obj.Community == "1")
                                    {
                                        obj.Name = dr["DoctorName"].ToString();
                                    }

                                    _doctorlist.Add(obj);
                                }
                            }
                            if (Community == "2")
                            {
                                foreach (DataRow dr in _dataset.Tables[1].Rows)
                                {
                                    FingerprintsModel.CommunityResource.DoctorInfo obj = new FingerprintsModel.CommunityResource.DoctorInfo();
                                    obj.Id = dr["Id"].ToString();
                                    //obj.Name = dr["DoctorName"].ToString();
                                    //  if (obj.Community == "1")
                                    obj.Community = dr["Community"].ToString();

                                    if (obj.Community == "2")
                                    {
                                        obj.Name = dr["DoctorName"].ToString();
                                    }
                                    _doctorlist.Add(obj);
                                }
                            }
                        }
                    }
                    //if (_dataset.Tables[2] != null)
                    //{
                    //    if (_dataset.Tables[2].Rows.Count > 0)
                    //    {
                    //        if (Community == "2")
                    //        {
                    //            foreach (DataRow dr in _dataset.Tables[2].Rows)
                    //            {
                    //                FingerprintsModel.CommunityResource.DoctorInfo obj = new FingerprintsModel.CommunityResource.DoctorInfo();
                    //                obj.Id = dr["Id"].ToString();
                    //                //obj.Name = dr["DoctorName"].ToString();
                    //                //  if (obj.Community == "1")
                    //                obj.Community = dr["Community"].ToString();

                    //                if (obj.Community == "2")
                    //                {
                    //                    obj.Name = dr["DoctorName"].ToString();
                    //                }
                    //                _doctorlist.Add(obj);
                    //            }
                    //        }
                    //    }
                    //}
                    Info.doctorList = _doctorlist;
                }
                catch (Exception ex)
                {
                    clsError.WriteException(ex);
                }



                return(command.Parameters["@result"].Value.ToString());
            }
            catch (Exception ex)
            {
                clsError.WriteException(ex);
            }
            finally
            {
                Connection.Close();
                command.Dispose();
            }
            return(command.Parameters["@result"].Value.ToString());
        }