public ErrorCode AddPerm(PrevilegeVM perm) { var previlegeDal = new PrevilegeDAL(); try { if ( previlegeDal.GetExisted( o => o.ActionId == perm.ActionId && o.ControllerId == perm.ControllerId && o.RoleId == perm.RoleId)) { return ErrorCode.NoError; } var previlege = new Previlege { RoleId = perm.RoleId, PrevilegeLevel = (int) perm.PrevilegeLevel, ControllerId = perm.ControllerId, ActionId = perm.ActionId }; previlegeDal.Create(previlege); return ErrorCode.NoError; } catch (Exception) { return ErrorCode.ServerError; } }
public static bool AddPublisher(ATT.ATTPublisher objATT, Previlege pobj) { string InsertSQL; InsertSQL = "SP_ADD_PUBLISHER"; GetConnection GetConn = new GetConnection(); try { OracleConnection DBConn = GetConn.GetDbConn(Module.LIS); if (Previlege.HasPrevilege(pobj, DBConn) == false) { throw new ArgumentException(Utilities.PreviledgeMsg + " add Publisher."); } OracleParameter[] paramArray = new OracleParameter[4]; paramArray[0] = Utilities.GetOraParam(":p_PUBLISHER_ID", objATT.PublisherID, OracleDbType.Int64, ParameterDirection.InputOutput); paramArray[1] = Utilities.GetOraParam(":P_PUBLISHER_NAME", objATT.PublisherName, OracleDbType.NVarchar2, ParameterDirection.Input); paramArray[2] = Utilities.GetOraParam(":P_PUBLISHER_ADDRESS", objATT.PublisherAddress, OracleDbType.NVarchar2, ParameterDirection.Input); paramArray[3] = Utilities.GetOraParam(":p_ENTRY_BY", objATT.EntryBy, OracleDbType.Varchar2, ParameterDirection.Input); SqlHelper.ExecuteNonQuery(DBConn, CommandType.StoredProcedure, InsertSQL, paramArray); return(true); } catch (Exception ex) { throw ex; } finally { GetConn.CloseDbConn(); } }
public static bool EditKeyword(ATTKeyword obj, Previlege pobj) { string EditSP; EditSP = "SP_EDIT_KEYWORD"; OracleParameter[] paramArray = new OracleParameter[2]; paramArray[0] = Utilities.GetOraParam(":p_KEYWORD_ID", obj.KeywordID, OracleDbType.Int64, ParameterDirection.InputOutput); paramArray[1] = Utilities.GetOraParam(":p_KEYWORD_NAME", obj.KeywordName, OracleDbType.Varchar2, ParameterDirection.Input); GetConnection getConn = new GetConnection(); try { OracleConnection DBConn = getConn.GetDbConn(Module.LIS); if (Previlege.HasPrevilege(pobj, DBConn) == false) { throw new ArgumentException(Utilities.PreviledgeMsg + " update Keyword."); } SqlHelper.ExecuteNonQuery(DBConn, CommandType.StoredProcedure, EditSP, paramArray); return(true); } catch (Exception ex) { throw ex; } finally { getConn.CloseDbConn(); } }
//Editing existing record public static bool UpdateLanguageType(ATTLookupLanguage objLT, Previlege pobj) { string UpdateSQL = "SP_EDIT_LANGUAGE"; GetConnection GetConn = new GetConnection(); try { OracleConnection DBConn = GetConn.GetDbConn(Module.LIS); if (Previlege.HasPrevilege(pobj, DBConn) == false) { throw new ArgumentException(Utilities.PreviledgeMsg + " update Language."); } OracleParameter[] paramArray = new OracleParameter[2]; paramArray[0] = Utilities.GetOraParam("p_LANG_ID", objLT.LookupLanguageID, OracleDbType.Int16, ParameterDirection.Input); paramArray[1] = Utilities.GetOraParam("p_LANG_ID", objLT.LookupLanguageName, OracleDbType.Varchar2, ParameterDirection.Input); SqlHelper.ExecuteNonQuery(DBConn, CommandType.StoredProcedure, UpdateSQL, paramArray); return(true); } catch (Exception ex) { throw ex; } finally { GetConn.CloseDbConn(); } }
//Update public static bool UpdatePublisherType(ATTPublisher objPT, Previlege pobj) { string UpdateSQL = "SP_EDIT_PUBLISHER"; GetConnection GetConn = new GetConnection(); try { OracleConnection DBConn = GetConn.GetDbConn(Module.LIS); if (Previlege.HasPrevilege(pobj, DBConn) == false) { throw new ArgumentException(Utilities.PreviledgeMsg + " update Publisher."); } OracleParameter[] paramArray = new OracleParameter[3]; paramArray[0] = Utilities.GetOraParam("p_PUBLISHER_ID", objPT.PublisherID, OracleDbType.Int16, ParameterDirection.Input); paramArray[1] = Utilities.GetOraParam("p_PUBLISHER_NAME", objPT.PublisherName, OracleDbType.Varchar2, ParameterDirection.Input); paramArray[2] = Utilities.GetOraParam("p_PUBLISHER_ADDRESS", objPT.PublisherAddress, OracleDbType.Varchar2, ParameterDirection.Input); SqlHelper.ExecuteNonQuery(DBConn, CommandType.StoredProcedure, UpdateSQL, paramArray); return(true); } catch (Exception ex) { throw ex; } finally { GetConn.CloseDbConn(); } }
/// <summary> /// /// </summary> /// <param name="ObjMT"></param> /// <returns></returns> public static bool AddMaterialType(ATTMaterialType objMT, Previlege pobj) { string InsertSQL; InsertSQL = "SP_ADD_MATERIAL_TYPE"; GetConnection GetConn = new GetConnection(); try { OracleConnection DBConn = GetConn.GetDbConn(Module.LIS); if (Previlege.HasPrevilege(pobj, DBConn) == false) { throw new ArgumentException(Utilities.PreviledgeMsg + " add Material Type."); } OracleParameter[] paramArray = new OracleParameter[4]; paramArray[0] = Utilities.GetOraParam(":p_MATERIAL_ID", "0", OracleDbType.Int16, ParameterDirection.Input); paramArray[1] = Utilities.GetOraParam(":p_MATERIAL_TYPE_NAME", objMT.MaterialTypeName, OracleDbType.Varchar2, ParameterDirection.Input); paramArray[2] = Utilities.GetOraParam(":p_MATERIAL_DESCRIPTION", objMT.MaterialDescription, OracleDbType.Varchar2, ParameterDirection.Input); paramArray[3] = Utilities.GetOraParam(":p_MATERIAL_ENTRY_BY", objMT.MaterialEntryBy, OracleDbType.Varchar2, ParameterDirection.Input); SqlHelper.ExecuteNonQuery(DBConn, CommandType.StoredProcedure, InsertSQL, paramArray); return(true); } catch (Exception ex) { throw ex; } finally { GetConn.CloseDbConn(); } }
//public static bool AddAuthor(ATTAuthor obj, Previlege pobj) //{ // try // { // return DLLAuthor.AddAuthor(obj, pobj); // } // catch (Exception ex) // { // throw ex; // } //} //public static bool EditCurrency(ATTCurrency obj, string username, string menuname) public static bool EditCurrency(ATTCurrency obj, Previlege pobj) { try { return(DLLCurrency.EditCurrency(obj, pobj)); } catch (Exception ex) { throw ex; } }
public static bool SavePublisher(ATTPublisher obj, Previlege pobj) { try { return(PCS.LIS.DLL.DLLPublisher.AddPublisher(obj, pobj)); } catch (Exception ex) { throw ex; } }
public static long AddLibraryMaterial(ATTLibraryMaterial obj, Previlege pobj) { try { return(DLLLibraryMaterial.AddLibraryMaterial(obj, pobj)); } catch (Exception ex) { throw ex; } }
public static bool EditKeyword(ATTKeyword obj, Previlege pobj) { try { return(DLLKeyword.EditKeyword(obj, pobj)); } catch (Exception ex) { throw ex; } }
public static bool SaveLanguage(ATTLookupLanguage obj, Previlege pobj) { try { return(PCS.LIS.DLL.DLLLookupLanguage.AddLanguage(obj, pobj)); } catch (Exception ex) { throw ex; } }
/// <summary> /// Passes author object to data layer to update in database /// </summary> /// <param name="obj">ATTAuthor object</param> /// <param name="username">username for checking previlege at database level</param> /// <param name="menuname">menuname for checking previlege at database level</param> /// <returns>return bool</returns> public static bool EditAuthor(ATTAuthor obj, Previlege pobj) { try { return(DLLAuthor.EditAuthor(obj, pobj)); } catch (Exception ex) { throw ex; } }
public static bool AddLibrary(ATTLibrary obj, Previlege pobj) { try { DLLLibrary.AddLibrary(obj, pobj); return(true); } catch (Exception ex) { throw ex; } }
public static bool UpdateMaterialType(ATTMaterialType objMT, Previlege pobj) { try { DLLMaterialType.UpdateMaterialType(objMT, pobj); return(true); } catch (Exception ex) { throw ex; } }
public static bool UpdatePublisherType(ATTPublisher objPT, Previlege pobj) { try { DLLPublisher.UpdatePublisherType(objPT, pobj); return(true); } catch (Exception ex) { throw ex; } }
public static bool UpdateLanguageType(ATTLookupLanguage objLT, Previlege pobj) { try { DLLLookupLanguage.UpdateLanguageType(objLT, pobj); return(true); } catch (Exception ex) { throw ex; } }
public static bool UpdateMaterialCategory(ATTMaterialCategory objMC, Previlege pobj) { try { DLLMaterialCategory.UpdateMaterialCategory(objMC, pobj); return(true); } catch (Exception ex) { throw ex; } }
public static bool AddLibrary(ATTLibrary obj, Previlege pobj) { string SQL; SQL = "SP_ADD_LIBRARY"; OracleParameter[] paramArray = new OracleParameter[5]; paramArray[0] = Utilities.GetOraParam(":p_LIBRARY_ID", obj.LibraryID, OracleDbType.Int64, ParameterDirection.InputOutput); paramArray[1] = Utilities.GetOraParam(":p_ORG_ID", obj.OrgID, OracleDbType.Int64, ParameterDirection.Input); paramArray[2] = Utilities.GetOraParam(":p_LIBRARY_NAME", obj.LibraryName, OracleDbType.Varchar2, ParameterDirection.Input); paramArray[3] = Utilities.GetOraParam(":p_LOCATION", obj.Location, OracleDbType.Varchar2, ParameterDirection.Input); paramArray[4] = Utilities.GetOraParam(":p_ENTRY_BY", obj.EntryBy, OracleDbType.Varchar2, ParameterDirection.Input); GetConnection GetConn = new GetConnection(); try { OracleConnection DBConn = GetConn.GetDbConn(Module.LIS); if (Previlege.HasPrevilege(pobj, DBConn) == false) { throw new ArgumentException(Utilities.PreviledgeMsg + " add Libaray."); } SqlHelper.ExecuteNonQuery(DBConn, CommandType.StoredProcedure, SQL, paramArray); obj.LibraryID = int.Parse(paramArray[0].Value.ToString()); return(true); } catch (Exception ex) { throw ex; } finally { GetConn.CloseDbConn(); } }
/// <summary> /// Add author object to database /// </summary> /// <param name="obj">ATTAuthor object</param> /// <returns>return bool</returns> public static bool AddAuthor(ATTAuthor obj, Previlege pobj) { string InsertSP; InsertSP = "SP_ADD_Author"; //Preparing oracle parameter with value OracleParameter[] paramArray = new OracleParameter[3]; paramArray[0] = Utilities.GetOraParam(":p_AUTHOR_ID", obj.AuthorID, OracleDbType.Int64, ParameterDirection.InputOutput); paramArray[1] = Utilities.GetOraParam(":p_AUTHOR_NAME", obj.AuthorName, OracleDbType.Varchar2, ParameterDirection.Input); paramArray[2] = Utilities.GetOraParam(":p_ENTRY_BY", obj.EntryBy, OracleDbType.Varchar2, ParameterDirection.Input); GetConnection getConn = new GetConnection(); try { OracleConnection DBConn = getConn.GetDbConn(Module.LIS); if (Previlege.HasPrevilege(pobj, DBConn) == false) { throw new ArgumentException(Utilities.PreviledgeMsg + " add Author."); } SqlHelper.ExecuteNonQuery(DBConn, CommandType.StoredProcedure, InsertSP, paramArray); obj.AuthorID = int.Parse(paramArray[0].Value.ToString()); return(true); } catch (Exception ex) { throw ex; } finally { getConn.CloseDbConn(); } }
public ErrorCode RemovePerm(PrevilegeVM perm) { var previlegeDal = new PrevilegeDAL(); try { if (perm.PrevilegeLevel == PrevilegeLevel.ActionLevel && (!previlegeDal.GetExisted( o => o.ActionId == perm.ActionId && o.ControllerId == perm.ControllerId && o.RoleId == perm.RoleId && o.PrevilegeLevel == (int)PrevilegeLevel.ActionLevel))) { return ErrorCode.NoError; } if (perm.PrevilegeLevel == PrevilegeLevel.ControllerLevel && (!previlegeDal.GetExisted( o => o.ControllerId == perm.ControllerId && o.RoleId == perm.RoleId && o.PrevilegeLevel == (int)PrevilegeLevel.ControllerLevel))) { return ErrorCode.NoError; } var previlege = new Previlege { RoleId = perm.RoleId, PrevilegeLevel = (int)perm.PrevilegeLevel, ControllerId = perm.ControllerId, ActionId = perm.ActionId }; var existed = new List<Previlege>(); if (previlege.PrevilegeLevel == (int)PrevilegeLevel.ControllerLevel) { //existed = QueryForObjs(GetObjQuery<RolePrevilege>(ctx), // o => o.RoleId == perm.RoleId && o.ControllerId == perm.ControllerId && o.PrevilegeLevel == (int)PrevilegeLevel.ControllerLevel).ToList(); existed = previlegeDal.Query( o => o.RoleId == perm.RoleId && o.ControllerId == perm.ControllerId && o.PrevilegeLevel == (int) PrevilegeLevel.ControllerLevel).ToList(); } else if (previlege.PrevilegeLevel == (int)PrevilegeLevel.ActionLevel) { //existed = QueryForObjs(GetObjQuery<RolePrevilege>(ctx), // o => o.ActionId == perm.ActionId && o.RoleId == perm.RoleId && o.ControllerId == perm.ControllerId && o.PrevilegeLevel == (int)PrevilegeLevel.ActionLevel).ToList(); existed = previlegeDal.Query( o => o.ActionId == perm.ActionId && o.RoleId == perm.RoleId && o.ControllerId == perm.ControllerId && o.PrevilegeLevel == (int) PrevilegeLevel.ActionLevel).ToList(); } foreach (var previlege1 in existed) { previlegeDal.Delete(previlege1.Id); } return ErrorCode.NoError; } catch (Exception) { return ErrorCode.ServerError; } }
protected void btnSubmit_Click(object sender, EventArgs e) { ATTAuthor authorObj = new ATTAuthor ( 0, this.txtAuthorName_Rqd.Text, ((ATTUserLogin)Session["Login_User_Detail"]).UserName, DateTime.Now ); ObjectValidation OV = BLLAuthor.Validate(authorObj); if (OV.IsValid == false) { this.lblStatus.Text = OV.ErrorMessage; return; } List <ATTAuthor> lstAuth = (List <ATTAuthor>)Session["Author_AuthorList"]; ATTUserLogin user = ((ATTUserLogin)Session["Login_User_Detail"]); try { if (this.lstAuthor.SelectedIndex < 0) { if (user.MenuList["4,4,1"] == null || user.MenuList["4,4,1"].PAdd == "N") { this.lblStatus.Text = Utilities.PreviledgeMsg + " add Author."; return; } Previlege pobj = new Previlege(user.UserName, "4,4,1", int.Parse(((HiddenField)this.Master.FindControl("hdnApplicationID")).Value), Previlege.PrevilegeType.P_ADD); BLLAuthor.AddAuthor(authorObj, pobj); lstAuth.Add(authorObj); } else { if (user.MenuList["4,4,1"] == null || user.MenuList["4,4,1"].PEdit == "N") { this.lblStatus.Text = Utilities.PreviledgeMsg + " update Author."; return; } Previlege pobj = new Previlege(user.UserName, "4,4,1", int.Parse(((HiddenField)this.Master.FindControl("hdnApplicationID")).Value), Previlege.PrevilegeType.P_EDIT); authorObj.AuthorID = int.Parse(this.lstAuthor.SelectedValue); BLLAuthor.EditAuthor(authorObj, pobj); lstAuth[this.lstAuthor.SelectedIndex] = authorObj; } this.lstAuthor.DataSource = lstAuth; this.lstAuthor.DataTextField = "AuthorName"; this.lstAuthor.DataValueField = "AuthorID"; this.lstAuthor.DataBind(); this.ClearAuthorControl(); } catch (Exception ex) { this.lblStatus.Text = ex.Message; } }
protected void btnSubmit_Click(object sender, EventArgs e) { ATTCurrency currencyObj = new ATTCurrency ( 0, this.txtCurrencyName_Rqd.Text, ((ATTUserLogin)Session["Login_User_Detail"]).UserName, DateTime.Now ); ObjectValidation OV = BLLCurrency.Validate(currencyObj); if (OV.IsValid == false) { this.lblStatus.Text = OV.ErrorMessage; return; } List <ATTCurrency> lstCurr = (List <ATTCurrency>)Session["Currency_CurrencyList"]; ATTUserLogin user = ((ATTUserLogin)Session["Login_User_Detail"]); try { if (this.lstCurrency.SelectedIndex < 0) { if (user.MenuList["4,6,1"] == null || user.MenuList["4,6,1"].PAdd == "N") { this.lblStatus.Text = Utilities.PreviledgeMsg + " add Currency."; return; } Previlege pobj = new Previlege(user.UserName, "4,6,1", int.Parse(((HiddenField)this.Master.FindControl("hdnApplicationID")).Value), Previlege.PrevilegeType.P_ADD); BLLCurrency.AddCurrency(currencyObj, pobj); lstCurr.Add(currencyObj); } else { if (user.MenuList["4,6,1"] == null || user.MenuList["4,6,1"].PEdit == "N") { this.lblStatus.Text = Utilities.PreviledgeMsg + " update Currency."; return; } Previlege pobj = new Previlege(user.UserName, "4,6,1", int.Parse(((HiddenField)this.Master.FindControl("hdnApplicationID")).Value), Previlege.PrevilegeType.P_EDIT); currencyObj.CurrencyID = int.Parse(this.lstCurrency.SelectedValue); BLLCurrency.EditCurrency(currencyObj, pobj); lstCurr[this.lstCurrency.SelectedIndex] = currencyObj; } this.lstCurrency.DataSource = lstCurr; this.lstCurrency.DataTextField = "CurrencyName"; this.lstCurrency.DataValueField = "CurrencyID"; this.lstCurrency.DataBind(); this.ClearCurrencyControl(); } catch (Exception ex) { this.lblStatus.Text = ex.Message; } }
public static long AddLibraryMaterial(ATTLibraryMaterial obj, Previlege pobj) { string InsertSP; OracleParameter[] paramArray; if (obj.Action == "A") { InsertSP = "SP_ADD_LIBRARY_MATERIAL"; paramArray = new OracleParameter[18]; paramArray[17] = Utilities.GetOraParam(":p_ENTRY_BY", obj.EntryBy, OracleDbType.Varchar2, ParameterDirection.Input); } else { InsertSP = "SP_EDIT_LIBRARY_MATERIAL"; paramArray = new OracleParameter[17]; } paramArray[0] = Utilities.GetOraParam(":p_ORG_ID", obj.OrgID, OracleDbType.Int64, ParameterDirection.Input); paramArray[1] = Utilities.GetOraParam(":p_LIBRARY_ID", obj.LibraryID, OracleDbType.Int64, ParameterDirection.Input); paramArray[2] = Utilities.GetOraParam(":p_L_MATERIAL_ID", obj.LMaterialID, OracleDbType.Decimal, ParameterDirection.InputOutput); paramArray[3] = Utilities.GetOraParam(":p_MT_ID", obj.LibraryMaterialType, OracleDbType.Int64, ParameterDirection.Input); paramArray[4] = Utilities.GetOraParam(":p_CATEGORY_ID", obj.LibraryMaterialCategory, OracleDbType.Int64, ParameterDirection.Input); paramArray[5] = Utilities.GetOraParam(":p_CALL_NO", obj.CallNo, OracleDbType.Varchar2, ParameterDirection.Input); paramArray[6] = Utilities.GetOraParam(":p_CORPORATE_BODY", obj.CorporateBody, OracleDbType.Varchar2, ParameterDirection.Input); paramArray[7] = Utilities.GetOraParam(":p_TITLE", obj.Title, OracleDbType.Varchar2, ParameterDirection.Input); paramArray[8] = Utilities.GetOraParam(":p_SERIES_STATE", obj.SeriesStatement, OracleDbType.Varchar2, ParameterDirection.Input); paramArray[9] = Utilities.GetOraParam(":p_NOTE", obj.Note, OracleDbType.Varchar2, ParameterDirection.Input); paramArray[10] = Utilities.GetOraParam(":p_BRD_SUBJECT_HEADING", obj.BoardSubjectHeading, OracleDbType.Varchar2, ParameterDirection.Input); paramArray[11] = Utilities.GetOraParam(":p_GEO_DESC", obj.GeoDescription, OracleDbType.Varchar2, ParameterDirection.Input); paramArray[12] = Utilities.GetOraParam(":p_LANG_ID", obj.LanguageID, OracleDbType.Int64, ParameterDirection.Input); paramArray[13] = Utilities.GetOraParam(":p_PHY_DESC", obj.PhysicalDescription, OracleDbType.Varchar2, ParameterDirection.Input); paramArray[14] = Utilities.GetOraParam(":p_PUBLISHER_ID", obj.PublisherID, OracleDbType.Int64, ParameterDirection.Input); paramArray[15] = Utilities.GetOraParam(":p_CONTENT_FILE", obj.ContentFile, OracleDbType.Blob, ParameterDirection.Input); paramArray[16] = Utilities.GetOraParam(":p_FILE_TYPE", obj.CFileType, OracleDbType.Varchar2, ParameterDirection.Input); GetConnection GetConn = new GetConnection(); OracleConnection DBConn = GetConn.GetDbConn(Module.LIS); string modeName = ""; if (obj.Action == "A") { modeName = "add"; } else if (obj.Action == "M") { modeName = "update"; } if (Previlege.HasPrevilege(pobj, DBConn) == false) { throw new ArgumentException(Utilities.PreviledgeMsg + " " + modeName + " Library Material."); } OracleTransaction Tran = DBConn.BeginTransaction(); try { SqlHelper.ExecuteNonQuery(DBConn, CommandType.StoredProcedure, InsertSP, paramArray); obj.LMaterialID = long.Parse(paramArray[2].Value.ToString()); DLLLibraryMaterialKeyword.AddLibraryMaterialKeyword(obj.LstLMKeyword, obj.LMaterialID, Tran); DLLLibraryMaterialAuthor.AddLibraryMaterialAuthor(obj.LstLMAuthor, obj.LMaterialID, Tran); Tran.Commit(); return(obj.LMaterialID); } catch (Exception ex) { Tran.Rollback(); throw ex; } finally { GetConn.CloseDbConn(); } }
protected void btnAddLibrary_Click(object sender, EventArgs e) { ATTLibrary objLib = new ATTLibrary ( 0, int.Parse(this.ddlOrg_Rqd.SelectedValue), this.txtLibraryName.Text, this.txtLibraryLocation.Text, ((ATTUserLogin)Session["Login_User_Detail"]).UserName, DateTime.Now ); ObjectValidation OV = BLLLibrary.Validate(objLib); if (OV.IsValid == false) { this.lblStatus.Text = OV.ErrorMessage; return; } List <ATTLibrary> ltLibrary = (List <ATTLibrary>)Session["Library_LibraryList"]; ATTUserLogin user = ((ATTUserLogin)Session["Login_User_Detail"]); try { if (this.lslLibrary.SelectedIndex < 0) { if (this.lslLibrary.Items.Count > 1) { this.lblStatus.Text = "More then one library cannot be create."; return; } if (user.MenuList["4,1,1"] == null || user.MenuList["4,1,1"].PAdd == "N") { this.lblStatus.Text = Utilities.PreviledgeMsg + " add Library."; return; } Previlege pobj = new Previlege(user.UserName, "4,1,1", int.Parse(((HiddenField)this.Master.FindControl("hdnApplicationID")).Value), Previlege.PrevilegeType.P_ADD); BLLLibrary.AddLibrary(objLib, pobj); ltLibrary.Add(objLib); } else { objLib.LibraryID = int.Parse(this.lslLibrary.SelectedValue); if (user.MenuList["4,1,1"] == null || user.MenuList["4,1,1"].PEdit == "N") { this.lblStatus.Text = Utilities.PreviledgeMsg + " add Currency."; return; } Previlege pobj = new Previlege(user.UserName, "4,1,1", int.Parse(((HiddenField)this.Master.FindControl("hdnApplicationID")).Value), Previlege.PrevilegeType.P_EDIT); BLLLibrary.EditLibrary(objLib, pobj); ltLibrary[this.lslLibrary.SelectedIndex] = objLib; } this.lslLibrary.DataSource = ltLibrary; this.lslLibrary.DataTextField = "LibraryName"; this.lslLibrary.DataValueField = "LibraryID"; this.lslLibrary.DataBind(); this.ClearLibraryControl(); } catch (Exception ex) { this.lblStatus.Text = ex.Message; } }
protected void btnSave_Click(object sender, EventArgs e) { ATTLookupLanguage ObjLT; if (LBLanguage.SelectedIndex == -1) { ObjLT = new ATTLookupLanguage(0, txtLookupName_Rqd.Text, "User_Ashok", DateTime.Now.ToString()); } else { ObjLT = new ATTLookupLanguage(int.Parse(this.LBLanguage.SelectedValue), txtLookupName_Rqd.Text, "User_Ashok", DateTime.Now.ToString()); } List <ATTLookupLanguage> ltLanguage = (List <ATTLookupLanguage>)Session["LanguageTypeList"]; ATTUserLogin user = ((ATTUserLogin)Session["Login_User_Detail"]); try { if (LBLanguage.SelectedIndex == -1) { if (user.MenuList["4,7,1"] == null || user.MenuList["4,7,1"].PAdd == "N") { this.LblStatus.Text = Utilities.PreviledgeMsg + " add Language."; return; } Previlege pobj = new Previlege(user.UserName, "4,7,1", int.Parse(((HiddenField)this.Master.FindControl("hdnApplicationID")).Value), Previlege.PrevilegeType.P_ADD); if (BLLLanguage.SaveLanguage(ObjLT, pobj)) { ltLanguage.Add(ObjLT); LblStatus.Text = "Language Inserted as: " + txtLookupName_Rqd.Text + "."; txtLookupName_Rqd.Text = ""; txtLookupName_Rqd.Focus(); } } else { if (user.MenuList["4,7,1"] == null || user.MenuList["4,7,1"].PEdit == "N") { this.LblStatus.Text = Utilities.PreviledgeMsg + " update Language."; return; } Previlege pobj = new Previlege(user.UserName, "4,7,1", int.Parse(((HiddenField)this.Master.FindControl("hdnApplicationID")).Value), Previlege.PrevilegeType.P_EDIT); if (BLLLanguage.UpdateLanguageType(ObjLT, pobj)) { ltLanguage[this.LBLanguage.SelectedIndex] = ObjLT; LblStatus.Text = "Record updated..."; } } LBLanguage.DataSource = ltLanguage; LBLanguage.DataTextField = "LookupLanguageName"; LBLanguage.DataValueField = "LookupLanguageID"; LBLanguage.DataBind(); } catch (Exception ex) { this.LblStatus.Text = ex.Message; } }
protected void btnAdd_Click(object sender, EventArgs e) { ATTMaterialCategory objMC; if (lstCategoryName.SelectedIndex == -1) { objMC = new ATTMaterialCategory(0, txtCategoryName_rqd.Text, ((ATTUserLogin)Session["Login_User_Detail"]).UserName, txtCategoryDescription.Text); } else { objMC = new ATTMaterialCategory(int.Parse(lstCategoryName.SelectedValue), txtCategoryName_rqd.Text, ((ATTUserLogin)Session["Login_User_Detail"]).UserName, txtCategoryDescription.Text); } ObjectValidation OV = BLLMaterialCategory.Validate(objMC); if (OV.IsValid == false) { this.lblStatus.Text = OV.ErrorMessage; return; } List <ATTMaterialCategory> ltMaterialCategory = (List <ATTMaterialCategory>)Session["MaterialCategoryList"]; ATTUserLogin user = ((ATTUserLogin)Session["Login_User_Detail"]); try { if (lstCategoryName.SelectedIndex == -1) { if (user.MenuList["4,2,1"] == null || user.MenuList["4,2,1"].PAdd == "N") { this.lblStatus.Text = Utilities.PreviledgeMsg + " add Material Category."; return; } Previlege pobj = new Previlege(user.UserName, "4,2,1", int.Parse(((HiddenField)this.Master.FindControl("hdnApplicationID")).Value), Previlege.PrevilegeType.P_ADD); if (BLLMaterialCategory.AddMaterialCategory(objMC, pobj)) { ScriptManager.RegisterStartupScript(this, this.GetType(), "ProgressBar", "javascript:callProgressbar();", true); ScriptManager.RegisterStartupScript(this, this.GetType(), "ClearForm", "javascript:clearForm();", true); ltMaterialCategory.Add(objMC); lblStatus.Text = "New Record Added Successfully !!!"; } } else { List <ATTMaterialCategory> lst = (List <ATTMaterialCategory>)Session["MaterialCategoryList"]; ATTMaterialCategory MaterialCategory = lst.Find( delegate(ATTMaterialCategory MC) { return(MC.CategoryID == int.Parse(this.lstCategoryName.SelectedValue)); } ); if ((txtCategoryName_rqd.Text == MaterialCategory.CategoryName) && (txtCategoryDescription.Text == MaterialCategory.CategoryDescription)) { lblStatus.Text = "Please Change Data to Update !!!"; ScriptManager.RegisterStartupScript(this, this.GetType(), "ProgressBar", "javascript:callProgressbar();", true); ScriptManager.RegisterStartupScript(this, this.GetType(), "ClearForm", "javascript:clearForm();", true); } else { if (user.MenuList["4,2,1"] == null || user.MenuList[Session["List_Menuname"].ToString()].PEdit == "N") { this.lblStatus.Text = Utilities.PreviledgeMsg + " update Material Category."; return; } Previlege pobj = new Previlege(user.UserName, "4,2,1", int.Parse(((HiddenField)this.Master.FindControl("hdnApplicationID")).Value), Previlege.PrevilegeType.P_EDIT); if (BLLMaterialCategory.UpdateMaterialCategory(objMC, pobj)) { ScriptManager.RegisterStartupScript(this, this.GetType(), "ProgressBar", "javascript:callProgressbar();", true); ScriptManager.RegisterStartupScript(this, this.GetType(), "ClearForm", "javascript:clearForm();", true); ltMaterialCategory[this.lstCategoryName.SelectedIndex] = objMC; lblStatus.Text = "Existing Record Updated Successfully !!!"; } } } this.lstCategoryName.DataSource = ltMaterialCategory; this.lstCategoryName.DataTextField = "CategoryName"; this.lstCategoryName.DataValueField = "CategoryID"; this.lstCategoryName.DataBind(); //this.lstCategoryName.SelectedIndex = -1; } catch (Exception ex) { ScriptManager.RegisterStartupScript(this, this.GetType(), "ProgressBar", "javascript:callProgressbar();", true); this.lblStatus.Text = ex.Message; } }
protected void btnSave_Click(object sender, EventArgs e) { ATTPublisher ObjPT; if (LBPublisher.SelectedIndex == -1) { ObjPT = new ATTPublisher(0, txtPublisherName_Rqd.Text, txtLookupAddress_Rqd.Text, "User_Ashok", DateTime.Now.ToString()); } else { ObjPT = new ATTPublisher(int.Parse(this.LBPublisher.SelectedValue), txtPublisherName_Rqd.Text, txtLookupAddress_Rqd.Text, "User_Ashok", DateTime.Now.ToString()); } List <ATTPublisher> ltPublisher = (List <ATTPublisher>)Session["PublisherTypeList"]; ATTUserLogin user = ((ATTUserLogin)Session["Login_User_Detail"]); try { if (LBPublisher.SelectedIndex == -1) { if (user.MenuList["4,8,1"] == null || user.MenuList["4,8,1"].PAdd == "N") { this.LblStatus.Text = Utilities.PreviledgeMsg + " add Publisher."; return; } Previlege pobj = new Previlege(user.UserName, "4,8,1", int.Parse(((HiddenField)this.Master.FindControl("hdnApplicationID")).Value), Previlege.PrevilegeType.P_ADD); if (BLLPublisher.SavePublisher(ObjPT, pobj)) { ltPublisher.Add(ObjPT); LblStatus.Text = "Publisher Inserted as: " + txtPublisherName_Rqd.Text + "."; txtPublisherName_Rqd.Text = ""; txtLookupAddress_Rqd.Text = ""; btnSave.Text = "Save"; txtPublisherName_Rqd.Focus(); } } else { if (user.MenuList["4,8,1"] == null || user.MenuList["4,8,1"].PEdit == "N") { this.LblStatus.Text = Utilities.PreviledgeMsg + " add Publisher."; return; } Previlege pobj = new Previlege(user.UserName, "4,8,1", int.Parse(((HiddenField)this.Master.FindControl("hdnApplicationID")).Value), Previlege.PrevilegeType.P_ADD); if (BLLPublisher.UpdatePublisherType(ObjPT, pobj)) { ltPublisher[this.LBPublisher.SelectedIndex] = ObjPT; LblStatus.Text = "Publisher Record Updated..."; btnSave.Text = "Save"; txtPublisherName_Rqd.Text = ""; txtLookupAddress_Rqd.Text = ""; txtPublisherName_Rqd.Focus(); } } LBPublisher.DataSource = ltPublisher; LBPublisher.DataTextField = "PublisherName"; LBPublisher.DataValueField = "PublisherID"; LBPublisher.DataBind(); } catch (Exception ex) { this.LblStatus.Text = ex.Message; } }
protected void btnSubmit_Click(object sender, EventArgs e) { if (this.hdnAction.Value == "") { if (!ServerValidateAll()) { this.lblStatusMessage.Text = sb.ToString(); this.programmaticModalPopup.Show(); return; } } else if (this.hdnAction.Value == "M") { if (!ServerValidateMaster()) { this.lblStatusMessage.Text = sb.ToString(); this.programmaticModalPopup.Show(); return; } } string ext = System.IO.Path.GetExtension(this.fupAttachment.FileName); if (ext == "pdf" || ext == "jpeg" || ext == "jpg" || ext == "gif") { this.lblStatusMessage.Text = "Uploaded file's extention must be of 'pdf' or 'jpg' or 'jpeg' or 'gif'."; this.programmaticModalPopup.Show(); return; } ATTLibraryMaterial LM = (ATTLibraryMaterial)Session["LM_LibraryMaterial"]; LM.OrgID = int.Parse(this.ddlOrg.SelectedValue); LM.LibraryID = int.Parse(this.ddlLibrary.SelectedValue); if (this.hdnAction.Value != "M") { LM.LMaterialID = 0; } LM.LibraryMaterialType = int.Parse(this.ddlType_Rqd.SelectedValue); LM.LibraryMaterialCategory = int.Parse(this.ddlCategory_Rqd.Text); LM.CallNo = this.txtCallNo_Rqd.Text; LM.CorporateBody = this.txtCorporateBody.Text; LM.Title = this.txtTitle_Rqd.Text; LM.SeriesStatement = this.txtSeriesState.Text; LM.Note = this.txtNote.Text; LM.BoardSubjectHeading = this.txtBrdSubHeading.Text; LM.GeoDescription = this.txtGeoDescription.Text; LM.LanguageID = int.Parse(this.ddlLanguage_Rqd.SelectedValue); LM.PublisherID = int.Parse(this.ddlPublisher_Rqd.SelectedValue); LM.PhysicalDescription = this.txtPhyDescription.Text; LM.EntryBy = ((ATTUserLogin)Session["Login_User_Detail"]).UserName; LM.EntryOn = DateTime.Now; //LM.ContentFile = null; //LM.CFileType = ""; if (this.hdnAction.Value == "M") { LM.Action = "M"; } else { LM.Action = "A"; } if (this.fupAttachment.HasFile == true) { LM.ContentFile = this.fupAttachment.FileBytes; LM.CFileType = System.IO.Path.GetExtension(this.fupAttachment.FileName); } ObjectValidation OV = BLLLibraryMaterial.Validate(LM); if (OV.IsValid == false) { //this.lblMaterialStatus.Text = OV.ErrorMessage; this.lblStatusMessage.Text = OV.ErrorMessage; this.programmaticModalPopup.Show(); return; } GridViewRow keyRow; int keyRowCount = 0; bool keyChecked; foreach (ATTLibraryMaterialKeyword ky in LM.LstLMKeyword) { keyRow = this.grdKeyword.Rows[keyRowCount]; keyChecked = ((CheckBox)keyRow.FindControl("chkKeyword")).Checked; if (keyChecked == true && ky.Action == "A") { ky.Action = "N"; } else if (keyChecked == true && ky.Action == "M") { ky.Action = "D"; } else if (keyChecked == false && ky.Action == "M") { ky.Action = "N"; } keyRowCount = keyRowCount + 1; } GridViewRow authorRow; int authorRowCount = 0; bool authorChecked; foreach (ATTLibraryMaterialAuthor au in LM.LstLMAuthor) { authorRow = this.grdAuthor.Rows[authorRowCount]; authorChecked = ((CheckBox)authorRow.FindControl("chkAuthor")).Checked; if (authorChecked == true && au.Action == "A") { au.Action = "N"; } else if (authorChecked == true && au.Action == "M") { au.Action = "D"; } else if (authorChecked == false && au.Action == "M") { au.Action = "N"; } authorRowCount = authorRowCount + 1; } ATTUserLogin user = ((ATTUserLogin)Session["Login_User_Detail"]); try { if (LM.Action == "A") { if (user.MenuList["4,9,1"] == null || user.MenuList["4,9,1"].PAdd == "N") { this.lblStatusMessage.Text = Utilities.PreviledgeMsg + " add Library Material."; this.programmaticModalPopup.Show(); return; } } else if (LM.Action == "M") { if (user.MenuList["4,9,1"] == null || user.MenuList["4,9,1"].PEdit == "N") { this.lblStatusMessage.Text = Utilities.PreviledgeMsg + " update Library Material."; this.programmaticModalPopup.Show(); return; } } Previlege.PrevilegeType pType = Previlege.PrevilegeType.P_ADD; string modeName = ""; if (LM.Action == "A") { pType = Previlege.PrevilegeType.P_ADD; modeName = "added"; } else if (LM.Action == "M") { pType = Previlege.PrevilegeType.P_EDIT; modeName = "updated"; } Previlege pobj = new Previlege(user.UserName, "4,9,1", 4, pType); Session["LM"] = LM; //save details //save master detail every time if (Session["LibMatID"] == null) { LM.Action = "A"; } else { LM.Action = "M"; LM.LMaterialID = long.Parse(Session["LibMatID"].ToString()); } long LMID = BLLLibraryMaterial.AddLibraryMaterial(LM, pobj); Session["LibMatID"] = LMID; if (this.hdnAction.Value == "M") { if (this.libMatCopyGrd.SelectedIndex > -1) { SaveLibraryDetails(LMID, "M", long.Parse(Session["AccessionID"].ToString())); LoadLibraryMaterialCopyGrid(LMID); } else if (this.libMatCopyGrd.SelectedIndex < 0) { if (this.editionTxt.Text != "" && this.pubDateTxt.Text != "" && this.priceTxt.Text != "" && this.isbnTxt.Text != "") { SaveLibraryDetails(LMID, "A", 0); LoadLibraryMaterialCopyGrid(LMID); } } } else if (this.hdnAction.Value != "M") { if (this.libMatCopyGrd.SelectedIndex > -1) { //update the material copy SaveLibraryDetails(LMID, "M", long.Parse(Session["AccessionID"].ToString())); LoadLibraryMaterialCopyGrid(LMID); } else if (this.libMatCopyGrd.SelectedIndex < 0) { //add new material copy SaveLibraryDetails(LMID, "A", 0); LoadLibraryMaterialCopyGrid(LMID); } } this.ClearLibraryMaterialControl(); this.ClearLMCopyControls(); this.LoadRegDate(); this.lblStatusMessage.Text = "Library material " + modeName + " successfully."; this.programmaticModalPopup.Show(); } catch (Exception ex) { this.lblStatusMessage.Text = ex.Message; this.programmaticModalPopup.Show(); return; } }
protected void btnSubmit_Click(object sender, EventArgs e) { ATTKeyword keywordObj = new ATTKeyword ( 0, this.txtKeywordName_Rqd.Text, ((ATTUserLogin)Session["Login_User_Detail"]).UserName, DateTime.Now ); ObjectValidation OV = BLLKeyword.Validate(keywordObj); if (OV.IsValid == false) { this.lblStatus.Text = OV.ErrorMessage; return; } List <ATTKeyword> lstKey = (List <ATTKeyword>)Session["Keyword_KeywordList"]; ATTUserLogin user = ((ATTUserLogin)Session["Login_User_Detail"]); try { if (this.lstKeyword.SelectedIndex < 0) { if (user.MenuList["4,5,1"] == null || user.MenuList["4,5,1"].PAdd == "N") { this.lblStatus.Text = Utilities.PreviledgeMsg + " add Keyword."; return; } Previlege pobj = new Previlege(user.UserName, "4,5,1", int.Parse(((HiddenField)this.Master.FindControl("hdnApplicationID")).Value), Previlege.PrevilegeType.P_ADD); BLLKeyword.AddKeyword(keywordObj, pobj); lstKey.Add(keywordObj); } else { if (user.MenuList["4,5,1"] == null || user.MenuList[Session["List_Menuname"].ToString()].PEdit == "N") { this.lblStatus.Text = Utilities.PreviledgeMsg + " update Keyword."; return; } Previlege pobj = new Previlege(user.UserName, "4,5,1", int.Parse(((HiddenField)this.Master.FindControl("hdnApplicationID")).Value), Previlege.PrevilegeType.P_EDIT); BLLKeyword.EditKeyword(keywordObj, pobj); lstKey[this.lstKeyword.SelectedIndex] = keywordObj; } this.lstKeyword.DataSource = lstKey; this.lstKeyword.DataTextField = "KeywordName"; this.lstKeyword.DataValueField = "KeywordID"; this.lstKeyword.DataBind(); this.ClearKeywordControl(); } catch (Exception ex) { this.lblStatus.Text = ex.Message; } }