public ClsBaseRowDetail( ClsBase pObj_Base , string pHeaderName , string pTableName , string pViewName = "" , string pOtherLoadCondition = "" , List<string> CustomKeys = null , List<Do_Constants.Str_ForeignKeyRelation> ForeignKeys = null) { if (pViewName == "") pViewName = pTableName; this.mHeaderName = pHeaderName; this.mTableName = pTableName; this.mViewName = pViewName; this.mOtherLoadCondition = pOtherLoadCondition; this.mList_ForeignKey = ForeignKeys; this.mObj_Base = pObj_Base; this.mDa = pObj_Base.pDa; this.mIsCustomKeys = CustomKeys != null; if (CustomKeys == null) { DataTable Dt_Def = this.mDa.GetTableDef(this.mTableName); DataRow[] ArrDr = Dt_Def.Select("IsPk = 1"); foreach (DataRow Dr in ArrDr) { this.mList_Key.Add((string)Dr["ColumnName"]); } } else { this.mList_Key = CustomKeys; } }
public static bool CheckSeriesDuplicate( string TableName , string SeriesField , ClsKeys Keys , string SeriesNo) { bool Rv = false; DataTable Dt; System.Text.StringBuilder Sb_Query_Key = new StringBuilder(); string Query_Key = ""; string Query_And = ""; 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 = new ClsBase().pDa.GetQuery( "[" + TableName + "]" , "Count(1) As [Ct]" , Query_Key + " And " + SeriesField + " = '" + SeriesNo + "'"); if (Dt.Rows.Count > 0) { if ((Int32)Dt.Rows[0][0] > 0) { Rv = true; } } //True means duplicates have been found return Rv; }
/// <summary> /// Adds a ClsBase object to the collection /// </summary> /// <param name="Name"> /// The name of the ClsBase object to be used for retrieval /// </param> /// <param name="Obj"> /// The ClsBase object to be added /// </param> public void Add(string Name, ClsBase Obj) { this.mList_Obj.Add(new Str_Obj(Name, Obj)); }
public Str_Obj(string pName, ClsBase pObj) { this.Name = pName; this.Obj = pObj; }
public static string GetSeriesNo(string Name) { string Rv = ""; DataTable Dt; string TableName; string FieldName; string Prefix; Int32 Digits; Dt = new ClsBase().pDa.GetQuery("System_DocumentSeries", "", "ModuleName = '" + Name + "'"); if (Dt.Rows.Count > 0) { TableName = (string)Do_Methods.IsNull(Dt.Rows[0]["TableName"], ""); FieldName = (string)Do_Methods.IsNull(Dt.Rows[0]["FieldName"], ""); Prefix = (string)Do_Methods.IsNull(Dt.Rows[0]["Prefix"], ""); Digits = (Int32)Do_Methods.IsNull(Dt.Rows[0]["Digits"], ""); } else { return Rv; } List<DataObjects_Framework.Common.Do_Constants.Str_Parameters> Sp = new List<DataObjects_Framework.Common.Do_Constants.Str_Parameters>(); Sp.Add(new DataObjects_Framework.Common.Do_Constants.Str_Parameters("@TableName", TableName)); Sp.Add(new DataObjects_Framework.Common.Do_Constants.Str_Parameters("@FieldName", FieldName)); Sp.Add(new DataObjects_Framework.Common.Do_Constants.Str_Parameters("@Prefix", Prefix)); Sp.Add(new DataObjects_Framework.Common.Do_Constants.Str_Parameters("@Digits", Digits)); Dt = new ClsConnection_SqlServer().ExecuteQuery("usp_GetSeriesNo", Sp).Tables[0]; if (Dt.Rows.Count > 0) { Rv = (string)Dt.Rows[0][0]; } return Rv; }