public override void Load(Keys Keys = null) { base.Load(Keys); DataTable Dt; if (Keys == null) { List<QueryParameter> Sp = new List<QueryParameter>(); Sp.Add(new QueryParameter("@ID", 0)); Dt = Do_Methods_Query.ExecuteQuery("usp_Rights_Details_Load", Sp).Tables[0]; } else { Int64 ID = 0; try { ID = Keys["RightsID"]; } catch { } List<QueryParameter> Sp = new List<QueryParameter>(); Sp.Add(new QueryParameter("@ID", ID)); Dt = Do_Methods_Query.ExecuteQuery("usp_Rights_Details_Load", Sp).Tables[0]; } this.AddRequired(Dt); this.pTableDetail_Set("Rights_Details", Dt); }
public override void Load(Keys Keys = null) { base.Load(Keys); List<string> KeyNames = new List<string>(); KeyNames.Add("DocumentItemID"); Keys = this.GetKeys(this.pDr, KeyNames); this.mObj_DocumentItem.Load(Keys); }
public override void Load(Keys Keys = null) { base.Load(Keys); List<string> KeyNames = new List<string>(); KeyNames.Add("PartyID"); Keys = this.GetKeys(this.pDr, KeyNames); this.mObj_Party.Load(Keys); }
public override void Load(Keys Keys = null) { //Interface_DataAccess Da = this.CreateDataAccess(); //try { base.Load(Da, Keys); } //catch (Exception Ex) { throw Ex; } //finally { Da.Close(); } base.Load(Keys); }
public override void Load(Keys Keys, Base Obj_Parent = null) { base.Load(Keys, Obj_Parent); DataRow[] ArrDr = this.pDt_List.Select("", "OrderIndex"); int Ct = 0; foreach (DataRow Dr in ArrDr) { Ct++; Dr["OrderIndex"] = Ct; } this.FixOrderIndex(true); this.pDt_List.DefaultView.Sort = "OrderIndex"; }
public override void Load(Keys Keys, DataObjects_Framework.BaseObjects.Base Obj_Parent = null) { Interface_DataAccess Da = Do_Methods.CreateDataAccess(); try { if (this.mIsCache) { Da.Connect(Do_Methods.Convert_String(Do_Globals.gSettings.pCollection[Layer01_Constants.CnsConnectionString_Cache])); } else { Da.Connect(); } base.Load(Da, Keys, Obj_Parent); } catch (Exception Ex) { throw Ex; } finally { Da.Close(); } }
public override void Load(Keys Keys = null) { base.Load(Keys); Int64 ID = 0; if (Keys != null) { try { ID = Keys["RecruitmentTestRightsID"]; } catch { } } List<QueryParameter> Params = new List<QueryParameter>(); Params.Add(new QueryParameter("ID", ID)); DataTable Dt; Dt = Do_Methods_Query.ExecuteQuery("usp_RecruitmentTestRights_Details_Load", Params).Tables[0]; this.AddRequired(Dt); this.pTableDetail_Set("RecruitmentTestRights_Details", Dt); }
void Save() { ClsUser Obj_User = new ClsUser(); Keys Key = new Keys(); Key.Add(Obj_User.pHeader_TableKey, this.Master.pCurrentUser.pUserID); Obj_User.Load(Key); Obj_User.pDr["Password"] = this.Txt_Password.Text; Obj_User.Save(); //[-] Hashtable Ht = new System.Collections.Hashtable(); Ht.Add("IsSave", true); this.Session[Layer01_Constants_Web.CnsSession_TmpObj] = Ht; string Url = this.Request.Url.AbsolutePath; this.Response.Redirect(Url); }
public override void Load(Keys Keys = null) { base.Load(Keys); //[-] //foreach (DataRow Dr in this.pDt_ContactPerson.Rows) //{ // ClsPerson Inner_Obj = new ClsPerson(this.mCurrentUser); // Keys Inner_Keys = null; // Int64 Inner_PersonID = Convert.ToInt64(Do_Methods.IsNull(Dr["PersonID"], 0)); // if (Inner_PersonID != 0) // { // Inner_Keys = new Keys(); // Inner_Keys.Add("PersonID", Inner_PersonID); // } // Inner_Obj.Load(Inner_Keys); // this.mBO_Details_Person.Add(Convert.ToInt64(Do_Methods.IsNull(Dr["TmpKey"], 0)).ToString(), Inner_Obj); //} }
public static bool CheckSeriesDuplicate( string TableName , string SeriesField , Keys Keys , string SeriesNo) { bool Rv = false; DataTable Dt; StringBuilder Sb_Query_Key = new StringBuilder(); string Query_Key = ""; string Query_And = ""; if (Keys != null) { foreach (string Inner_Key in Keys.pName) { Sb_Query_Key.Append(Query_And + " " + Inner_Key + " = " + Keys[Inner_Key]); Query_And = " And "; } } Query_Key = " 1 = 1 "; if (Sb_Query_Key.ToString() != "") { Query_Key = "(Not (" + Sb_Query_Key.ToString() + "))"; } Dt = Do_Methods_Query.GetQuery( "[" + TableName + "]" , "Count(1) As [Ct]" , Query_Key + " And " + SeriesField + " = '" + SeriesNo + "'"); if (Dt.Rows.Count > 0) { if (Do_Methods.Convert_Int64(Dt.Rows[0][0]) > 0) { Rv = true; } } //True means duplicates have been found return Rv; }
protected override void DeleteRecord(long KeyID) { /* Customer DeleteRecord Rights A Question Record can be deleted by: The user who created the record and has the Delete Rights and the record is not approved. A user who has the Delete and View Rights and the record is not approved. */ Keys ClsKey = new Keys(); ClsKey.Add("RecruitmentTestQuestionsID", Convert.ToInt64(KeyID)); ClsQuestion Obj_Question = new ClsQuestion(this.pCurrentUser); Obj_Question.Load(ClsKey); if (this.pCurrentUser.CheckAccess(Layer02_Constants.eSystem_Modules.Question, Layer02_Constants.eAccessLib.eAccessLib_Delete)) { Int64 CurrentUserID = Do_Methods.Convert_Int64(this.pCurrentUser.pDrUser["RecruitmentTestUserID"], 0); Int64 OwnerUserID = Do_Methods.Convert_Int64(Obj_Question.pDr["RecruitmentTestUserID_CreatedBy"], 0); bool IsApproved = Do_Methods.Convert_Boolean(Obj_Question.pDr["IsApproved"]); if (! ( ( (CurrentUserID == OwnerUserID) || (this.pCurrentUser.CheckAccess(Layer02_Constants.eSystem_Modules.Question, Layer02_Constants.eAccessLib.eAccessLib_View)) ) && (!IsApproved) ) ) { this.Show_EventMsg("You can't delete this question.", ClsBaseMain_Master.eStatus.Event_Error); } else { Obj_Question.Delete(); } } this.pGridList.RebindGrid(); }
/// <summary> /// Loads the List with the supplied Key. /// </summary> /// <param name="Keys"> /// Key object to use, if null, it implies to create a new data object. /// </param> /// <param name="Obj_Parent"> /// The Parent Data Object. /// </param> public override void Load(Keys Keys, Base Obj_Parent = null) { try { this.mDa.Connect(); this.Load(this.mDa, Keys, Obj_Parent); } catch (Exception Ex) { throw Ex; } finally { this.mDa.Close(); } }
public override void Load(Keys Keys) { String Condition = ""; if (this.mLookupID != 0) { Condition = "LookupID = " + this.mLookupID.ToString(); } base.Load(Condition); this.mDt_List.Columns.Add("IsDuplicate", typeof(Boolean)); }
protected override void Save_Add() { if (this.mLookupID == 0) { foreach (DataRow Dr in base.mDt_List.Rows) { ClsRowProperty Rp = new ClsRowProperty(this.mCurrentUser); Keys Keys = new Keys(); Int64 RowPropertyID = Do_Methods.Convert_Int64(Dr["RowPropertyID"]); if (RowPropertyID == 0) { Keys = null; } else { Keys.Add("RowPropertyID", RowPropertyID); } Rp.Load(Keys); Rp.pDr["Code"] = Do_Methods.Convert_String(Dr["Code"]); Rp.pDr["Remarks"] = Do_Methods.Convert_String(Dr["Desc"]); Rp.Save(); Dr["RowPropertyID"] = Rp.pDr["RowPropertyID"]; } } else { foreach (DataRow Dr in base.mDt_List.Rows) { Dr["LookupID"] = this.mLookupID; } } }
/// <summary> /// Loads the List with the supplied Key. /// </summary> /// <param name="Da"> /// An open DataAccess Object to be used. /// </param> /// <param name="Keys"> /// Key object to use, if null, it implies to create a new data object. /// </param> /// <param name="Obj_Parent"> /// The Parent Data Object. /// </param> public override void Load(DataAccess.Interface_DataAccess Da, Keys Keys, Base Obj_Parent = null) { if (Keys == null) { this.New(); } else { QueryCondition Qc = this.mDa.CreateQueryCondition(); foreach (string KeyName in Keys.pName) { Qc.Add(KeyName, Keys[KeyName].ToString(), typeof(Int64).ToString(), "0"); } if (this.mQc_LoadCondition != null) { foreach (QueryCondition.Str_QueryCondition Str_Qc in this.mQc_LoadCondition.pList) { Qc.pList.Add(Str_Qc); } } this.Load(Da, Qc); } if (this.mBase_ListObject != null) { foreach (BaseListObject Lo in this.mBase_ListObject) { Lo.Load(Da, Keys); } } this.mObj_Parent = Obj_Parent; }
public void Login_Mayari(Int64 MayariID) { Keys Key = new Keys(); Key.Add("MayariID", MayariID); ClsMayari Obj_Mayari = new ClsMayari(null); Obj_Mayari.Load(Key); this.mDr_Mayari = Obj_Mayari.pDr; this.pIsLoggedIn = true; }
protected virtual void Delete() { Int64 KeyID = this.pObj_Base.pID; Keys ClsKey = new Keys(); ClsKey.Add(this.pObj_Base.pHeader_TableKey, KeyID); Base Obj_Base = (Base)Activator.CreateInstance(this.pObj_Base.GetType(), new object[] { this.pCurrentUser }); Obj_Base.Load(ClsKey); Obj_Base.Delete(); }
public override void Load(Keys Keys = null) { base.Load(Keys); //[-] Int64 ContactPersonID = Convert.ToInt64(Do_Methods.IsNull(this.pDr["ContactPersonID"], 0)); if (ContactPersonID != 0) { Keys = new Keys(); Keys.Add("ContactPersonID", ContactPersonID); } else { Keys = null; } this.mObj_ContactPerson.Load(Keys); //this.mObj_ShippingAddress.Load(Keys, this); //[-] //foreach (DataRow Dr in this.pDt_ShippingAddress.Rows) //{ // ClsAddress Inner_Obj = new ClsAddress(this.mCurrentUser); // Keys Inner_Keys = null; // Int64 Inner_ID = Convert.ToInt64(Do_Methods.IsNull(Dr["AddressID"], 0)); // if (Inner_ID != 0) // { // Inner_Keys = new Keys(); // Inner_Keys.Add("AddressID", Inner_ID); // } // Inner_Obj.Load(Inner_Keys); // this.mBO_ShippingAddress_Address.Add(Convert.ToInt64(Do_Methods.IsNull(Dr["TmpKey"], 0)).ToString(), Inner_Obj); //} }
public void DeleteRecord(Int64 KeyID) { if (this.mProperties.DataSourceType != eDataSourceType.FromBase) { return; } if (!this.pCurrentUser.CheckAccess(this.pSystem_ModulesID, Layer02_Constants.eAccessLib.eAccessLib_Delete)) { throw new CustomException("You have no rights to delete this record."); } Keys ClsKey = new Keys(); ClsKey.Add(this.pProperties.BindDefinition.KeyName, Convert.ToInt64(KeyID)); Base Obj_Base = (Base)Activator.CreateInstance(this.mObj_Base.GetType(), new object[] { this.pCurrentUser }); Obj_Base.Load(ClsKey); Obj_Base.Delete(); this.pGridList.RebindGrid(this.pFilterList.pQc); }
/// <summary> /// Loads the defined Data Object Table Detail /// </summary> /// <param name="ObjectName"> /// The source data object of the Table Detail /// </param> /// <param name="Keys"> /// The ClsKey object to use /// </param> /// <param name="Condition"> /// Additional conditions to be used in fetching the data /// </param> /// <param name="ForeignKeys"> /// Custom defined Keys of the Table Detail /// </param> /// <returns></returns> public DataTable Load_TableDetails(string ObjectName, Keys Keys, string Condition, List<Do_Constants.Str_ForeignKeyRelation> ForeignKeys) { StringBuilder Sb_Condition = new StringBuilder(); DataTable Dt; if (Keys == null) { Dt = this.GetQuery(this.Connection, ObjectName, "*", "1 = 0"); } else { /* string Inner_Condition_And = ""; bool IsStart = false; foreach (string Inner_Key in Keys.pName) { Sb_Condition.Append(Inner_Condition_And + " " + Inner_Key + " = " + Keys[Inner_Key]); if (!IsStart) Inner_Condition_And = " And "; IsStart = true; } string OtherCondition = ""; if (Condition != "") OtherCondition = " And " + Condition; Dt = this.GetQuery(this.Connection, ObjectName, "*", Sb_Condition.ToString() + OtherCondition); */ if (ForeignKeys == null) { string Inner_Condition_And = ""; bool IsStart = false; foreach (string Inner_Key in Keys.pName) { Sb_Condition.Append(Inner_Condition_And + " " + Inner_Key + " = " + Keys[Inner_Key]); if (!IsStart) { Inner_Condition_And = " And "; } IsStart = true; } } else { string Inner_Condition_And = ""; bool IsStart = false; foreach (string Inner_Key in Keys.pName) { Do_Constants.Str_ForeignKeyRelation Fk = ForeignKeys.FirstOrDefault(item => item.Parent_Key == Inner_Key); if (Fk.Parent_Key == string.Empty) { throw new Exception("All foreign keys must match the parent keys."); } Sb_Condition.Append(Inner_Condition_And + " " + Fk.Child_Key + " = " + Keys[Inner_Key]); if (!IsStart) { Inner_Condition_And = " And "; } IsStart = true; } } string OtherCondition = ""; if (Condition != "") { OtherCondition = " And " + Condition; } Dt = this.GetQuery(this.Connection, ObjectName, "*", Sb_Condition.ToString() + OtherCondition); } return Dt; }
public DataTable Load_TableDetails(string ObjectName, Keys Keys, string Condition, List<Do_Constants.Str_ForeignKeyRelation> ForeignKeys) { Connection_Wcf Cn = null; if (this.mConnection == null) { Cn = new Connection_Wcf(); Cn.Connect(); } else { Cn = this.mConnection; } Do_Constants.Str_Request_Load Rl = new Do_Constants.Str_Request_Load(); Rl.ObjectName = ObjectName; Rl.ForeignKeys = ForeignKeys; Rl.Condition = Condition; Rl.Key = Keys; Rl.ConnectionString = Cn.pConnectionString; Do_Constants.Str_Request_Session Rs = new Do_Constants.Str_Request_Session(); Rs.SessionID = ClsDataAccess_Wcf_Session.Instance.pSessionID; Client_WcfService Client = Client_WcfService.CreateObject(); String ResponseData = Client.Load_TableDetails(Rs, Rl); SimpleDataTable Sdt = SimpleDataTable.Deserialize(ResponseData); return Sdt.ToDataTable(); }
void SetupPage() { this.SetupPage_Properties(); //[-] Int64 ID = Do_Methods.Convert_Int64(this.Request.QueryString["ID"]); this.pIsNew = ID == 0; this.Raise_SetupPage_Rights(); //[-] this.Session[CnsBase + this.pObjID] = this.mObj_Base; ClsSysCurrentUser CurrentUser = this.Master.pCurrentUser; Keys Key = null; if (ID != 0) { Key = new Keys(); Key.Add(this.mObj_Base.pHeader_TableKey, ID); } this.mObj_Base.Load(Key); }
public void LoadExam(Int64 ExamID, Int64 ItemsLimit) { DataTable Dt_Exam = Do_Methods_Query.GetQuery("RecruitmentTestExams", "", "RecruitmentTestExamsID = " + ExamID); Int64 ApplicantID = 0; if (Dt_Exam.Rows.Count > 0) { this.mDr_Exam = Dt_Exam.Rows[0]; ApplicantID = Convert.ToInt64(Do_Methods.IsNull(this.mDr_Exam["RecruitmentTestApplicantID"], 0)); } else { throw new Exception("Exam Data not found."); } Keys Key = new Keys(); Key.Add("RecruitmentTestApplicantID", ApplicantID); this.mObj_Applicant = new ClsApplicant(); this.mObj_Applicant.Load(Key); DataSet Ds = this.mEm.LoadExam(ExamID); this.mDs = Ds; this.mDt_Question = Ds.Tables[0]; this.mDt_Question_Answer = Ds.Tables[1]; this.mDt_Question.Columns.Add("Ct", typeof(Int64)); Int64 Ct = 0; foreach (DataRow Dr in this.mDt_Question.Rows) { Ct++; Dr["Ct"] = Ct; } this.mDt_Question_Answer.Columns.Add("Ct", typeof(Int64)); Ct = 0; foreach (DataRow Dr in this.mDt_Question_Answer.Rows) { Ct++; Dr["Ct"] = Ct; } this.mItemsLimit = ItemsLimit; this.mItems = this.mDt_Question.Rows.Count; this.mPages = this.mItems / this.mItemsLimit; if (this.mItems % this.mItemsLimit > 0) { this.mPages++; } }
public override void Load(Keys Keys = null) { base.Load(Keys); this.CheckIfDeleted(); //[-] Int64 QuestionID = Convert.ToInt64(Do_Methods.IsNull(this.pDr["RecruitmentTestQuestionsID"], 0)); if (QuestionID != 0) { Keys = new Keys(); Keys.Add("Lkp_RecruitmentTestQuestionsID", QuestionID); } else { Keys = null; } this.mBL_QuestionAnswer.Load(Keys, this); //foreach (DataRow Dr in this.mBL_QuestionAnswer.pDt_List.Rows) //{ // ClsAnswer Inner_Obj = new ClsAnswer(); // ClsKeys Inner_Keys = null; // Int64 Inner_ID = Convert.ToInt64(Do_Methods.IsNull(Dr["Lkp_RecruitmentTestAnswersID"], 0)); // if (Inner_ID != 0) // { // Inner_Keys = new ClsKeys(); // Inner_Keys.Add("RecruitmentTestAnswersID", Inner_ID); // } // Inner_Obj.Load(Inner_Keys); // this.mBO_Answer.Add(Convert.ToInt64(Do_Methods.IsNull(Dr["TmpKey"], 0)).ToString(), Inner_Obj); //} //DataRow[] ArrDr = this.mBL_QuestionAnswer.pDt_List.Select("", "OrderIndex"); //int Ct = 0; //foreach (DataRow Dr in ArrDr) //{ // Ct++; // Dr["OrderIndex"] = Ct; //} //this.FixOrderIndex(true); //this.mBL_QuestionAnswer.pDt_List.DefaultView.Sort = "OrderIndex"; }
/// <summary> /// Loads the Data Object with the supplied Key, /// when loading table details, the framework assumes the foreign key field of the table detail is the same the parent table /// if not supplied by an explicit foreign key definition /// </summary> /// <param name="ObjectName"> /// The source data object to be fetched /// </param> /// <param name="List_Key"> /// The defined Key names of the data objects /// </param> /// <param name="Keys"> /// The ClsKey object to use /// </param> /// <returns></returns> public DataRow Load(string ObjectName, List<string> List_Key, Keys Keys) { DataTable Dt; DataRow Dr; if (Keys == null) { //Dr = this.GetQuery(this.Connection, ObjectName, "*", "1 = 0").NewRow(); Dt = this.GetQuery(this.Connection, ObjectName, "*", "1 = 0"); Dr = Dt.NewRow(); Dt.Rows.Add(Dr); } else { StringBuilder Sb_Condition = new StringBuilder(); if (Keys.Count() != List_Key.Count) { throw new Exception("Keys not equal to required keys."); } Sb_Condition.Append(" 1 = 1 "); foreach (string Inner_Key in List_Key) { Sb_Condition.Append(" And " + Inner_Key + " = " + Keys[Inner_Key]); } Dt = this.GetQuery(this.Connection, ObjectName, "*", Sb_Condition.ToString()); if (Dt.Rows.Count > 0) { Dr = Dt.Rows[0]; } else { throw new CustomException("Record not found."); } } return Dr; }
public DataRow Load(string ObjectName, List<string> List_Key, Keys Keys) { Connection_Wcf Cn = this.GetConnection(); Do_Constants.Str_Request_Load Rl = new Do_Constants.Str_Request_Load(); Rl.ObjectName = ObjectName; Rl.ObjectKeys = List_Key; Rl.Key = Keys; Rl.ConnectionString = Cn.pConnectionString; Do_Constants.Str_Request_Session Rs = new Do_Constants.Str_Request_Session(); Rs.SessionID = ClsDataAccess_Wcf_Session.Instance.pSessionID; Client_WcfService Client = Client_WcfService.CreateObject(); String ResponseData = Client.Load(Rs, Rl); SimpleDataRow Sdr = SimpleDataRow.Deserialize(ResponseData); return Sdr.ToDataRow(); }
/// <summary> /// Loads the table detail data /// </summary> /// <param name="Da"> /// An open DataAccess object from calling method /// </param> /// <param name="Keys"> /// Key Object to use /// </param> public void Load(Interface_DataAccess Da, Keys Keys) { this.mDt = Da.Load_TableDetails(this.mViewName, Keys, this.mOtherLoadCondition, this.mList_ForeignKey); }