public void UpdatePriceHistory(Int64 ItemID) { DataTable Dt_Item = Do_Methods_Query.GetQuery("Item", "", "ItemID = " + ItemID); DataRow Dr_Item = null; if (Dt_Item.Rows.Count > 0) { Dr_Item = Dt_Item.Rows[0]; } else { return; } DateTime ServerDate = Layer02_Common.GetServerDate(); DataTable Dt_PriceHistory = Do_Methods_Query.GetQuery("Item_PriceHistory", "", "1 = 0"); DataRow Dr_PriceHistory = Dt_PriceHistory.NewRow(); Dr_PriceHistory["ItemID"] = ItemID; Dr_PriceHistory["Price"] = Dr_Item["Price"]; Dr_PriceHistory["EmployeeID_PostedBy"] = this.mCurrentUser.pDrUser["EmployeeID"]; Dr_PriceHistory["DatePosted"] = ServerDate; Interface_DataAccess Da = Do_Methods.CreateDataAccess(); try { Da.Connect(); Da.SaveDataRow(Dr_PriceHistory, "Item_PriceHistory"); } catch { } finally { Da.Close(); } }
void SetupPage() { this.SetupPage_Lookups(); this.Txt_EmployeeCode.Text = (string)Do_Methods.IsNull(this.mObj.pDr["EmployeeCode"], ""); this.Txt_LeaveVacation.Text = Convert.ToInt32(Do_Methods.IsNull(this.mObj.pDr["Leave_Vacation"], 0)).ToString("#,##0"); //Methods.Convert_Int32(this.mObj.pDr["Leave_Vacation"]).ToString(); this.Txt_LeaveSick.Text = Convert.ToInt32(Do_Methods.IsNull(this.mObj.pDr["Leave_Sick"], 0)).ToString("#,##0"); //Methods.Convert_Int32(this.mObj.pDr["Leave_Sick"]).ToString(); this.Txt_LeaveBereavement.Text = Convert.ToInt32(Do_Methods.IsNull(this.mObj.pDr["Leave_Bereavement"], 0)).ToString("#,##0"); //Methods.Convert_Int32(this.mObj.pDr["Leave_Bereavement"]).ToString(); this.Txt_Position.Text = (string)Do_Methods.IsNull(this.mObj.pDr["Position"], ""); this.Txt_Pay.Text = Do_Methods.Convert_Double(this.mObj.pDr["Pay"].ToString()).ToString("#,##0.00"); this.Txt_SIN.Text = (string)Do_Methods.IsNull(this.mObj.pDr["SIN"], ""); this.EODtp_DateHired.VisibleDate = DateTime.Now; this.EODtp_DateHired.SelectedDate = !Microsoft.VisualBasic.Information.IsDBNull(this.mObj.pDr["DateHired"]) ? (DateTime)this.mObj.pDr["DateHired"] : new DateTime(); this.EODtp_DateTerminate.VisibleDate = DateTime.Now; this.EODtp_DateTerminate.SelectedDate = !Microsoft.VisualBasic.Information.IsDBNull(this.mObj.pDr["DateTerminate"]) ? (DateTime)this.mObj.pDr["DateTerminate"] : new DateTime(); DataTable Dt_Defaults = Do_Methods_Query.GetQuery("uvw_Lookup"); this.Cbo_Department.SelectedValue = ((Int64)Do_Methods.IsNull(this.mObj.pDr["LookupID_Department"], this.SetupPage_GetLookupDefault(Dt_Defaults, Layer01_Constants.eLookup.Department))).ToString(); this.Cbo_PayRate.SelectedValue = ((Int64)Do_Methods.IsNull(this.mObj.pDr["LookupID_PayRate"], this.SetupPage_GetLookupDefault(Dt_Defaults, Layer01_Constants.eLookup.PayRate))).ToString(); this.Cbo_EmployeeType.SelectedValue = ((Int64)Do_Methods.IsNull(this.mObj.pDr["LookupID_EmployeeType"], this.SetupPage_GetLookupDefault(Dt_Defaults, Layer01_Constants.eLookup.EmployeeType))).ToString(); this.UcPerson.Setup(this.mObj.pObj_Person); this.UcAddress.Setup(this.mObj.pObj_Address); }
void SetupPage() { DataTable Dt = Do_Methods_Query.GetQuery( "System_Modules" , "" , "System_ModulesID = " + this.mSystem_ModulesID); string Override_ModuleName = (string)this.ViewState[CnsModuleName]; if (Override_ModuleName == "") { if (Dt.Rows.Count > 0) { Override_ModuleName = (string)Do_Methods.IsNull(Dt.Rows[0]["Name"], ""); } } this.Lbl_ModuleName.Text = Override_ModuleName; if (!this.mCurrentUser.CheckAccess(this.mSystem_ModulesID, Layer01_Common.Common.Layer01_Constants.eAccessLib.eAccessLib_Access)) { throw new Exception("You have no access in this page."); } if (!this.mCurrentUser.CheckAccess(this.mSystem_ModulesID, Layer01_Common.Common.Layer01_Constants.eAccessLib.eAccessLib_New)) { this.Btn_New.Enabled = false; } this.Txt_Top.Text = "50"; this.BindGrid(); this.Lbl_AppliedFilters.Text = this.Details_ItemsCount(); this.RaiseSetupPage_Done(); }
protected Int64 List_Count(QueryCondition Condition = null) { DataRow Dr_Bind = Do_Methods_Query.GetSystemBindDefinition(this.mSystem_BinDefinition_Name); string Bind_Condition = (string)Do_Methods.IsNull(Dr_Bind["Condition"], ""); string Bind_Sort = (string)Do_Methods.IsNull(Dr_Bind["Sort"], ""); string Query_Condition = ""; if (Bind_Condition.Trim() != "") { Query_Condition = " Where " + Bind_Condition; } string Source = (string)this.ViewState[CnsSource]; if (Source == "") { Source = this.mObj_Base.pHeader_ViewName; } string Query = @"(Select * From " + Source + " " + Query_Condition + " ) As [Tb]"; Interface_DataAccess Da = this.mObj_Base.CreateDataAccess(); //DataTable Dt = Do_Methods_Query.GetQuery(Query, "Count(1) As [Ct]", Condition); DataTable Dt = Da.GetQuery(Query, "Count(1) As [Ct]", Condition); Int64 Rv = 0; try { Rv = Convert.ToInt64(Do_Methods.IsNull(Dt.Rows[0]["Ct"], 0)); } catch { } return(Rv); }
public static List <ClsBindGridColumn> GetBindGridColumn(string Name) { List <ClsBindGridColumn> List_Gc = new List <ClsBindGridColumn>(); ClsBindGridColumn Gc; DataTable Dt_Def = Do_Methods_Query.GetQuery(@"udf_System_BindDefinition('" + Name + "')", "", "", "OrderIndex"); foreach (DataRow Dr in Dt_Def.Rows) { Gc = new ClsBindGridColumn( (string)Do_Methods.IsNull(Dr["Name"], "") , (string)Do_Methods.IsNull(Dr["Desc"], "") , (Int32)Do_Methods.IsNull(Dr["Width"], 0) , (string)Do_Methods.IsNull(Dr["NumberFormat"], "") , (Layer01_Common.Common.Layer01_Constants.eSystem_Lookup_FieldType)Do_Methods.IsNull(Dr["System_LookupID_FieldType"], Layer01_Common.Common.Layer01_Constants.eSystem_Lookup_FieldType.FieldType_Static) , !(bool)Do_Methods.IsNull(Dr["IsHidden"], false) , !(bool)Do_Methods.IsNull(Dr["IsReadOnly"], false)); Gc.mButtonType = (ButtonColumnType)Do_Methods.IsNull(Dr["System_LookupID_ButtonType"], ButtonColumnType.LinkButton); Gc.mFieldText = (string)Do_Methods.IsNull(Dr["FieldText"], ""); List_Gc.Add(Gc); } return(List_Gc); }
public static List <ClsBindGridColumn_EO> BindEOGrid( ref EO.Web.Grid EOGrid , string Name , string TableKey = "" , bool AllowSort = true , bool HasDelete = false) { DataTable Dt_Bind = Do_Methods_Query.GetQuery("System_BindDefinition", "", @"Name = '" + Name + "'"); DataRow Dr_Bind; if (Dt_Bind.Rows.Count > 0) { Dr_Bind = Dt_Bind.Rows[0]; } else { throw new Exception("Bind Definition not found."); } List <ClsBindGridColumn_EO> Gc = GetBindGridColumn_EO(Name); DataTable Dt = Do_Methods_Query.GetQuery( (string)Do_Methods.IsNull(Dr_Bind["TableName"], "") , "" , (string)Do_Methods.IsNull(Dr_Bind["Condition"], "") , (string)Do_Methods.IsNull(Dr_Bind["Sort"], "")); if (TableKey.Trim() != "") { TableKey = (string)Do_Methods.IsNull(Dr_Bind["TableKey"], ""); } BindEOGrid(ref EOGrid, Dt, Gc, TableKey, AllowSort, HasDelete); return(Gc); }
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); }
void SetupPage_Lookups() { Layer01_Methods_Web.BindCombo(ref this.Cbo_Category, Do_Methods_Query.GetLookup("Category"), "LookupID", "Desc", 0, "-Select-"); Layer01_Methods_Web.BindCombo(ref this.Cbo_ItemType, Do_Methods_Query.GetLookup("ItemType"), "LookupID", "Desc", 0, "-Select-"); Layer01_Methods_Web.BindCombo(ref this.Cbo_Brand, Do_Methods_Query.GetLookup("Brand"), "LookupID", "Desc", 0, "-Select-"); Layer01_Methods_Web.BindCombo(ref this.Cbo_Retailer, Do_Methods_Query.GetLookup("Retailer"), "LookupID", "Desc", 0, "-Select-"); Layer01_Methods_Web.BindCombo(ref this.Cbo_ItemUOM, Do_Methods_Query.GetLookup("UOM"), "LookupID", "Desc", 0, "-Select-"); }
public void Show_UseQuery( string SelectionName , string SelectionQuery , string SelectionQuery_Key , string Title = "" , bool IsMultipleSelect = false , string Data = "") { this.ViewState[CnsData] = Data; this.ViewState[CnsQuery_Selection] = @"( " + SelectionQuery + @") As [Tb]"; this.ViewState[CnsQuery_Selection_Key] = SelectionQuery_Key; this.ViewState[CnsObj_QueryCondition] = null; this.mSelectionName = SelectionName; this.mIsMultipleSelect = IsMultipleSelect; this.mQuery_Selection = (string)this.ViewState[CnsQuery_Selection]; this.mQuery_Selection_Key = (string)this.ViewState[CnsQuery_Selection_Key]; this.ViewState[CnsSelectionName] = SelectionName; this.ViewState[CnsIsMultipleSelect] = IsMultipleSelect; this.Panel_Check.Visible = IsMultipleSelect; //[-] DataTable Dt = new DataTable(); Dt.Columns.Add("ID", typeof(Int64)); Dt.Columns.Add("IsSelect", typeof(bool)); this.mDt_Selected = Dt; this.ViewState[CnsDt_Selected] = Dt; //[-] this.BindGrid(); this.Lbl_AppliedFilters.Text = this.Details_ItemsCount(); //[-] DataRow Dr_Bind = Do_Methods_Query.GetSystemBindDefinition(SelectionName); if (Title == "") { Title = (string)Do_Methods.IsNull(Dr_Bind["Desc"], ""); } if (Title == "") { Title = "Select"; } this.EODialog_Selection.HeaderHtml = Title; this.EODialog_Selection.ClientSideOnAccept = "Selection_Accept_" + this.ClientID; this.EODialog_Selection.Show(); try { this.EOCbp_EODialog_Selection.Update(); } catch { } }
void Back() { DataTable Dt = Do_Methods_Query.GetQuery("System_Modules", "", "System_ModulesID = " + this.mSystem_ModulesID.ToString()); string Url = ""; if (Dt.Rows.Count > 0) { Url = "~/" + (string)Do_Methods.IsNull(Dt.Rows[0]["PageUrl_List"], ""); } this.Response.Redirect(Url); }
List <ClsBindGridColumn_EO> BindGrid(DataTable Dt_List) { bool IsReadOnly = false; if ( !(this.mCurrentUser.CheckAccess(this.mSystem_ModulesID, Layer01_Common.Common.Layer01_Constants.eAccessLib.eAccessLib_Edit) || this.mCurrentUser.CheckAccess(this.mSystem_ModulesID, Layer01_Common.Common.Layer01_Constants.eAccessLib.eAccessLib_View)) ) { IsReadOnly = true; } bool IsNoSelect = false; try { IsNoSelect = (bool)this.ViewState[CnsIsNoSelect]; } catch { } if (IsNoSelect) { IsReadOnly = true; } DataRow Dr_Bind = Do_Methods_Query.GetSystemBindDefinition(this.mSystem_BinDefinition_Name); List <ClsBindGridColumn_EO> List_Gc = Layer01_Methods_Web_EO.GetBindGridColumn_EO(this.mSystem_BinDefinition_Name); if (!IsReadOnly) { ClsBindGridColumn_EO Gc = new ClsBindGridColumn_EO("", "", 50, "", Layer01_Common.Common.Layer01_Constants.eSystem_Lookup_FieldType.FieldType_Button); Gc.mCommandName = "Select"; Gc.mFieldText = ">>"; Gc.mButtonType = ButtonColumnType.LinkButton; List_Gc.Insert(0, Gc); } string TableKey = ""; if (this.mObj_Base != null) { TableKey = this.mObj_Base.pHeader_TableKey; } else { TableKey = (string)this.ViewState[CnsSourceKey]; if (TableKey == "") { TableKey = (string)Do_Methods.IsNull(Dr_Bind["TableKey"], ""); } } this.EOGrid_List.ClientSideOnItemCommand = "EOGrid_ItemCommand"; this.EOGrid_List.FullRowMode = true; Layer01_Methods_Web_EO.BindEOGrid(ref this.EOGrid_List, Dt_List, List_Gc, TableKey, false, false); return(List_Gc); }
//[-] List <ClsBindGridColumn_EO> BindGrid( DataTable Dt_List , eCheck Check = eCheck.None) { DataRow Dr_Bind = Do_Methods_Query.GetSystemBindDefinition(this.mSelectionName); List <ClsBindGridColumn_EO> List_Gc = Layer01_Methods_Web_EO.GetBindGridColumn_EO(this.mSelectionName); string Bind_TableKey = (string)Do_Methods.IsNull(Dr_Bind["TableKey"], ""); string TableKey = (string)this.ViewState[CnsQuery_Selection_Key]; if (TableKey != "") { Bind_TableKey = TableKey; } Dt_List.Columns.Add("IsSelect", typeof(bool)); ClsBindGridColumn_EO Gc = new ClsBindGridColumn_EO( "IsSelect" , "Select?" , 80 , "" , Layer01_Common.Common.Layer01_Constants.eSystem_Lookup_FieldType.FieldType_Checkbox , this.mIsMultipleSelect); List_Gc.Insert(0, Gc); if (Check == eCheck.None) { foreach (DataRow Dr in this.mDt_Selected.Rows) { DataRow[] Inner_ArrDr = Dt_List.Select(Bind_TableKey + " = " + Convert.ToInt64(Dr["ID"]).ToString()); if (Inner_ArrDr.Length > 0) { Inner_ArrDr[0]["IsSelect"] = Do_Methods.IsNull(Dr["IsSelect"], false); } } } else { bool Inner_IsSelect = Check == eCheck.CheckAll; foreach (DataRow Dr in Dt_List.Rows) { Dr["IsSelect"] = Inner_IsSelect; } } this.EOGrid_Selection.FullRowMode = true; Layer01_Methods_Web_EO.BindEOGrid(ref this.EOGrid_Selection, Dt_List, List_Gc, Bind_TableKey, false, false); return(List_Gc); }
void SetupPage() { this.SetupPage_Lookups(); this.Txt_Code.Text = (string)Do_Methods.IsNull(this.mObj.pDr_RowProperty["Code"], ""); this.Txt_Company.Text = (string)Do_Methods.IsNull(this.mObj.pDr["Company"], ""); this.Lbl_SalesPerson.Text = (string)Do_Methods.IsNull(this.mObj.pDr["EmployeeCodeName_SalesPerson"], "-Select-"); this.Txt_CreditCard_AccountName.Text = (string)Do_Methods.IsNull(this.mObj.pDr["CreditCard_AccountName"], ""); if (!Information.IsDBNull(this.mObj.pDr["CreditCard_Expiration"])) { DateTime CreditCard_Expiration = (DateTime)this.mObj.pDr["CreditCard_Expiration"]; this.Txt_CreditCardExpiration_Month.Text = CreditCard_Expiration.Month.ToString(); this.Txt_CreditCardExpiration_Year.Text = Strings.Right(CreditCard_Expiration.Year.ToString(), 2); } else { this.Txt_CreditCardExpiration_Month.Text = ""; this.Txt_CreditCardExpiration_Year.Text = ""; } this.Txt_CreditCard_Part1.Text = (string)Do_Methods.IsNull(this.mObj.pDr["CreditCardNo1"], ""); this.Txt_CreditCard_Part2.Text = (string)Do_Methods.IsNull(this.mObj.pDr["CreditCardNo2"], ""); this.Txt_CreditCard_Part3.Text = (string)Do_Methods.IsNull(this.mObj.pDr["CreditCardNo3"], ""); this.Txt_CreditCard_Part4.Text = (string)Do_Methods.IsNull(this.mObj.pDr["CreditCardNo4"], ""); this.Chk_IsCreditHold.Checked = (bool)Do_Methods.IsNull(this.mObj.pDr["IsCreditHold"], false); this.Lbl_PST_Value.Text = Strings.Format(Do_Methods.IsNull(this.mObj.pDr["PST_Value"], 0), "#,##0.00"); this.Lbl_HST_Value.Text = Strings.Format(Do_Methods.IsNull(this.mObj.pDr["HST_Value"], 0), "#,##0.00"); this.Lbl_GST_Value.Text = Strings.Format(Do_Methods.IsNull(this.mObj.pDr["GST_Value"], 0), "#,##0.00"); DataTable Dt_Defaults = Do_Methods_Query.GetQuery("uvw_Lookup"); this.Cbo_Currency.SelectedValue = Convert.ToInt64(Do_Methods.IsNull(this.mObj.pDr["LookupID_Currency"], this.SetupPage_GetLookupDefault(Dt_Defaults, Layer01_Common.Common.Layer01_Constants.eLookup.Currency))).ToString(); this.Cbo_PaymentTerm.SelectedValue = Convert.ToInt64(Do_Methods.IsNull(this.mObj.pDr["LookupID_PaymentTerm"], this.SetupPage_GetLookupDefault(Dt_Defaults, Layer01_Common.Common.Layer01_Constants.eLookup.PaymentTerm))).ToString(); this.Cbo_TaxCode.SelectedValue = Convert.ToInt64(Do_Methods.IsNull(this.mObj.pDr["LookupTaxCodeID"], 0)).ToString(); this.Cbo_ClientType.SelectedValue = Convert.ToInt64(Do_Methods.IsNull(this.mObj.pDr["LookupClientTypeID"], this.SetupPage_GetLookupDefault(Dt_Defaults, Layer01_Common.Common.Layer01_Constants.eLookup.ClientType))).ToString(); this.UcPerson.Setup(this.mObj.pObj_Person); this.UcAddress.Setup(this.mObj.pObj_Address); this.UcGrid_ShippingAddress.Setup( "Customer_ShippingAddress" , this.mObj.pDt_ShippingAddress , "TmpKey" , false , true , this.mMaster.pIsReadOnly); this.UcGrid_ShippingAddress.pGrid.ClientSideOnItemCommand = "EOGrid_ItemCommand"; }
private void LoadMenu() { ClsSysCurrentUser CurrentUser = this.mMaster.pCurrentUser; DataTable Dt_Menu; if (CurrentUser.pIsAdmin) { Dt_Menu = Do_Methods_Query.GetQuery("uvw_System_Modules", "", "IsNull(IsHidden,0) = 0", "Parent_OrderIndex, OrderIndex"); } else { List <QueryParameter> Sp = new List <QueryParameter>(); Sp.Add(new QueryParameter(@"@UserID", CurrentUser.pDrUser["UserID"])); Dt_Menu = Do_Methods_Query.ExecuteQuery("usp_System_Modules_Load", Sp).Tables[0]; } this.trvMenus.Nodes.Clear(); foreach (DataRow Dr in Dt_Menu.Rows) { if ((Int64)Do_Methods.IsNull(Dr["Parent_System_ModulesID"], 0) == 0) { TreeNode Node = new TreeNode(); Node.Text = @" " + Dr["Name"]; //Node.ImageUrl = ""; if ((string)Do_Methods.IsNull(Dr["PageUrl_List"], "") != "") { string Arguments = (string)Do_Methods.IsNull(Dr["Arguments"], ""); if (Arguments != "") { Arguments = @"?" + Arguments; } Node.NavigateUrl = @"~/" + Dr["PageUrl_List"] + Arguments; } else { Node.SelectAction = TreeNodeSelectAction.None; } this.trvMenus.Nodes.Add(Node); DataRow[] ArrDr = Dt_Menu.Select("Parent_System_ModulesID = " + ((Int64)Do_Methods.IsNull(Dr["System_ModulesID"], 0)).ToString()); if (ArrDr.Length > 0) { this.AddNode(ref Dt_Menu, Node, (Int64)Do_Methods.IsNull(Dr["System_ModulesID"], 0)); } } } }
string Details_SelectEmployee(Int64 ID) { this.mObj.pDr["EmployeeID_SalesPerson"] = ID; System.Text.StringBuilder Sb_Js = new System.Text.StringBuilder(); DataTable Dt = Do_Methods_Query.GetQuery("uvw_Employee", "", "EmployeeID = " + ID.ToString()); if (Dt.Rows.Count > 0) { this.Lbl_SalesPerson.Text = (string)Do_Methods.IsNull(Dt.Rows[0]["EmployeeCodeName"], ""); Layer01_Methods_Web.Eval_AppendJs(this.Server, ref Sb_Js, this.Lbl_SalesPerson.ClientID, "innerHTML", this.Lbl_SalesPerson.Text); } return(Sb_Js.ToString()); }
public override void SetupPage() { if (this.CheckIsSetup()) { return; } string ModuleName = (string)this.ViewState[CnsModuleName]; if (ModuleName == "") { DataTable Dt = Do_Methods_Query.GetQuery("System_Modules", "", "System_ModulesID = " + this.mSystem_ModulesID); if (Dt.Rows.Count > 0) { ModuleName = (string)Do_Methods.IsNull(Dt.Rows[0]["Name"], "") + " Details"; } } this.Lbl_ModuleName.Text = ModuleName; if ( (!this.mCurrentUser.CheckAccess(this.mSystem_ModulesID, Layer01_Common.Common.Layer01_Constants.eAccessLib.eAccessLib_New)) && (this.mObj_Base.pKey == null)) { throw new Exception("You have no access in this page."); } else if ( (!this.mCurrentUser.CheckAccess(this.mSystem_ModulesID, Layer01_Common.Common.Layer01_Constants.eAccessLib.eAccessLib_New)) || (!this.mCurrentUser.CheckAccess(this.mSystem_ModulesID, Layer01_Common.Common.Layer01_Constants.eAccessLib.eAccessLib_Edit)) || (!this.mCurrentUser.CheckAccess(this.mSystem_ModulesID, Layer01_Common.Common.Layer01_Constants.eAccessLib.eAccessLib_View))) { throw new Exception("You have no access in this page."); } this.pIsReadOnly = true; if ( this.mCurrentUser.CheckAccess(this.mSystem_ModulesID, Layer01_Common.Common.Layer01_Constants.eAccessLib.eAccessLib_New) && this.mCurrentUser.CheckAccess(this.mSystem_ModulesID, Layer01_Common.Common.Layer01_Constants.eAccessLib.eAccessLib_Edit)) { this.pIsReadOnly = false; } this.Btn_Save.Enabled = !this.pIsReadOnly; this.Btn_Save2.Enabled = this.Btn_Save.Enabled; this.SetupPage_ControlAttributes(); }
//[-] DataTable List( QueryCondition Condition = null , string Sort = "" , Int64 Top = 0 , Int32 Page = 0) { DataRow Dr_Bind = Do_Methods_Query.GetSystemBindDefinition(this.mSelectionName); string Bind_Desc = (string)Do_Methods.IsNull(Dr_Bind["Desc"], ""); string Bind_TableName = (string)Do_Methods.IsNull(Dr_Bind["TableName"], ""); string Bind_TableKey = (string)Do_Methods.IsNull(Dr_Bind["TableKey"], ""); string Bind_Condition = (string)Do_Methods.IsNull(Dr_Bind["Condition"], ""); string Bind_Sort = (string)Do_Methods.IsNull(Dr_Bind["Sort"], ""); string Query_Source = ""; string Query_Condition = ""; if (this.mQuery_Selection != "") { Query_Condition = this.mQuery_Selection; } else { Query_Source = Bind_TableName; if (Bind_Condition != "") { Query_Condition = "Where " + Bind_Condition; } } if (Query_Source == "") { throw new Exception("Selection Source not set."); } if (Sort == "") { Sort = Bind_Sort; } string Query = @"(Select * From " + Query_Source + " " + Query_Condition + @") As [Tb]"; DataTable Dt_List = Do_Methods_Query.GetQuery(Query, "", Condition, Sort, Top, Page); return(Dt_List); }
public void GetColumns(string Name) { DataTable Dt = Do_Methods_Query.GetQuery( @"udf_System_BindDefinition('" + Name + @"')" , "" , "IsNull(IsHidden,0) = 0" , "OrderIndex"); foreach (DataRow Dr in Dt.Rows) { string FieldName = (string)Do_Methods.IsNull(Dr["Name"], ""); string FieldDesc = (string)Do_Methods.IsNull(Dr["Desc"], ""); string NumberFormat = (string)Do_Methods.IsNull(Dr["NumberFormat"], ""); if (NumberFormat != "") { NumberFormat = NumberFormat.Replace("{", ""); NumberFormat = NumberFormat.Replace("}", ""); string[] Arr = NumberFormat.Split(':'); try { NumberFormat = Arr[1]; } catch { } Regex Reg = new Regex(@"N[0-9]", RegexOptions.IgnoreCase); if (Reg.Match(NumberFormat).Success) { Int32 X = 0; try { X = Convert.ToInt32(NumberFormat.Substring(2, 1)); } catch { } NumberFormat = "#,##0"; if (X != 0) { NumberFormat.PadRight(X, '0'); } } this.Add(FieldName, FieldDesc, NumberFormat); } } }
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); }
Int64 List_Count(QueryCondition Condition = null) { DataRow Dr_Bind = Do_Methods_Query.GetSystemBindDefinition(this.mSelectionName); string Bind_Desc = (string)Do_Methods.IsNull(Dr_Bind["Desc"], ""); string Bind_TableName = (string)Do_Methods.IsNull(Dr_Bind["TableName"], ""); string Bind_TableKey = (string)Do_Methods.IsNull(Dr_Bind["TableKey"], ""); string Bind_Condition = (string)Do_Methods.IsNull(Dr_Bind["Condition"], ""); string Bind_Sort = (string)Do_Methods.IsNull(Dr_Bind["Sort"], ""); string Query_Source = ""; string Query_Condition = ""; if (this.mQuery_Selection != "") { Query_Condition = this.mQuery_Selection; } else { Query_Source = Bind_TableName; if (Bind_Condition != "") { Query_Condition = "Where " + Bind_Condition; } } if (Query_Source == "") { throw new Exception("Selection Source not set."); } string Query = @"(Select * From " + Query_Source + " " + Query_Condition + @") As [Tb]"; DataTable Dt_List = Do_Methods_Query.GetQuery(Query, "Count(1) As [Ct]", Condition); Int64 Rv = 0; try { Rv = Convert.ToInt64(Do_Methods.IsNull(Dt_List.Rows[0]["Ct"], 0)); } catch { } return(Rv); }
public override bool Save(DataObjects_Framework.DataAccess.Interface_DataAccess Da = null) { bool Rv = base.Save(Da); Int64 ItemID = Do_Methods.Convert_Int64(this.pDr["ItemID"]); double Price = 0; DataTable Dt = Do_Methods_Query.ExecuteQuery("Select Top 1 Price From Item_PriceHistory Where ItemID = " + ItemID + " Order By DatePosted").Tables[0]; if (Dt.Rows.Count > 0) { Price = Do_Methods.Convert_Double(Dt.Rows[0]["Price"]); } if (Price != Do_Methods.Convert_Double(this.pDr["Price"], 0)) { this.UpdatePriceHistory(ItemID); } return(Rv); }
string Details_TaxCode() { System.Text.StringBuilder Sb_Js = new System.Text.StringBuilder(); Int64 LookupTaxCodeID = 0; try { LookupTaxCodeID = Convert.ToInt64(this.Cbo_TaxCode.SelectedValue); } catch { } DataTable Dt = Do_Methods_Query.GetQuery("LookupTaxCode", "", "LookupTaxCodeID = " + LookupTaxCodeID); if (Dt.Rows.Count > 0) { DataRow Dr = Dt.Rows[0]; Layer01_Methods_Web.Eval_AppendJs(this.Server, ref Sb_Js, this.Lbl_PST_Value.ClientID, "innerHTML", Strings.Format(Do_Methods.IsNull(Dr["PST_Value"], 0), "#,##0.00")); Layer01_Methods_Web.Eval_AppendJs(this.Server, ref Sb_Js, this.Lbl_GST_Value.ClientID, "innerHTML", Strings.Format(Do_Methods.IsNull(Dr["GST_Value"], 0), "#,##0.00")); Layer01_Methods_Web.Eval_AppendJs(this.Server, ref Sb_Js, this.Lbl_HST_Value.ClientID, "innerHTML", Strings.Format(Do_Methods.IsNull(Dr["HST_Value"], 0), "#,##0.00")); } return(Sb_Js.ToString()); }
void SetupPage_Lookups() { Layer01_Methods_Web.BindCombo(ref this.Cbo_Currency, Do_Methods_Query.GetLookup("Currency"), "LookupID", "Desc", 0, "-Select-"); Layer01_Methods_Web.BindCombo(ref this.Cbo_PaymentTerm, Do_Methods_Query.GetLookup("PaymentTerm"), "LookupID", "Desc", 0, "-Select-"); Layer01_Methods_Web.BindCombo(ref this.Cbo_ShipVia, Do_Methods_Query.GetLookup("ShipVia"), "LookupID", "Desc", 0, "-Select-"); Layer01_Methods_Web.BindCombo( ref this.Cbo_TaxCode , Do_Methods_Query.GetQuery("LookupTaxCode", "", "IsNull(IsDeleted,0) = 0 And IsNull(IsActive,0) = 1") , "LookupTaxCodeID" , "Desc" , 0 , "-Select-"); Layer01_Methods_Web.BindCombo( ref this.Cbo_ClientType , Do_Methods_Query.GetQuery("LookupClientType", "", "IsNull(IsDeleted,0) = 0 And IsNull(IsActive,0) = 1") , "LookupClientTypeID" , "Desc" , 0 , "-Select-"); }
//[-] protected string Details_PrepareNew() { DataTable Dt = Do_Methods_Query.GetQuery("System_Modules", "", "System_ModulesID = " + this.mSystem_ModulesID.ToString()); string Url = ""; if (Dt.Rows.Count > 0) { Url = "~/" + (string)Do_Methods.IsNull(Dt.Rows[0]["PageUrl_Details"], ""); } string Override_PageUrl_Details_New = (string)this.ViewState[CnsOverride_PageUrl_Details_New]; if (Override_PageUrl_Details_New != "") { Url = Override_PageUrl_Details_New; } this.Session[Layer01_Constants_Web.CnsSession_Keys] = null; return(Url); }
public void Save_ReloadPage() { this.Session.Remove(this.mObjID); Collection PageCollection = new Collection(); PageCollection.Add(true, "IsSave"); this.Session[Layer01_Constants_Web.CnsSession_TmpObj] = PageCollection; this.Session[Layer01_Constants_Web.CnsSession_Keys] = this.mObj_Base.GetKeys(); DataTable Dt = Do_Methods_Query.GetQuery("System_Modules", "", "System_ModulesID = " + this.mSystem_ModulesID.ToString()); string Url = ""; if (Dt.Rows.Count > 0) { Url = "~/" + (string)Do_Methods.IsNull(Dt.Rows[0]["PageUrl_Details"], ""); } this.Response.Redirect(Url); }
//[-] protected DataTable List( QueryCondition Condition = null , string Sort = "" , Int64 Top = 0 , Int32 Page = 0) { DataRow Dr_Bind = Do_Methods_Query.GetSystemBindDefinition(this.mSystem_BinDefinition_Name); string Bind_Condition = (string)Do_Methods.IsNull(Dr_Bind["Condition"], ""); string Bind_Sort = (string)Do_Methods.IsNull(Dr_Bind["Sort"], ""); string Query_Condition = ""; if (Bind_Condition.Trim() != "") { Query_Condition = " Where " + Bind_Condition; } string Source = (string)this.ViewState[CnsSource]; if (Source == "") { Source = this.mObj_Base.pHeader_ViewName; } if (Sort == "") { Sort = Bind_Sort; } string Query_Table = @"(Select * From " + Source + " " + Query_Condition + " ) As [Tb]"; Interface_DataAccess Da = this.mObj_Base.CreateDataAccess(); //DataTable Dt = Do_Methods_Query.GetQuery(Query_Table, "", Condition, Sort, Top, Page); DataTable Dt = Da.GetQuery(Query_Table, "", Condition, Sort, Top, Page); Da.Close(); return(Dt); }
protected string Details_PrepareOpen(Int64 ID) { DataTable Dt = Do_Methods_Query.GetQuery("System_Modules", "", "System_ModulesID = " + this.mSystem_ModulesID.ToString()); string Url = ""; if (Dt.Rows.Count > 0) { Url = "~/" + (string)Do_Methods.IsNull(Dt.Rows[0]["PageUrl_Details"], ""); } this.Session[Layer01_Constants_Web.CnsSession_Keys] = null; QueryCondition Qc = new QueryCondition(); Qc.Add(this.mObj_Base.pHeader_TableKey, "=", ID, typeof(Int64).ToString()); Dt = this.List(Qc); if (Dt.Rows.Count > 0) { this.Session[Layer01_Constants_Web.CnsSession_Keys] = this.mObj_Base.GetKeys(Dt.Rows[0]); } return(Url); }
public static string GetSeriesNo(string Name) { string Rv = ""; DataTable Dt; string TableName; string FieldName; string Prefix; Int32 Digits; Dt = Do_Methods_Query.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 <QueryParameter> Sp = new List <QueryParameter>(); Sp.Add(new QueryParameter("@TableName", TableName)); Sp.Add(new QueryParameter("@FieldName", FieldName)); Sp.Add(new QueryParameter("@Prefix", Prefix)); Sp.Add(new QueryParameter("@Digits", Digits)); Dt = Do_Methods_Query.ExecuteQuery("usp_GetSeriesNo", Sp).Tables[0]; if (Dt.Rows.Count > 0) { Rv = (string)Dt.Rows[0][0]; } return(Rv); }
public override bool Save(Interface_DataAccess Da = null) { if (this.mIsCache) { DataTable Dt_Tub = Do_Methods_Query.GetQuery(@"System_TableUpdateBatch", "", @"TableName = '" + this.mHeader_TableName + @"'"); DataRow Dr_Tub = null; if (Dt_Tub.Rows.Count > 0) { Dr_Tub = Dt_Tub.Rows[0]; } else { throw new Exception("Table Cache info not found."); } List <QueryParameter> List_Qp = new List <QueryParameter>(); List_Qp.Add(new QueryParameter("TableUpdateBatchID", Do_Methods.Convert_Int64(Dr_Tub["System_TableUpdateBatchID"]))); List_Qp.Add(new QueryParameter("ID", this.pID)); Do_Methods_Query.ExecuteNonQuery("usp_InsertToTableUpdateBatch", List_Qp); } return(base.Save(Da)); }
bool Save_Validation(ref System.Text.StringBuilder Sb_Msg) { WebControl Wc; bool IsValid = true; this.Txt_Code.CssClass = Layer01_Constants_Web.CnsCssTextbox; if (this.Txt_Code.Text.Trim() == "") { this.Txt_Code.Text = Layer02_Common.GetSeriesNo("Customer"); } Wc = this.Txt_Code; Layer01_Methods_Web.Save_Validation( ref Sb_Msg , ref Wc , ref IsValid , Layer01_Constants_Web.CnsCssTextbox , Layer01_Constants_Web.CnsCssTextbox_ValidateHighlight , Layer02_Common.CheckSeriesDuplicate("uvw_Customer", "CustomerCode", this.mObj.GetKeys(), this.Txt_Code.Text) , "Duplicate Customer ID found. Please change the Customer ID. <br />"); Int64 LookupClientTypeID = Convert.ToInt64(Do_Methods.IsNull(this.mObj.pDr["LookupClientTypeID"], 0)); DataTable Dt = Do_Methods_Query.GetQuery("LookupClientType", "", "LookupClientTypeID = " + LookupClientTypeID.ToString()); if (Dt.Rows.Count > 0) { DataRow Dr_ClientType = Dt.Rows[0]; if ((bool)Do_Methods.IsNull(Dr_ClientType["IsCurrency"], false)) { Wc = this.Cbo_Currency; Layer01_Methods_Web.Save_Validation( ref Sb_Msg , ref Wc , ref IsValid , Layer01_Constants_Web.CnsCssTextbox , Layer01_Constants_Web.CnsCssTextbox_ValidateHighlight , (Convert.ToInt64(this.Cbo_Currency.SelectedValue) == 0) , "Currency is required. <br />"); } if ((bool)Do_Methods.IsNull(Dr_ClientType["IsCreditCard_AccountName"], false)) { Wc = this.Txt_CreditCard_AccountName; Layer01_Methods_Web.Save_Validation( ref Sb_Msg , ref Wc , ref IsValid , Layer01_Constants_Web.CnsCssTextbox , Layer01_Constants_Web.CnsCssTextbox_ValidateHighlight , (this.Txt_CreditCard_AccountName.Text == "") , "Account Name is required. <br />"); } if ((bool)Do_Methods.IsNull(Dr_ClientType["IsCreditCard"], false)) { bool Inner_IsValid = true; this.Txt_CreditCard_Part1.CssClass = Layer01_Constants_Web.CnsCssTextbox; this.Txt_CreditCard_Part2.CssClass = Layer01_Constants_Web.CnsCssTextbox; this.Txt_CreditCard_Part3.CssClass = Layer01_Constants_Web.CnsCssTextbox; this.Txt_CreditCard_Part4.CssClass = Layer01_Constants_Web.CnsCssTextbox; if (this.Txt_CreditCard_Part1.Text.Trim() == "") { Inner_IsValid = false; } if (this.Txt_CreditCard_Part2.Text.Trim() == "") { Inner_IsValid = false; } if (this.Txt_CreditCard_Part3.Text.Trim() == "") { Inner_IsValid = false; } if (this.Txt_CreditCard_Part4.Text.Trim() == "") { Inner_IsValid = false; } if (!Inner_IsValid) { IsValid = false; this.Txt_CreditCard_Part1.CssClass = Layer01_Constants_Web.CnsCssTextbox_ValidateHighlight; this.Txt_CreditCard_Part2.CssClass = Layer01_Constants_Web.CnsCssTextbox_ValidateHighlight; this.Txt_CreditCard_Part3.CssClass = Layer01_Constants_Web.CnsCssTextbox_ValidateHighlight; this.Txt_CreditCard_Part4.CssClass = Layer01_Constants_Web.CnsCssTextbox_ValidateHighlight; Sb_Msg.Append("Credit Card is required. <br />"); } } Int32 CreditCardExpiration_Month = 0; Int32 CreditCardExpiration_Year = 0; try { Int32.TryParse(this.Txt_CreditCardExpiration_Month.Text, out CreditCardExpiration_Month); if (this.Txt_CreditCardExpiration_Year.Text.Trim() != "") { Int32.TryParse("20" + this.Txt_CreditCardExpiration_Year.Text, out CreditCardExpiration_Year); } } catch { } this.Txt_CreditCardExpiration_Month.CssClass = Layer01_Constants_Web.CnsCssTextbox; this.Txt_CreditCardExpiration_Year.CssClass = Layer01_Constants_Web.CnsCssTextbox; if (! (this.Txt_CreditCardExpiration_Month.Text.Trim() == "" || this.Txt_CreditCardExpiration_Year.Text.Trim() == "")) { DateTime Inner_DateTime; try { Inner_DateTime = new DateTime(CreditCardExpiration_Year, CreditCardExpiration_Month, 1); if (Inner_DateTime < DateTime.Now) { IsValid = false; this.Txt_CreditCardExpiration_Month.CssClass = Layer01_Constants_Web.CnsCssTextbox_ValidateHighlight; this.Txt_CreditCardExpiration_Year.CssClass = Layer01_Constants_Web.CnsCssTextbox_ValidateHighlight; Sb_Msg.Append("Credit Card Date Expiry must be earlier than today. <br />"); } } catch { IsValid = false; this.Txt_CreditCardExpiration_Month.CssClass = Layer01_Constants_Web.CnsCssTextbox_ValidateHighlight; this.Txt_CreditCardExpiration_Year.CssClass = Layer01_Constants_Web.CnsCssTextbox_ValidateHighlight; Sb_Msg.Append("Credit Card Date Expiry is incorrect. <br />"); } } if ((bool)Do_Methods.IsNull(Dr_ClientType["IsCreditCard_Expiration"], false)) { if (this.Txt_CreditCardExpiration_Month.Text.Trim() == "" || this.Txt_CreditCardExpiration_Year.Text.Trim() == "") { IsValid = false; this.Txt_CreditCardExpiration_Month.CssClass = Layer01_Constants_Web.CnsCssTextbox_ValidateHighlight; this.Txt_CreditCardExpiration_Year.CssClass = Layer01_Constants_Web.CnsCssTextbox_ValidateHighlight; Sb_Msg.Append("Credit Card Date Expiry is required. <br />"); } } if ((bool)Do_Methods.IsNull(Dr_ClientType["IsPaymentTerm"], false)) { Wc = this.Cbo_PaymentTerm; Layer01_Methods_Web.Save_Validation( ref Sb_Msg , ref Wc , ref IsValid , Layer01_Constants_Web.CnsCssTextbox , Layer01_Constants_Web.CnsCssTextbox_ValidateHighlight , (Convert.ToInt64(this.Cbo_PaymentTerm.SelectedValue) == 0) , "Payment Term is required. <br />"); } if ((bool)Do_Methods.IsNull(Dr_ClientType["IsTaxCode"], false)) { Wc = this.Cbo_TaxCode; Layer01_Methods_Web.Save_Validation( ref Sb_Msg , ref Wc , ref IsValid , Layer01_Constants_Web.CnsCssTextbox , Layer01_Constants_Web.CnsCssTextbox_ValidateHighlight , (Convert.ToInt64(this.Cbo_TaxCode.SelectedValue) == 0) , "Tax Code is required. <br />"); } } return(IsValid); }