public List <Res_Opt_Junc> GetRes_Opt_JuncListByResID(int resID) { List <Res_Opt_Junc> res_opt_junclist = null; SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@ResID", resID) }; using (DataTable table = SqlDBHelper.ExecuteParamerizedSelectCommand("[Resource_Control].[sp_res_opt_juncSelectByResID]", CommandType.StoredProcedure, parameters)) { if (table.Rows.Count > 0) { res_opt_junclist = new List <Res_Opt_Junc>(); foreach (DataRow row in table.Rows) { Res_Opt_Junc res_opt_junc = new Res_Opt_Junc(); res_opt_junc.ID = Convert.ToInt32(row["ID"]); res_opt_junc.Res_id = Convert.ToInt32(row["Res_id"]); res_opt_junc.Opt_id = Convert.ToInt32(row["Opt_id"]); res_opt_junc.IsActive = Convert.ToBoolean(row["IsActive"]); res_opt_junclist.Add(res_opt_junc); } } } return(res_opt_junclist); }
// public bool DeleteResource(int catID) //{ // return ResourceDB.DeleteResource(catID); //} public int AddNewResource(Resource resource, List <Option> optlist, int userId) { int id = ResourceDB.AddNewResource(resource); foreach (var item in optlist) { Res_Opt_Junc res_opt = new Res_Opt_Junc(); res_opt.Res_id = id; res_opt.Opt_id = item.ID; Res_Opt_JuncHandler rsopt = new Res_Opt_JuncHandler(); rsopt.AddNewRes_Opt_Junc(res_opt); } ; if (id != 0) { var myResource = ResourceDB.GetResourceList() .FirstOrDefault(c => c.ID == id); if (myResource == null) { return(id); } var resourceId = myResource.ID; common.InsertIntoUserLog(userId, "", 11, 141, "ثبت کلاس جدید", resourceId); return(id); } else { return(id); } }
public bool AddNewRes_Opt_Junc(Res_Opt_Junc res_opt_junc) { SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@Res_id", res_opt_junc.Res_id), new SqlParameter("@Opt_id", res_opt_junc.Opt_id), }; return(SqlDBHelper.ExecuteNonQuery("[Resource_Control].[sp_res_opt_juncInsert]", CommandType.StoredProcedure, parameters));; }
public bool UpdateRes_Opt_Junc(Res_Opt_Junc res_opt_junc) { SqlParameter[] parameters = new SqlParameter[] { // new SqlParameter("@ID",res_opt_junc.ID), new SqlParameter("@Res_Id", res_opt_junc.Res_id), new SqlParameter("@Opt_Id", res_opt_junc.Opt_id), new SqlParameter("@IsActive", res_opt_junc.IsActive) }; return(SqlDBHelper.ExecuteNonQuery("[Resource_Control].[sp_res_opt_juncUpdate]", CommandType.StoredProcedure, parameters)); }
public bool UpdateResource(Resource resource, List <Option> optlist, int userId) { try { foreach (var item in optlist) { Res_Opt_Junc res_opt = new Res_Opt_Junc(); res_opt.Res_id = resource.ID; res_opt.Opt_id = item.ID; res_opt.IsActive = item.IsActive; Res_Opt_JuncHandler rsopt = new Res_Opt_JuncHandler(); rsopt.UpdateRes_Opt_Junc(res_opt); } } catch (Exception) { throw; } var resualt = ResourceDB.UpdateResource(resource); return(ResourceLog(resualt, userId, resource.ID)); }
//public Res_Opt_Junc GetRes_Opt_JuncDetails(int res_opt_juncID) //{ // Res_Opt_JuncDBAccess Res_Opt_JuncDB = new Res_Opt_JuncDBAccess(); // return Res_Opt_JuncDB.GetRes_Opt_JuncDetails(res_opt_juncID); //} //public bool DeleteRes_Opt_Junc(int res_opt_juncID) //{ // return Res_Opt_JuncDB.DeleteRes_Opt_Junc(Res_opt_juncID); //} public bool AddNewRes_Opt_Junc(Res_Opt_Junc res_opt_junc) { return(Res_Opt_JuncDB.AddNewRes_Opt_Junc(res_opt_junc)); }
public bool UpdateRes_Opt_Junc(Res_Opt_Junc res_opt_junc) { return(Res_Opt_JuncDB.UpdateRes_Opt_Junc(res_opt_junc)); }