Ejemplo n.º 1
0
        //private static TouchBaseWebAPI.Data.row_productionEntities _DBTouchbase = new TouchBaseWebAPI.Data.row_productionEntities();

        public static List <RotarianResult> GetRotarian(FindRotarianInput search)
        {
            try
            {
                MySqlParameter[] param = new MySqlParameter[4];
                param[0] = new MySqlParameter("?MemberName", string.IsNullOrEmpty(search.name) ? "" : search.name.Replace(" ", "%"));
                param[1] = new MySqlParameter("?classification", string.IsNullOrEmpty(search.classification) ? "" : search.classification.Replace(" ", "%"));
                param[2] = new MySqlParameter("?club", string.IsNullOrEmpty(search.club) ? "" : search.club.Replace(" ", "%"));
                param[3] = new MySqlParameter("?districtNo", string.IsNullOrEmpty(search.district_number) ? "0" : search.district_number.Replace(" ", "%"));
                using (TouchBaseWebAPI.Data.row_productionEntities context = new TouchBaseWebAPI.Data.row_productionEntities())
                {
                    context.Connection.Open();
                    var Result = context.ExecuteStoreQuery <RotarianResult>("CALL V1_USPFindRotarian(?MemberName,?classification,?club,?districtNo)", param).ToList();

                    foreach (RotarianResult Mem in Result)
                    {
                        if (!string.IsNullOrEmpty(Mem.pic) && Mem.pic != "profile_photo.png")
                        {
                            string ImageName = Mem.pic.ToString();
                            string path      = ConfigurationManager.AppSettings["imgPath"] + "Documents/directory/";
                            Mem.pic = path + ImageName;
                        }
                        else
                        {
                            Mem.pic = ConfigurationManager.AppSettings["imgPath"] + "images/profile_pic.png";
                        }
                    }
                    return(Result);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 2
0
        public object GetRotarianList(FindRotarianInput searchCriteria)
        {
            dynamic TBGetRotarianResult;

            try
            {
                List <RotarianResult> Result = FindRotarian.GetRotarian(searchCriteria);

                if (Result != null)
                {
                    TBGetRotarianResult = new { status = "0", message = "success", RotarianResult = Result };
                }
                else
                {
                    TBGetRotarianResult = new { status = "0", message = "Record not found" };
                }
            }
            catch
            {
                TBGetRotarianResult = new { status = "1", message = "failed" };
            }

            return(new { TBGetRotarianResult });
        }