public static Imgname createService(AddServiceDirectory service) { try { var serviceId = new MySqlParameter("?p_service_id", service.serviceId); var groupId = new MySqlParameter("?p_group_id", service.groupId); var moduleId = new MySqlParameter("?p_module_id", service.moduleId); // Added by Nandu on 30/09/2016 Task--> Module replica var memberName = new MySqlParameter("?p_member_name", string.IsNullOrEmpty(service.memberName) ? "" : service.memberName); var description = new MySqlParameter("?p_description", string.IsNullOrEmpty(service.description) ? "" : service.description); var image = new MySqlParameter("?p_image", string.IsNullOrEmpty(service.image) ? "0" : service.image); var countryCode1 = new MySqlParameter("?p_country_code1", string.IsNullOrEmpty(service.countryCode1) ? "" : service.countryCode1); var mobileNo1 = new MySqlParameter("?p_mobile_no1", string.IsNullOrEmpty(service.mobileNo1) ? "" : service.mobileNo1); var countryCode2 = new MySqlParameter("?p_country_code2", string.IsNullOrEmpty(service.countryCode2) ? "" : service.countryCode2); var mobileNo2 = new MySqlParameter("?p_mobile_no2", string.IsNullOrEmpty(service.mobileNo2) ? "" : service.mobileNo2); var paxNo = new MySqlParameter("?p_pax_no", string.IsNullOrEmpty(service.paxNo) ? "" : service.paxNo); var email = new MySqlParameter("?p_email", string.IsNullOrEmpty(service.email) ? "" : service.email); var keywords = new MySqlParameter("?p_keywords", string.IsNullOrEmpty(service.keywords) ? "" : service.keywords); var address = new MySqlParameter("?p_address", string.IsNullOrEmpty(service.address) ? "" : service.address); var latitude = new MySqlParameter("?p_latitude", string.IsNullOrEmpty(service.latitude) ? "" : service.latitude); var longitude = new MySqlParameter("?p_longitude", string.IsNullOrEmpty(service.longitude) ? "" : service.longitude); var createdBy = new MySqlParameter("?p_created", string.IsNullOrEmpty(service.createdBy) ? "" : service.createdBy); var addressCode = new MySqlParameter("?p_address_code", string.IsNullOrEmpty(service.addressCountry) ? "" : service.addressCountry); var city = new MySqlParameter("?p_city", string.IsNullOrEmpty(service.city) ? "" : service.city); var state = new MySqlParameter("?p_state", string.IsNullOrEmpty(service.state) ? "" : service.state); var zipcode = new MySqlParameter("?p_zipcode", string.IsNullOrEmpty(service.zipcode) ? "" : service.zipcode); var website = new MySqlParameter("?p_website", string.IsNullOrEmpty(service.website) ? "" : service.website); var category = new MySqlParameter("?p_category", string.IsNullOrEmpty(service.categoryId) ? "0" : service.categoryId); // Added by Nandu on 30/09/2016 Task--> Module replica using (TouchBaseWebAPI.Data.row_productionEntities context = new TouchBaseWebAPI.Data.row_productionEntities()) { context.Connection.Open(); var Result = context.ExecuteStoreQuery <Imgname>("CALL V7_USPAddServiceDirectory(?p_created, ?p_service_id, ?p_group_id, ?p_module_id, ?p_member_name, ?p_description, ?p_image, ?p_country_code1, ?p_mobile_no1, ?p_country_code2, ?p_mobile_no2, ?p_pax_no, ?p_email, ?p_keywords, ?p_address, ?p_latitude, ?p_longitude, ?p_address_code, ?p_city, ?p_state, ?p_zipcode, ?p_website, ?p_category )", createdBy, serviceId, groupId, moduleId, memberName, description, image, countryCode1, mobileNo1, countryCode2, mobileNo2, paxNo, email, keywords, address, latitude, longitude, addressCode, city, state, zipcode, website, category).SingleOrDefault(); return(Result); } } catch (Exception ex) { throw ex; } finally { GC.Collect(); } }
public object AddServiceDirectory(AddServiceDirectory addservice) { dynamic TBAddServiceResult; int str = -1; try { Imgname Result = ServiceDirectory.createService(addservice); if (!string.IsNullOrEmpty(Result.imgName)) { str = GlobalFuns.UploadImage(addservice.groupId, Result.imgName, "servicedirectory"); } else { str = 0; } //if (Result != null) //{ if (str == 0) { //TBAddServiceResult = new { status = "0", message = "success" }; ServiceDirectorySearch serv = new ServiceDirectorySearch(); serv.groupId = addservice.groupId; serv.moduleId = addservice.moduleId; DateTime dt = DateTime.Now; if (addservice.updatedOn != null) { dt = Convert.ToDateTime(addservice.updatedOn); dt = dt.AddSeconds(-1); } serv.updatedOn = dt.ToString("yyyy/MM/dd HH:mm:ss"); ServiceDirector res = ServiceDirectory.GetServiceDirectoryListSync(serv); if (res != null) { TBAddServiceResult = new { status = "0", message = "success", updatedOn = System.DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"), res }; } else { TBAddServiceResult = new { status = "1", message = "failed", updatedOn = System.DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") }; } } else { TBAddServiceResult = new { status = "1", message = "failed" } }; //} //else //{ // TBAddServiceResult = new { status = "0", message = "Record not found" }; //} } catch { TBAddServiceResult = new { status = "1", message = "failed" }; } return(new { TBAddServiceResult }); }