public CustomPartnerMOA CheckPartner(int mou_id, string partner_name) { try { string sql = @"select t4.country_name,t3.website,t3.address, t2.contact_point_name,t2.contact_point_email,t2.contact_point_phone, t6.specialization_name,t2.partner_name from IA_Collaboration.MOA t1 inner join IA_Collaboration.MOUPartner t2 on t1.mou_id = t2.mou_id inner join IA_Collaboration.Partner t3 on t3.partner_id = t2.partner_id inner join General.Country t4 on t4.country_id = t3.country_id inner join IA_Collaboration.MOUPartnerSpecialization t5 on t5.mou_partner_id = t2.mou_partner_id inner join General.Specialization t6 on t6.specialization_id = t5.specialization_id where t2.mou_id = @mou_id and t3.partner_name like @partner_name"; CustomPartnerMOA p = db.Database.SqlQuery <CustomPartnerMOA>(sql, new SqlParameter("mou_id", mou_id), new SqlParameter("partner_name", partner_name)).FirstOrDefault(); return(p); } catch (Exception ex) { throw ex; } }
public ActionResult Get_Partner_Detail(int moa_partner_id) { try { CustomPartnerMOA obj = moa.getPartnerDetail(moa_partner_id); return(Json(obj, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(Json("", JsonRequestBehavior.AllowGet)); } }
public ActionResult CheckPartner(string partner_name) { try { string mou_id = Session["mou_detail_id"].ToString(); CustomPartnerMOA partner = moa.CheckPartner(int.Parse(mou_id), partner_name); return(partner is null?Json("") : Json(partner)); } catch (Exception) { return(new HttpStatusCodeResult(400)); } }
public CustomPartnerMOA getPartnerDetail(int moa_partner_id) { try { string sql_partnerList_1 = @"select t5.country_name, t3.website, t3.address, t4.contact_point_name, t4.contact_point_email, t4.contact_point_phone, t7.specialization_name, t3.partner_name from IA_Collaboration.MOAPartner t1 inner join IA_Collaboration.MOA t2 on t1.moa_id = t2.moa_id inner join IA_Collaboration.Partner t3 on t3.partner_id = t1.partner_id inner join IA_Collaboration.MOUPartner t4 on t4.mou_id = t2.mou_id and t4.partner_id = t1.partner_id inner join General.Country t5 on t5.country_id = t3.country_id inner join IA_Collaboration.MOUPartnerSpecialization t6 on t6.mou_partner_id = t4.mou_partner_id inner join General.Specialization t7 on t7.specialization_id = t6.specialization_id where t1.moa_partner_id = @moa_partner_id"; string sql_partnerList_2 = @"select scope_id,moa_start_date from IA_Collaboration.PartnerScope a inner join IA_Collaboration.MOAPartnerScope b on a.partner_scope_id = b.partner_scope_id inner join IA_Collaboration.MOAPartner c on c.moa_id = b.moa_id and c.partner_id = a.partner_id where c.moa_partner_id = @moa_partner_id"; CustomPartnerMOA obj1 = db.Database.SqlQuery <CustomPartnerMOA>(sql_partnerList_1, new SqlParameter("moa_partner_id", moa_partner_id)).First(); List <ScopeAndStartDate> obj2 = db.Database.SqlQuery <ScopeAndStartDate>(sql_partnerList_2, new SqlParameter("moa_partner_id", moa_partner_id)).ToList(); obj1.scopes = new List <int>(); foreach (ScopeAndStartDate item in obj2.ToList()) { obj1.scopes.Add(item.scope_id); } obj1.moa_start_date_string = obj2[0].moa_start_date.ToString("dd'/'MM'/'yyyy"); return(obj1); } catch (Exception ex) { throw ex; } }