public int AddKB(KnowlegeBaseMaster knowlegeBaseMaster) { MySqlCommand cmd = new MySqlCommand(); int k = 0; try { conn = Db.Connection; cmd.Connection = conn; MySqlCommand cmd1 = new MySqlCommand("SP_InsertKnowlegeBase", conn); cmd1.CommandType = CommandType.StoredProcedure; cmd1.Parameters.AddWithValue("@KB_CODE", knowlegeBaseMaster.KBCODE); cmd1.Parameters.AddWithValue("@Tenant_ID", knowlegeBaseMaster.TenantID); cmd1.Parameters.AddWithValue("@Category_ID", knowlegeBaseMaster.CategoryID); cmd1.Parameters.AddWithValue("@SubCategory_ID", knowlegeBaseMaster.SubCategoryID); cmd1.Parameters.AddWithValue("@Is_Approved", knowlegeBaseMaster.IsApproved); cmd1.Parameters.AddWithValue("@Subject_", knowlegeBaseMaster.Subject); cmd1.Parameters.AddWithValue("@Description_", knowlegeBaseMaster.Description); cmd1.Parameters.AddWithValue("@Is_Active", knowlegeBaseMaster.IsActive); cmd1.Parameters.AddWithValue("@IssueType_ID", knowlegeBaseMaster.IssueTypeID); cmd1.Parameters.AddWithValue("@Created_By", knowlegeBaseMaster.CreatedBy); k = Convert.ToInt32(cmd1.ExecuteNonQuery()); } catch (Exception ex) { throw ex; } return(k); }
public int RejectApproveKB(KnowlegeBaseMaster knowlegeBaseMaster) { MySqlCommand cmd = new MySqlCommand(); int i = 0; try { conn = Db.Connection; cmd.Connection = conn; MySqlCommand cmd1 = new MySqlCommand("SP_ApproveRejectKB", conn); cmd1.Parameters.AddWithValue("@Tenant_ID", knowlegeBaseMaster.TenantID); cmd1.Parameters.AddWithValue("@KB_ID", knowlegeBaseMaster.KBID); cmd1.Parameters.AddWithValue("@Is_Approved", knowlegeBaseMaster.IsApproved); cmd1.Parameters.AddWithValue("@Category_ID", knowlegeBaseMaster.CategoryID); cmd1.Parameters.AddWithValue("@SubCategory_ID", knowlegeBaseMaster.SubCategoryID); cmd1.Parameters.AddWithValue("@IssueType_ID", knowlegeBaseMaster.IssueTypeID); cmd1.Parameters.AddWithValue("@Subject_", knowlegeBaseMaster.Subject); cmd1.Parameters.AddWithValue("@Description_", knowlegeBaseMaster.Description); cmd1.CommandType = CommandType.StoredProcedure; i = Convert.ToInt32(cmd1.ExecuteNonQuery()); conn.Close(); } catch (MySql.Data.MySqlClient.MySqlException ex) { //Console.WriteLine("Error " + ex.Number + " has occurred: " + ex.Message); } return(i); }
public ResponseModel AddKB([FromBody] KnowlegeBaseMaster knowlegeBaseMaster) { KnowledgeCaller knowledgeCaller = new KnowledgeCaller(); ResponseModel objResponseModel = new ResponseModel(); int statusCode = 0; string statusMessage = ""; try { string token = Convert.ToString(Request.Headers["X-Authorized-Token"]); Authenticate authenticate = new Authenticate(); authenticate = SecurityService.GetAuthenticateDataFromTokenCache(Cache, SecurityService.DecryptStringAES(token)); knowlegeBaseMaster.TenantID = authenticate.TenantId; knowlegeBaseMaster.CreatedBy = authenticate.UserMasterID; int result = knowledgeCaller.AddKB(new KnowlegeBaseService(Cache, Db), knowlegeBaseMaster); statusCode = result == 0 ? (int)EnumMaster.StatusCode.RecordNotFound : (int)EnumMaster.StatusCode.Success; statusMessage = CommonFunction.GetEnumDescription((EnumMaster.StatusCode)statusCode); objResponseModel.Status = true; objResponseModel.StatusCode = statusCode; objResponseModel.Message = statusMessage; objResponseModel.ResponseData = result; } catch (Exception) { throw; } return(objResponseModel); }
/// Search By Category ,SubCategory and Type /// </summary> /// <param name="Category"></param> /// <param name="SubCategory"></param> /// <param name="type"></param> /// <returns></returns> public List <KnowlegeBaseMaster> SearchByCategory(int type_ID, int category_ID, int subCategory_ID, int tenantId) { DataSet ds = new DataSet(); List <KnowlegeBaseMaster> listknowledge = new List <KnowlegeBaseMaster>(); try { conn.Open(); MySqlCommand cmd = new MySqlCommand("SP_SearchByTypeCategory", conn); cmd.Connection = conn; cmd.Parameters.AddWithValue("@type_ID", type_ID); cmd.Parameters.AddWithValue("@Category_ID", category_ID); cmd.Parameters.AddWithValue("@SubCategory_ID", subCategory_ID); cmd.Parameters.AddWithValue("@Tenant_Id", tenantId); cmd.CommandType = CommandType.StoredProcedure; MySqlDataAdapter da = new MySqlDataAdapter(); da.SelectCommand = cmd; da.Fill(ds); if (ds != null && ds.Tables[0] != null) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { KnowlegeBaseMaster knowlegeBase = new KnowlegeBaseMaster(); knowlegeBase.KBID = Convert.ToInt32(ds.Tables[0].Rows[i]["KBID"]); knowlegeBase.Subject = Convert.ToString(ds.Tables[0].Rows[i]["Subject"]); knowlegeBase.Description = Convert.ToString(ds.Tables[0].Rows[i]["Description"]); listknowledge.Add(knowlegeBase); } } } catch (Exception) { throw; } finally { if (conn != null) { conn.Close(); } } return(listknowledge); }
public int AddKB(KnowlegeBaseMaster knowlegeBaseMaster) { MySqlCommand cmd = new MySqlCommand(); int success = 0; try { conn.Open(); cmd.Connection = conn; MySqlCommand cmd1 = new MySqlCommand("SP_InsertKnowlegeBase", conn); cmd1.CommandType = CommandType.StoredProcedure; cmd1.Parameters.AddWithValue("@KB_CODE", knowlegeBaseMaster.KBCODE); cmd1.Parameters.AddWithValue("@Tenant_ID", knowlegeBaseMaster.TenantID); cmd1.Parameters.AddWithValue("@Category_ID", knowlegeBaseMaster.CategoryID); cmd1.Parameters.AddWithValue("@SubCategory_ID", knowlegeBaseMaster.SubCategoryID); cmd1.Parameters.AddWithValue("@Is_Approved", knowlegeBaseMaster.IsApproved); cmd1.Parameters.AddWithValue("@Subject_", knowlegeBaseMaster.Subject); cmd1.Parameters.AddWithValue("@Description_", knowlegeBaseMaster.Description); cmd1.Parameters.AddWithValue("@Is_Active", knowlegeBaseMaster.IsActive); cmd1.Parameters.AddWithValue("@IssueType_ID", knowlegeBaseMaster.IssueTypeID); cmd1.Parameters.AddWithValue("@Created_By", knowlegeBaseMaster.CreatedBy); cmd1.Parameters.AddWithValue("@IsFrom_Ticket", knowlegeBaseMaster.IsFromTicket); cmd1.Parameters.AddWithValue("@Ticket_ID", knowlegeBaseMaster.TicketID); success = Convert.ToInt32(cmd1.ExecuteNonQuery()); } catch (Exception) { throw; } finally { if (conn != null) { conn.Close(); } } return(success); }
public int UpdateKB(KnowlegeBaseMaster knowlegeBaseMaster) { MySqlCommand cmd = new MySqlCommand(); int success = 0; try { conn.Open(); cmd.Connection = conn; MySqlCommand cmd1 = new MySqlCommand("SP_UpdateKnowlegeBase", conn); cmd1.Parameters.AddWithValue("@Tenant_ID", knowlegeBaseMaster.TenantID); cmd1.Parameters.AddWithValue("@KB_ID", knowlegeBaseMaster.KBID); cmd1.Parameters.AddWithValue("@KB_CODE", knowlegeBaseMaster.KBCODE); cmd1.Parameters.AddWithValue("@Category_ID", knowlegeBaseMaster.CategoryID); cmd1.Parameters.AddWithValue("@SubCategory_ID", knowlegeBaseMaster.SubCategoryID); cmd1.Parameters.AddWithValue("@IssueType_ID", knowlegeBaseMaster.IssueTypeID); cmd1.Parameters.AddWithValue("@Subject_", knowlegeBaseMaster.Subject); cmd1.Parameters.AddWithValue("@Description_", knowlegeBaseMaster.Description); cmd1.Parameters.AddWithValue("@Modify_By", knowlegeBaseMaster.ModifyBy); cmd1.CommandType = CommandType.StoredProcedure; success = Convert.ToInt32(cmd1.ExecuteNonQuery()); conn.Close(); } catch (Exception) { throw; } finally { if (conn != null) { conn.Close(); } } return(success); }
public int RejectApproveKB(KnowlegeBaseMaster knowlegeBaseMaster) { MySqlCommand cmd = new MySqlCommand(); int result = 0; try { conn.Open(); cmd.Connection = conn; MySqlCommand cmd1 = new MySqlCommand("SP_ApproveRejectKB", conn); cmd1.Parameters.AddWithValue("@Tenant_ID", knowlegeBaseMaster.TenantID); cmd1.Parameters.AddWithValue("@KB_ID", knowlegeBaseMaster.KBID); cmd1.Parameters.AddWithValue("@Is_Approved", knowlegeBaseMaster.IsApproved); cmd1.Parameters.AddWithValue("@Category_ID", knowlegeBaseMaster.CategoryID); cmd1.Parameters.AddWithValue("@SubCategory_ID", knowlegeBaseMaster.SubCategoryID); cmd1.Parameters.AddWithValue("@IssueType_ID", knowlegeBaseMaster.IssueTypeID); cmd1.Parameters.AddWithValue("@Subject_", knowlegeBaseMaster.Subject); cmd1.Parameters.AddWithValue("@Description_", knowlegeBaseMaster.Description); cmd1.CommandType = CommandType.StoredProcedure; result = Convert.ToInt32(cmd1.ExecuteNonQuery()); conn.Close(); } catch (Exception) { throw; } finally { if (conn != null) { conn.Close(); } } return(result); }
public int RejectApproveKB(IKnowledge Knowledge, KnowlegeBaseMaster knowlegeBaseMaster) { _KnowledgeRepository = Knowledge; return(_KnowledgeRepository.RejectApproveKB(knowlegeBaseMaster)); }
public int UpdateKB(IKnowledge Knowledge, KnowlegeBaseMaster knowlegeBaseMaster) { _KnowledgeRepository = Knowledge; return(_KnowledgeRepository.UpdateKB(knowlegeBaseMaster)); }