public static List <ATTLibrary> GetLibraryList(int orgID, int?libraryID, char containDefaultValue) { List <ATTLibrary> LibraryLST = new List <ATTLibrary>(); foreach (DataRow row in DLLLibrary.GetLibraryTable(orgID, libraryID).Rows) { ATTLibrary library = new ATTLibrary ( int.Parse(row["Library_ID"].ToString()), orgID, row["Library_Name"].ToString(), row["Location"].ToString(), "a", DateTime.Now ); LibraryLST.Add(library); } if (containDefaultValue.ToString().ToUpper() == "Y") { LibraryLST.Insert(0, new ATTLibrary(0, 0, "--- Select Library ---", "", "", DateTime.Now)); } return(LibraryLST); }
public static ObjectValidation Validate(ATTLibrary objLib) { ObjectValidation OV = new ObjectValidation(); if (objLib.OrgID <= 0) { OV.IsValid = false; OV.ErrorMessage = "Organization ID cannot be blank."; return(OV); } if (objLib.EntryBy == "") { OV.IsValid = false; OV.ErrorMessage = "Invalid user."; return(OV); } if (objLib.LibraryName == "") { OV.IsValid = false; OV.ErrorMessage = "Library name cannot be blank."; return(OV); } //if (objLib.EntryOn != DateTime.Now.Date) //{ // OV.IsValid = false; // OV.ErrorMessage = "Entry date should be current date."; // return OV; //} return(OV); }
public static bool AddLibrary(ATTLibrary obj, Previlege pobj) { try { DLLLibrary.AddLibrary(obj, pobj); return(true); } catch (Exception ex) { throw ex; } }
protected void lslLibrary_SelectedIndexChanged(object sender, EventArgs e) { List <ATTLibrary> lst = (List <ATTLibrary>)Session["Library_LibraryList"]; ATTLibrary library = lst.Find ( delegate(ATTLibrary li) { return(li.LibraryID == int.Parse(this.lslLibrary.SelectedValue) && li.OrgID == int.Parse(this.ddlOrg_Rqd.SelectedValue)); } ); this.txtLibraryName.Text = library.LibraryName; this.txtLibraryLocation.Text = library.Location; }
protected void drpOrganisation_SelectedIndexChanged(object sender, EventArgs e) { try { this.drpLibrary.Items.Clear(); Session["Rpt"] = null; if (this.drpOrganisation.SelectedIndex > 0) { List <ATTLibrary> lstLib = (List <ATTLibrary>)Session["LibList"]; ATTLibrary ObjLibraryName = new ATTLibrary(); ObjLibraryName.LstLibraryName = lstLib.FindAll( delegate(ATTLibrary Lib) { return(Lib.OrgID == int.Parse(this.drpOrganisation.SelectedValue)); } ); this.drpLibrary.DataSource = ObjLibraryName.LstLibraryName; this.drpLibrary.DataTextField = "LibraryName"; this.drpLibrary.DataValueField = "LibraryID"; this.drpLibrary.DataBind(); ListItem a = new ListItem(); a.Selected = true; a.Text = "Select Library"; a.Value = "0"; drpLibrary.Items.Insert(0, a); drpLibrary.Enabled = true; } else { drpLibrary.Enabled = false; } } catch (Exception ex) { lblStatus.Text = ex.Message; } }
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(); } }
public static List <ATTLibrary> GetLibraryNameList() { List <ATTLibrary> lstLibraryName = new List <ATTLibrary>(); try { foreach (DataRow row in DLLLibrary.GetLibraryNameListTable().Rows) { ATTLibrary LibObj = new ATTLibrary (int.Parse(row["org_id"].ToString()), int.Parse(row["Library_ID"].ToString()), row["Library_Name"].ToString() ); lstLibraryName.Add(LibObj); } return(lstLibraryName); } catch (Exception ex) { throw ex; } }
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; } }