protected override void Save() { System.Text.StringBuilder Sb_ErrorMsg = new System.Text.StringBuilder(); if (!this.Save_Validation(ref Sb_ErrorMsg)) { this.Show_EventMsg(Sb_ErrorMsg.ToString(), ClsBaseMasterDetails.eStatus.Event_Error); return; } //[-] this.mObj.pDr_RowProperty["Code"] = this.Txt_EmployeeCode.Text; this.mObj.pDr["Leave_Vacation"] = Do_Methods.Convert_Int32(this.Txt_LeaveSick.Text); this.mObj.pDr["Leave_Sick"] = Do_Methods.Convert_Int32(this.Txt_LeaveSick.Text); this.mObj.pDr["Leave_Bereavement"] = Do_Methods.Convert_Int32(this.Txt_LeaveBereavement.Text); this.mObj.pDr["Position"] = this.Txt_Position.Text; this.mObj.pDr["LookupID_Department"] = Do_Methods.Convert_Int64(this.Cbo_Department.SelectedValue); this.mObj.pDr["LookupID_PayRate"] = Do_Methods.Convert_Int64(this.Cbo_PayRate.SelectedValue); this.mObj.pDr["LookupID_EmployeeType"] = Do_Methods.Convert_Int64(this.Cbo_EmployeeType.SelectedValue); this.mObj.pDr["SIN"] = this.Txt_SIN.Text; this.mObj.pDr["Pay"] = Do_Methods.Convert_Double(this.Txt_Pay.Text); this.UcPerson.Update(); this.UcAddress.Update(); Do_Methods.ConvertCaps(this.mObj.pDr_RowProperty); Do_Methods.ConvertCaps(this.mObj.pDr_Person); Do_Methods.ConvertCaps(this.mObj.pDr); //[-] base.Save(); }
public override void RebindGrid() { Int64 Top = 0; try { Top = Do_Methods.Convert_Int64(this.Txt_Top.Text); } catch { } Int32 Page = 0; try { Page = Do_Methods.Convert_Int32(this.Cbo_Page.SelectedValue); } catch { } string ViewState_DisplayFilterString = (string)this.ViewState[CnsDisplayFilterString]; string ViewState_DisplayOrderString = (string)this.ViewState[CnsDisplayOrderString]; string ViewState_OrderString = (string)this.ViewState[CnsOrderString]; QueryCondition Qc = null; try { Qc = (QueryCondition)this.ViewState[CnsObj_QueryCondition]; } catch { } if (Qc == null) { Qc = new QueryCondition(); } this.Details_SetPaginator(Top, this.List_Count(Qc)); try { this.Cbo_Page.SelectedValue = Page.ToString(); } catch { try { Page = Convert.ToInt32(this.Cbo_Page.SelectedValue); } catch { } } DataTable Dt; try { Dt = this.List(Qc, ViewState_OrderString, Top, Page); } catch { Dt = this.List(Qc, "", Top, Page); ViewState_OrderString = ""; ViewState_DisplayOrderString = ""; this.ViewState[CnsOrderString] = ViewState_OrderString; this.ViewState[CnsDisplayOrderString] = ViewState_DisplayOrderString; } this.BindGrid(Dt); try { this.EOCbp_Grid.Update(); } catch { } }
void SetupPage() { DataRow[] ArrDr = this.mObj_Customer.pDt_ShippingAddress.Select("TmpKey = " + this.mTmpKey); DataRow Dr_ShippingAddress = null; if (ArrDr.Length > 0) { Dr_ShippingAddress = ArrDr[0]; } else { this.mTmpKey = 0; } if (this.mTmpKey == 0) { this.Txt_StoreCode.Text = ""; //this.mObj_Address = new ClsAddress(this.mObj_Customer.pCurrentUser); //this.mObj_Address.Load(); Dr_ShippingAddress = this.mObj_Customer.pObj_ShippingAddress.Add_Item(); this.mTmpKey = Do_Methods.Convert_Int64(Dr_ShippingAddress["TmpKey"]); this.mObj_Address = this.mObj_Customer.pObj_ShippingAddress_Address_Get(this.mTmpKey); this.mObj_Address.pDr["Address"] = this.mObj_Customer.pDr_Address["Address"]; this.mObj_Address.pDr["City"] = this.mObj_Customer.pDr_Address["City"]; this.mObj_Address.pDr["LookupID_States"] = this.mObj_Customer.pDr_Address["LookupID_States"]; this.mObj_Address.pDr["LookupID_Country"] = this.mObj_Customer.pDr_Address["LookupID_Country"]; this.mObj_Address.pDr["ZipCode"] = this.mObj_Customer.pDr_Address["ZipCode"]; this.UcAddress_ShippingAddress.Setup(this.mObj_Address); this.ViewState[CnsTmpKey] = this.mTmpKey; } else { this.Txt_StoreCode.Text = (string)Do_Methods.IsNull(Dr_ShippingAddress["StoreCode"], ""); //this.mObj_Address = (ClsAddress)this.mObj_Customer.pBO_ShippingAddress_Address[this.mTmpKey.ToString()]; this.mObj_Address = this.mObj_Customer.pObj_ShippingAddress_Address_Get(this.mTmpKey); this.UcAddress_ShippingAddress.Setup(this.mObj_Address); } this.Session[this.mObjID + CnsObj_Address] = this.mObj_Address; try { this.EOCbp_Dialog_ShippingAddress.Update(); } catch { } }
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); }
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_ItemsCount() { Int64 Top = Do_Methods.Convert_Int64(this.Txt_Top.Text); Int64 Page = Do_Methods.Convert_Int64(this.Cbo_Page.SelectedValue, 1); Int64 Items = Do_Methods.Convert_Int64(this.ViewState[CnsItemsMax]); Int64 Items_Start = (Top * (Page - 1)) + 1; Int64 Items_End = Top * Page; if (Items == 0) { return("No records shown."); } if (Items_End > Items) { Items_End = Items; } return("Showing " + Items_Start.ToString("#,##0") + " - " + Items_End.ToString("#,##0") + " out of " + Items.ToString("#,##0")); }
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)); }
protected override void Save() { this.UcGrid_ItemPart.Post(); this.UcGrid_ItemLocation.Post(); this.UcGrid_ItemSupplier.Post(); //[-] //System.Text.StringBuilder Sb_ErrorMsg = new System.Text.StringBuilder(); //if (!this.Save_Validation(ref Sb_ErrorMsg)) //{ // this.Show_EventMsg(Sb_ErrorMsg.ToString(), ClsBaseMasterDetails.eStatus.Event_Error); // return; //} //[-] this.mObj.pDr_RowProperty["Code"] = this.Txt_ItemCode.Text; this.mObj.pDr_RowProperty["Name"] = this.Txt_ItemName.Text; this.mObj.pDr_RowProperty["Remarks"] = this.Txt_Remarks.Text; this.mObj.pDr["Warranty"] = this.Txt_Warranty.Text; this.mObj.pDr["IsSerial"] = this.Chk_IsSerial.Checked; this.mObj.pDr["LookupID_ItemType"] = Convert.ToInt64(this.Cbo_ItemType.SelectedValue); this.mObj.pDr["LookupID_Brand"] = Convert.ToInt64(this.Cbo_Brand.SelectedValue); this.mObj.pDr["LookupID_Retailer"] = Convert.ToInt64(this.Cbo_Retailer.SelectedValue); this.mObj.pDr["LookupID_ItemUOM"] = Convert.ToInt64(this.Cbo_ItemUOM.SelectedValue); this.mObj.pDr["Size_Length"] = Do_Methods.Convert_Double(this.Txt_Length.Text); this.mObj.pDr["Size_Width"] = Do_Methods.Convert_Double(this.Txt_Width.Text); this.mObj.pDr["Size_Height"] = Do_Methods.Convert_Double(this.Txt_Height.Text); this.mObj.pDr["Size_Weight"] = Do_Methods.Convert_Double(this.Txt_Weight.Text); this.mObj.pDr["Inv_FloorLevel"] = Do_Methods.Convert_Int64(this.Txt_FloorLevel.Text); this.mObj.pDr["Inv_ReorderLevel"] = Do_Methods.Convert_Int64(this.Txt_ReorderLevel.Text); this.mObj.pDr["Inv_CeilingLevel"] = Do_Methods.Convert_Int64(this.Txt_CeilingLevel.Text); this.mObj.pDr["Cost"] = Do_Methods.Convert_Double(this.Txt_EstimatedCost.Text); this.mObj.pDr["Price"] = Do_Methods.Convert_Double(this.Txt_ListPrice.Text); Do_Methods.ConvertCaps(this.mObj.pDr_RowProperty); Do_Methods.ConvertCaps(this.mObj.pDr); //[-] ClsItemValidation Obj_Validation = new ClsItemValidation(); Obj_Validation.Setup(this.mObj); if (!Obj_Validation.Validate()) { this.Txt_ItemCode.CssClass = Layer01_Constants_Web.CnsCssTextbox; //if (Obj_Validation.pList_ValidationError.Exists(X => X.Name == ClsItemValidation.eErrors.Err_Code.ToString())) if (Obj_Validation.FindError(ClsItemValidation.eErrors.Err_Code.ToString())) { this.Txt_ItemCode.CssClass = Layer01_Constants_Web.CnsCssTextbox_ValidateHighlight; } this.Txt_ItemName.CssClass = Layer01_Constants_Web.CnsCssTextbox; //if (Obj_Validation.pList_ValidationError.Exists(X => X.Name == ClsItemValidation.eErrors.Err_Name.ToString())) if (Obj_Validation.FindError(ClsItemValidation.eErrors.Err_Name.ToString())) { this.Txt_ItemName.CssClass = Layer01_Constants_Web.CnsCssTextbox_ValidateHighlight; } //List<String> Msg = (from O in Obj_Validation.pList_ValidationError select O.Message).ToList(); //this.Show_EventMsg(Msg, ClsBaseMasterDetails.eStatus.Event_Error); this.Show_EventMsg(Obj_Validation.GetErrors(), ClsBaseMasterDetails.eStatus.Event_Error); } //[-] base.Save(); }
void SetupPage() { this.SetupPage_ControlAttributes(); this.SetupPage_Lookups(); //[-] this.Txt_ItemCode.Text = Do_Methods.Convert_String(this.mObj.pDr_RowProperty["Code"]); this.Txt_ItemName.Text = Do_Methods.Convert_String(this.mObj.pDr_RowProperty["Name"]); this.Txt_Remarks.Text = Do_Methods.Convert_String(this.mObj.pDr_RowProperty["Remarks"]); this.Txt_Warranty.Text = Do_Methods.Convert_String(this.mObj.pDr["Warranty"]); this.Chk_IsSerial.Checked = Do_Methods.Convert_Boolean(this.mObj.pDr["IsSerial"]); this.Txt_Length.Text = Do_Methods.Convert_Double(this.mObj.pDr["Size_Length"]).ToString("#,##0.0000"); this.Txt_Width.Text = Do_Methods.Convert_Double(this.mObj.pDr["Size_Width"]).ToString("#,##0.0000"); this.Txt_Height.Text = Do_Methods.Convert_Double(this.mObj.pDr["Size_Height"]).ToString("#,##0.0000"); this.Txt_Weight.Text = Do_Methods.Convert_Double(this.mObj.pDr["Size_Weight"]).ToString("#,##0.0000"); this.Txt_FloorLevel.Text = Do_Methods.Convert_Int64(this.mObj.pDr["Inv_FloorLevel"]).ToString("#,##0"); this.Txt_CeilingLevel.Text = Do_Methods.Convert_Int64(this.mObj.pDr["Inv_CeilingLevel"]).ToString("#,##0"); this.Txt_ReorderLevel.Text = Do_Methods.Convert_Int64(this.mObj.pDr["Inv_ReorderLevel"]).ToString("#,##0"); this.Txt_EstimatedCost.Text = Do_Methods.Convert_Double(this.mObj.pDr["Cost"]).ToString("#,##0.00"); this.Txt_ListPrice.Text = Do_Methods.Convert_Double(this.mObj.pDr["Price"], 0).ToString("#,##0.00"); bool IsImageFile = false; if ((string)Do_Methods.IsNull(this.mObj.pDr["Image_Path"], "") != "") { IsImageFile = true; System.IO.FileInfo Fi_Thumb = new System.IO.FileInfo( this.MapPath(Layer01_Constants_Web.CnsImageThumbPath + "Thumb_" + (string)Do_Methods.IsNull(this.mObj.pDr["Image_Path"], ""))); if (!Fi_Thumb.Exists) { try { Layer01_Methods_Web.ImageThumbnail( this.MapPath(Layer01_Constants_Web.CnsImageThumbPath + (string)Do_Methods.IsNull(this.mObj.pDr["Image_Path"], "")) , Fi_Thumb.FullName); } catch { IsImageFile = false; } } this.Img_Box.ImageUrl = Layer01_Constants_Web.CnsImageThumbPath + "Thumb_" + (string)Do_Methods.IsNull(this.mObj.pDr["Image_Path"], ""); this.Btn_ViewImage.Visible = true; } if (!IsImageFile) { this.Img_Box.ImageUrl = "~/System/Images/QuestionMark001.jpg"; this.Btn_ViewImage.Visible = false; } if ((string)Do_Methods.IsNull(this.mObj.pDr["PdfDesc_Path"], "") == "") { this.Btn_PdfDesc.CssClass = Layer01_Constants_Web.CnsCssControlEnabledFalse; this.Btn_PdfDesc.Enabled = false; } else { this.Btn_PdfDesc.CssClass = Layer01_Constants_Web.CnsCssControlEnabled; this.Btn_PdfDesc.Enabled = true; } if ((string)Do_Methods.IsNull(this.mObj.pDr["PdfFaq_Path"], "") == "") { this.Btn_PdfFaq.CssClass = Layer01_Constants_Web.CnsCssControlEnabledFalse; this.Btn_PdfFaq.Enabled = false; } else { this.Btn_PdfFaq.CssClass = Layer01_Constants_Web.CnsCssControlEnabled; this.Btn_PdfFaq.Enabled = true; } if ((string)Do_Methods.IsNull(this.mObj.pDr["PdfOthers_Path"], "") == "") { this.Btn_PdfOther.CssClass = Layer01_Constants_Web.CnsCssControlEnabledFalse; this.Btn_PdfOther.Enabled = false; } else { this.Btn_PdfOther.CssClass = Layer01_Constants_Web.CnsCssControlEnabled; this.Btn_PdfOther.Enabled = true; } DataTable Dt_Defaults = Do_Methods_Query.GetQuery("uvw_Lookup"); this.Cbo_Category.SelectedValue = ((Int64)Do_Methods.IsNull(this.mObj.pDr["LookupID_Category"], this.SetupPage_GetLookupDefault(Dt_Defaults, Layer01_Constants.eLookup.Category))).ToString(); this.Cbo_ItemType.SelectedValue = ((Int64)Do_Methods.IsNull(this.mObj.pDr["LookupID_ItemType"], this.SetupPage_GetLookupDefault(Dt_Defaults, Layer01_Constants.eLookup.ItemType))).ToString(); this.Cbo_Brand.SelectedValue = ((Int64)Do_Methods.IsNull(this.mObj.pDr["LookupID_Brand"], this.SetupPage_GetLookupDefault(Dt_Defaults, Layer01_Constants.eLookup.Brand))).ToString(); this.Cbo_Retailer.SelectedValue = ((Int64)Do_Methods.IsNull(this.mObj.pDr["LookupID_Category"], this.SetupPage_GetLookupDefault(Dt_Defaults, Layer01_Constants.eLookup.Retailer))).ToString(); this.Cbo_ItemUOM.SelectedValue = ((Int64)Do_Methods.IsNull(this.mObj.pDr["LookupID_ItemUOM"], this.SetupPage_GetLookupDefault(Dt_Defaults, Layer01_Constants.eLookup.UOM))).ToString(); //[-] this.UcGrid_ItemPart.Setup( "Item_Part" , this.mObj.pDt_Part , "TmpKey" , false , true , this.mMaster.pIsReadOnly); this.UcGrid_ItemPart.pGrid.FullRowMode = false; this.UcGrid_ItemLocation.Setup( "Item_Location" , this.mObj.pDt_Location , "TmpKey" , false , true , this.mMaster.pIsReadOnly); this.UcGrid_ItemLocation.pGrid.FullRowMode = false; this.UcGrid_ItemSupplier.Setup( "Item_Supplier" , this.mObj.pDt_Supplier , "TmpKey" , false , true , this.mMaster.pIsReadOnly); this.UcGrid_ItemSupplier.pGrid.FullRowMode = false; DataTable Dt = Do_Methods_Query.GetQuery( "uvw_Materialized_InventoryWarehouse_Current_Item" , "" , "ItemID = " + Convert.ToInt64(Do_Methods.IsNull(this.mObj.pDr["ItemID"], 0)).ToString() , "WarehouseCodeName"); this.mObj.AddRequired(Dt); this.UcGrid_OnHand.Setup("Item_Inventory", Dt); this.UcGrid_OnHand.pGrid.FullRowMode = false; }
//[-] public static void AddSelected( DataTable Dt_Target , DataTable Dt_Selected , string Query_Selected_Source , string Query_Selected_Key , string Target_Key , List <Str_AddSelectedFields> Obj_Fields = null , List <Str_AddSelectedFieldsDefault> Obj_FieldsDefault = null) { if (!(Dt_Selected.Rows.Count > 0)) { return; } PreparedQuery Pq = Do_Methods.CreateDataAccess().CreatePreparedQuery(); Pq.pQuery = @"Select * From " + Query_Selected_Source + @" Where " + Query_Selected_Key + @" = @ID"; Pq.Add_Parameter("ID", Do_Constants.eParameterType.Long); Pq.Prepare(); foreach (DataRow Dr_Selected in Dt_Selected.Rows) { //Pq.pParameters["ID"].Value = (Int64)Do_Methods.IsNull(Dr_Selected["ID"], 0); Pq.pParameter_Set("ID", Do_Methods.Convert_Int64(Dr_Selected["ID"])); DataTable Inner_Dt_Selected = Pq.ExecuteQuery().Tables[0]; if (Inner_Dt_Selected.Rows.Count > 0) { DataRow Inner_Dr_Selected = Inner_Dt_Selected.Rows[0]; DataRow[] Inner_ArrDr; DataRow Inner_Dr_Target = null; bool Inner_IsFound = false; Inner_ArrDr = Dt_Target.Select(Target_Key + " = " + Convert.ToInt64(Inner_Dr_Selected[Query_Selected_Key])); if (Inner_ArrDr.Length > 0) { Inner_Dr_Target = Inner_ArrDr[0]; if ((bool)Do_Methods.IsNull(Inner_Dr_Target["IsDeleted"], false)) { Inner_Dr_Target["IsDeleted"] = DBNull.Value; Inner_IsFound = true; } } if (!Inner_IsFound) { Int64 Ct = 0; Inner_ArrDr = Dt_Target.Select("", "TmpKey Desc"); if (Inner_ArrDr.Length > 0) { Ct = (Int64)Inner_ArrDr[0]["TmpKey"]; } Ct++; DataRow Nr = Dt_Target.NewRow(); Nr["TmpKey"] = Ct; Nr["Item_Style"] = ""; Nr[Target_Key] = (Int64)Inner_Dr_Selected[Query_Selected_Key]; Dt_Target.Rows.Add(Nr); Inner_Dr_Target = Nr; } if (Obj_Fields != null) { foreach (Str_AddSelectedFields Inner_Obj in Obj_Fields) { Inner_Dr_Target[Inner_Obj.Field_Target] = Inner_Dr_Selected[Inner_Obj.Field_Selected]; } } if (Obj_FieldsDefault != null) { foreach (Str_AddSelectedFieldsDefault Inner_Obj in Obj_FieldsDefault) { Inner_Dr_Target[Inner_Obj.Field_Target] = Inner_Obj.Value; } } } } }