//private void ListViewMenu_SelectionChanged(object sender, SelectionChangedEventArgs e) //{ // UserControl usc = null; // GridMain.Children.Clear(); // switch (((ListViewItem)((ListView)sender).SelectedItem).Name) // { // case "ItemHome": // usc = new PartyView(); // GridMain.Children.Add(usc); // break; // case "ItemCreate": // usc = new PartyView(); // GridMain.Children.Add(usc); // break; // default: // break; // } //} private void LoadComponent() { dhDBnames objDBNames = new dhDBnames(); objDBNames.ServerName = System.Configuration.ConfigurationManager.AppSettings["ServerName"].ToString(); objDBNames.Default_DB_Name = System.Configuration.ConfigurationManager.AppSettings["DBName"].ToString(); objDBNames.DBUser = System.Configuration.ConfigurationManager.AppSettings["DBUser"].ToString(); objDBNames.DBPassword = System.Configuration.ConfigurationManager.AppSettings["DBPassword"].ToString(); string path = AppDomain.CurrentDomain.BaseDirectory;//System.Reflection.Assembly.GetExecutingAssembly().Location; objDBNames.XmlFilePath = path + "XMLFiles\\" + System.Configuration.ConfigurationManager.AppSettings["DBXmlFilePath"].ToString(); Globalized.ObjDbName = objDBNames; if (Globalized.objAppPreference == null) { dsGeneral.dtAppPreferenceDataTable dtApp = iFacede.GetAppPreference(Globalized.ObjDbName, objAppPreference); ObservableCollection <dhAppPreference> sequence = ReflectionUtility.DataTableToObservableCollection <dhAppPreference>(dtApp); if (sequence.Count > 0) { objAppPreference = sequence[0]; //objAppPreference.ImgCompanyLogo = (System.Byte[])dtApp.Rows[0]["ImgCompanyLogo"]; objAppPreference.VEnableModules = string.IsNullOrEmpty(dtApp.Rows[0]["vEnableModules"].ToString()) ? "" : dtApp.Rows[0]["vEnableModules"].ToString(); objAppPreference.ImgCompanyLogo = !string.IsNullOrEmpty(dtApp.Rows[0]["imgCompanyLogo"].ToString()) ? (byte[])dtApp.Rows[0]["imgCompanyLogo"] : null; objAppPreference.VCompanyName = !string.IsNullOrEmpty(dtApp.Rows[0]["vCompanyName"].ToString()) ? dtApp.Rows[0]["VCompanyName"].ToString() : null; Globalized.objAppPreference = objAppPreference; // cstmUtilities.LoadImage(Globalized.objAppPreference.ImgCompanyLogo, Image1); // this.AppName.Text = String.IsNullOrEmpty(Globalized.objAppPreference.VApplicationName) ? "POS" : Globalized.objAppPreference.VApplicationName; this.CompanyName.Text = String.IsNullOrEmpty(Globalized.objAppPreference.VCompanyName) ? "ABFA" : Globalized.objAppPreference.VCompanyName; // ModernWindow Obj = (ModernWindow)Application.Current.MainWindow; // Obj.Title = String.IsNullOrEmpty(Globalized.objAppPreference.VApplicationName) ? "POS" : Globalized.objAppPreference.VApplicationName; ////this.lblErrorMsg.Visibility = Visibility.Hidden; ////this.UserName.Text = ""; ////this.Password.Password = ""; //= sequence; } else { Globalized.SetMsg("Application is Not Initialized Properly please contact support team. ", MsgType.Error); // lblErrorMsg.Visibility = System.Windows.Visibility.Visible; // Globalized.ShowMsg(lblErrorMsg); } } //byte[] img = (byte[])objAppPreference.ImgCompanyLogo; //MemoryStream str = new MemoryStream(); // str.Write(img, 0, img.Length); // BitmapImage bit = new BitmapImage(str); //byte[] objimg = (byte[])objAppPreference.ImgCompanyLogo; //imgCompanyLogo.DataContext = ImageFromBytearray(objimg); // byte[] bytImageDataBytes = objAppPreference.ImgCompanyLogo; //// byte[] bytImageDataBytes = (byte[])objAppPreference.ImgCompanyLogo.; // System.IO.MemoryStream ms = new System.IO.MemoryStream(bytImageDataBytes); // ms.Seek(0, System.IO.SeekOrigin.Begin); // BitmapImage newBitmapImage = new BitmapImage(); // newBitmapImage.BeginInit(); // newBitmapImage.StreamSource = ms; // newBitmapImage.EndInit(); // imgCompanyLogo.Source = newBitmapImage;//ConvertToImage(objAppPreference.ImgCompanyLogo); }
private void loadData() { // get data dsGeneral.dtAppPreferenceDataTable dt = iFacede.GetAppPreference(Globalized.ObjDbName, GlobalObjPreference); // intialize object if (dt.Rows.Count > 0) { ObservableCollection <dhAppPreference> listItem = ReflectionUtility.DataTableToObservableCollection <dhAppPreference>(dt); if (listItem.Count > 0) { GlobalObjPreference = listItem.Cast <dhAppPreference>().SingleOrDefault(); GlobalObjPreference.IUpdate = 1; // GlobalObjPreference.ImgCompanyLogo =(byte[])dt.Rows[0]["imgCompanyLogo"]; GlobalObjPreference.ImgCompanyLogo = !string.IsNullOrEmpty(dt.Rows[0]["imgCompanyLogo"].ToString()) ? (byte[])dt.Rows[0]["imgCompanyLogo"] : null; GlobalObjPreference.VCompanyName = !string.IsNullOrEmpty(dt.Rows[0]["vCompanyName"].ToString()) ? dt.Rows[0]["VCompanyName"].ToString() : null; GlobalObjPreference.VHeaderAdress = !string.IsNullOrEmpty(dt.Rows[0]["vHeaderAdress"].ToString()) ? dt.Rows[0]["vHeaderAdress"].ToString() : null; GlobalObjPreference.VCompanyMobile = !string.IsNullOrEmpty(dt.Rows[0]["vCompanyMobile"].ToString()) ? dt.Rows[0]["vCompanyMobile"].ToString() : null; // VSaleType.SelectedItem = GlobalObjPreference.VSaleType; this.DataContext = GlobalObjPreference; cstmUtilities.LoadImage(GlobalObjPreference.ImgCompanyLogo, image1); //VSaleType.SelectedValue = GlobalObjPreference.VSaleType; //Globalized.ObjPrefernce = GlobalObjPreference; } } else { GlobalObjPreference.IUpdate = 0; GlobalObjPreference = new dhAppPreference(); this.DataContext = GlobalObjPreference; } Globalized.ShowMsg(lblErrorMsg); //Globalized.SetMsg(null); }
public void LoadData(int MuduleID) { dhModule objMod = new dhModule(); objMod.IModuleID = MuduleID; // if (objUser != null) // { //#region "Allowed Menu" objMod.AllowdModule = Globalized.objAppPreference.VEnableModules; objMod.IModuleParentID = 0; dsGeneral.dtPosModuleDataTable dtm = iFacede.GetModule(Globalized.ObjDbName, objMod); ObservableCollection <dhModule> sequence = ReflectionUtility.DataTableToObservableCollection <dhModule>(dtm); if (sequence.Count > 0) { objModule = sequence[0]; if ((objModule.VIconName == null) || (objModule.VIconName == "")) { this.Img1.Source = new BitmapImage(new Uri("/SublimeCareCloud;component/images/DumyIcon.png", UriKind.Relative)); } else { BitmapImage image = new BitmapImage(new Uri("/SublimeCareCloud;component/Images/" + objModule.VIconName, UriKind.Relative)); this.Img1.Source = image; } } }
//public static String lastMsg = null; public static void AccountListOptimizated() { if (listAccount == null) { listAccount = new ObservableCollection <dhAccount>(); } // objAccount.BCloseAccount = true;//(bool)IncClosedAccount; //objAccount.VFilterOperator = "=="; //objAccount.Balance = 0.0; // objAccount.BIncludeNull = true; dsGeneral.dtPosAccountsDataTable dt = iFacede.GetAccount(Globalized.ObjDbName, objAccount); listAccount.Clear(); listAccount = ReflectionUtility.DataTableToObservableCollection <dhAccount>(dt); }
private void BindSalary() { dhSalary objSalry = new dhSalary(); // SalaryDataGrid.DataContext = new dhSalary(); objSalry.iEmpId = GlobalObjEmployee.IEmpid; dsGeneral.dtSalaryDataTable SalaryDataTable; SalaryDataTable = iFacede.GetSalary(Globalized.ObjDbName, objSalry); ObservableCollection <dhSalary> ListObjSalary = ReflectionUtility.DataTableToObservableCollection <dhSalary>(SalaryDataTable); //this.SalaryDataGrid.ItemsSource = ListObjSalary; // setup for new salary //if (ListObjSalary.Count > 0) //{ // dhSalary NSalary = new dhSalary(); // GenrateSallary(ListObjSalary[0]); // CalculateSallary(); //} }
public AddAccountView(DataHolders.dhAccount objTodisplay) { // TODO: Complete member initialization InitializeComponent(); this.objTodisplay = new dhAccount(); this.objTodisplay = objTodisplay; this.objTodisplay.FinanceTypeList = new ObservableCollection <dhFinanceType>(); this.AccountGrid.DataContext = this.objTodisplay; //this.vAccountType.DataContext = dsGeneral.dtPosFinaceTypeDataTable dtF = iFacede.GetFinaceType(Globalized.ObjDbName, objTodisplay); objTodisplay.FinanceTypeList = ReflectionUtility.DataTableToObservableCollection <dhFinanceType>(dtF); this.vAccountType.ItemsSource = objTodisplay.FinanceTypeList;// iFacede.GetFinaceType(Globalized.ObjDbName, objTodisplay); this.vAccountType.DisplayMemberPath = "vFinaceType"; this.vAccountType.SelectedValuePath = "iFinaceType"; this.vAccountType.SelectedValue = this.objTodisplay.IFinaceType; LoadData(); }
private void Invoices_MouseDoubleClick(object sender, MouseButtonEventArgs e) { if (sender != null) { DataGridRow dgr = sender as DataGridRow; // get the obect and then Invoice ID opne the Id in readonly mode dhInvoice objTodisplay = new dhInvoice(); objTodisplay.ISaleid = ((dhInvoice)dgr.Item).ISaleid; DataSet dsr = iFacede.GetSaleInovice(Globalized.ObjDbName, objTodisplay); objTodisplay = (dhInvoice)dgr.Item; if ((dsr.Tables.Count > 0) && (dsr.Tables[0].Rows.Count > 0)) { ObservableCollection <dhInvoice> objlist = ReflectionUtility.DataTableToObservableCollection <dhInvoice>(dsr.Tables[0]); objTodisplay = (dhInvoice)objlist.SingleOrDefault(); } if ((dsr.Tables.Count > 0) && (dsr.Tables[1].Rows.Count > 0)) { ObservableCollection <dhSaleItem> listItem = ReflectionUtility.DataTableToObservableCollection <dhSaleItem>(dsr.Tables[1]); ItemsList itemlist = new ItemsList().AddRange(listItem); objTodisplay.ItemsOfInvoice = itemlist; } //DataSet dsr = iFacede.GetSaleInovice(Globalized.ObjDbName, objTodisplay); //ObservableCollection<dhSaleItem> ListAccounts = ReflectionUtility.DataTableToObservableCollection<dhSaleItem>(dsr.Tables[1]); //ItemsList itemlist = new ItemsList().AddRange(ListAccounts); //objTodisplay = (dhInvoice)dgr.Item; if (objTodisplay.BIsDraft != true) { objTodisplay.IsReadOnly = true; } else { objTodisplay.IsReadOnly = false; } // AddTabItem(objTodisplay); } }
private void LoadData() { dhAccount objFinaceType = new dhAccount(); dsGeneral.dtPosFinaceTypeDataTable dtF = iFacede.GetFinaceType(Globalized.ObjDbName, objFinaceType); objTodisplay.FinanceTypeList = ReflectionUtility.DataTableToObservableCollection <dhFinanceType>(dtF); this.vAccountType.ItemsSource = objTodisplay.FinanceTypeList; this.vAccountType.DisplayMemberPath = "VFinaceType"; this.vAccountType.SelectedValuePath = "IFinaceType"; this.AccountDt.DataContext = this.objTodisplay; this.vAccountType.SelectedValue = this.objTodisplay.IFinaceType; if (objTodisplay.BEditable == false) { //accountNameTextBox.IsEnabled = false; //vAccountNoTextBox.IsEnabled = false; //vAccountDescTextBox.IsEnabled = false; //vAccountCommentsTextBox.IsEnabled = false; //vAccountType.IsEnabled = false; //bNominalCheckBox.IsEnabled = false; AccountDt.IsEnabled = false; this.btnSaveAcc.IsEnabled = false; Globalized.SetMsg("This is non-editable account.", MsgType.Info); Globalized.ShowMsg(lblErrorMsg); } else { AccountDt.IsEnabled = true; } if (objTodisplay.IUpdate > 0) { this.vAccountNoTextBox.IsEnabled = false; // this.vAccountNoTextBox.Background = new SolidColorBrush(Colors.Gray); } }
private void Account_MouseDoubleClick(object sender, MouseButtonEventArgs e) { if (sender != null) { DataGridRow dgr = sender as DataGridRow; // get the obect and then Invoice ID opne the Id in readonly mode dhAccount objTodisplay = new dhAccount(); objTodisplay.IAccountid = ((dhAccount)dgr.Item).IAccountid; dsGeneral.dtPosAccountsDataTable dtAccount = iFacede.GetAccount(Globalized.ObjDbName, objTodisplay); ObservableCollection <dhAccount> listAccount = ReflectionUtility.DataTableToObservableCollection <dhAccount>(dtAccount); if (listAccount.Count > 0) { objTodisplay = listAccount.Cast <dhAccount>().Where(i => i.IAccountid.Equals(objTodisplay.IAccountid)).SingleOrDefault(); objTodisplay.IUpdate = 1; //dsGeneral.dtPosFinaceTypeDataTable dtF = iFacede.GetFinaceType(Globalized.ObjDbName, objTodisplay); //objTodisplay.FinanceTypeList = ReflectionUtility.DataTableToObservableCollection<dhFinanceType>(dtF); AddTabItem(objTodisplay); } } }
public dhAccount GetdhAccount(dhDBnames objDBNames, dhAccount objAccount) { dsGeneral ds = new dsGeneral(); DataSet dsreturn = objDatabase.GetDataSet(objDBNames, objAccount, "xmlGetAccounts", (DataSet)ds, "dtPosAccounts"); // dhAccount returnObject = null; dsGeneral.dtPosAccountsDataTable retdt = ((dsGeneral)dsreturn).dtPosAccounts; ObservableCollection <dhAccount> listAccount = ReflectionUtility.DataTableToObservableCollection <dhAccount>(retdt); if (listAccount.Count > 0) { return(listAccount.SingleOrDefault()); } else { return(null); } //retdt.ToList<dhAccount>(); //foreach (DataRow row in retdt.Rows) //{ // returnObject = new dhAccount // { // IItemID = Convert.ToInt32(row["IItemID"]), // FUnitePrice = Convert.ToDouble(row["FUnitePrice"]), // VItemName = Convert.ToString(row["VItemName"]), // FMaxDiscountPresent = Convert.ToDouble(row["fMaxDiscountPresent"]), // IQuantity = 1, // Ammount = Convert.ToDouble(row["FUnitePrice"]) * 1, // IStockIn = Convert.ToInt32(String.IsNullOrEmpty(row["IStockIn"].ToString()) ? 0 : row["IStockIn"]), // IStockOut = Convert.ToInt32(String.IsNullOrEmpty(row["IStockOut"].ToString()) ? 0 : row["IStockOut"]), // ICurrantStock = Convert.ToInt32(String.IsNullOrEmpty(row["ICurrantStock"].ToString()) ? 0 : row["ICurrantStock"]), // IsAvailable = Convert.ToInt32(String.IsNullOrEmpty(row["ICurrantStock"].ToString()) ? 0 : row["ICurrantStock"]) > 0 ? true : false, // StockStatus = Convert.ToInt32(String.IsNullOrEmpty(row["ICurrantStock"].ToString()) ? 0 : row["ICurrantStock"]) > 0 ? "Available" : "Not Available", // }; //} // return returnObject; }
private void UserControl_Loaded_1(object sender, RoutedEventArgs e) { dhModule objMod = new dhModule(); //objMod.IModuleID = MuduleID; // if (objUser != null) // { //#region "Allowed Menu" objMod.AllowdModule = Globalized.objAppPreference.VEnableModules; objMod.IModuleParentID = 0; dsGeneral.dtPosModuleDataTable dtm = iFacede.GetModule(Globalized.ObjDbName, objMod); ObservableCollection <dhModule> sequence = ReflectionUtility.DataTableToObservableCollection <dhModule>(dtm); List <string> Ids = Globalized.ObjCurrentUser.VAllowdModule.Split(',').ToList <string>(); ModuleControl objModuleToadd = new ModuleControl(); MControls.Children.Clear(); foreach (dhModule item in sequence) { string Contian = Ids.Distinct <string>().Cast <string>().Where(i => i.Equals(item.IModuleID.ToString())).SingleOrDefault(); if ((Contian == null) || (item.IModuleParentID != 0)) { continue; } else { MControls.Children.Add(objModuleToadd = new ModuleControl(item.IModuleID)); } } //int length = 7; ////MControls //ModuleControl Test = new ModuleControl(); //for (int i = 0; i < length; i++) //{ //} }
private void loadData(dhParty objParty /* , Boolean ShowResultCount = false*/) { dsGeneral.dtPosPartyDataTable dtparty = iFacede.GetParty(Globalized.ObjDbName, objParty); Parties = ReflectionUtility.DataTableToObservableCollection <dhParty>(dtparty); }
private void Button_Click(object sender, RoutedEventArgs e) { try { dhEmployee objEmployee = new dhEmployee(); objEmployee = (dhEmployee)EmpInfo.DataContext; objEmployee.VMartialStatus = VMartialStatus.SelectedValue.ToString(); int IIEmpid; if (cmbIEmpTypeId.SelectedValue != null) { int.TryParse(cmbIEmpTypeId.SelectedValue.ToString(), out IIEmpid); objEmployee.IEmpTypeId = IIEmpid; } else { objEmployee.IEmpTypeId = 1; objEmployee.IEmpTypeId = 1; } // check for existing Name dhEmployeeValidator validator = new dhEmployeeValidator(); FluentValidation.Results.ValidationResult results = validator.Validate(objEmployee); bool validationSucceeded = results.IsValid; IList <ValidationFailure> failures = results.Errors; if (validationSucceeded) { dsGeneral.dtEmployeeDataTable dtEmployee = iFacede.GetEmployee(Globalized.ObjDbName, new dhEmployee()); ObservableCollection <dhEmployee> listItem = ReflectionUtility.DataTableToObservableCollection <dhEmployee>(dtEmployee); string bFound = null; //if ((this.vEmployeeNameTextBox.Text!= "") && (item.VEmployeeName != "")) { } //foreach (dhEmployee item in ListAccounts) //{ // string[] words = item.VEmployeeName.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); // string[] filter = objEmployee.VEmployeeName.ToLower().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); // if ((objEmployee.IEmployeeID != null) && (item.IEmployeeID == objEmployee.IEmployeeID)) // { // continue; // } // bFound = words.Where(x => filter.Contains(x.ToLower())).FirstOrDefault(); // if (bFound != null) // { // break; // } //} //if (bFound != null) //{ // if (!blUtil.OverrideInformation(objEmployee.VEmployeeName, bFound)) // { // this.vEmployeeNameTextBox.SelectAll(); // this.vEmployeeNameTextBox.Focus(); // return; // } //} //if (iSaleManIDComboBox.SelectedValue != null) //{ // objEmployee.ISaleManID = Convert.ToInt32(iSaleManIDComboBox.SelectedValue.ToString()); //} // objEmployee.VCity = VMartialStatus.SelectedValue.ToString(); // objEmployee.VEmployeeadress = objEmployee.VMarket + " , " + objEmployee.VArea + " , " + objEmployee.VDistrict + " , " + objEmployee.VCity; //lblErrorMsg.Visibility = Visibility.Hidden; DataSet dsr = iFacede.InsertUpdateEmployee(Globalized.ObjDbName, objEmployee); if (dsr.Tables[0].Rows.Count > 0) { objEmployee.IEmpid = Convert.ToInt32(dsr.Tables[0].Rows[0][0].ToString()); } if (objEmployee.IUpdate == 1) { //lblErrorMsg.Visibility = Visibility.Visible; //lblErrorMsg.Foreground = Brushes.Green; //lblErrorMsg.Content = "Employee ' " + objEmployee.VEmployeeName + " ' Information is Updated Successfully"; Globalized.SetMsg("Employee ' " + objEmployee.VEmpfName + " ' Information is Updated Successfully", DataHolders.MsgType.Info); // Globalized.ShowMsg(lblErrorMsg); GlobalObjEmployee = objEmployee; // We need to get data from database to bind it back LoadData(); // LoadData(); } else { Globalized.SetMsg("Employee ' " + objEmployee.VEmpfName + " ' Information is Saved Successfully", DataHolders.MsgType.Info); objEmployee.IUpdate = 1; GlobalObjEmployee = objEmployee; // We need to get data from database to bind it back LoadData(); // ModernWindow Obj = (ModernWindow)Application.Current.MainWindow; // GlobalObjEmployee = null; // Obj.ContentSource = new Uri("/Pages/emp/listEmp.xaml", UriKind.Relative); } } else { System.Media.SystemSounds.Beep.Play(); lblErrorMsg.Visibility = Visibility.Visible; lblErrorMsg.Foreground = Brushes.Red; lblErrorMsg.Content = failures.First().ErrorMessage; } //Globalized.ShowMsg(lblErrorMsg); } catch (Exception ex) { Globalized.setException(ex, lblErrorMsg, MsgType.Error); } }
private void GenrateSallary(dhSalary objPassed = null) { dhSalary objSalry = new dhSalary(); objSalry.iEmpId = GlobalObjEmployee.IEmpid; dsGeneral.dtSalaryDataTable SalaryDataTable; SalaryDataTable = iFacede.GetSalary(Globalized.ObjDbName, objSalry); ObservableCollection <dhSalary> objSalary = ReflectionUtility.DataTableToObservableCollection <dhSalary>(SalaryDataTable); dhSalary NSalary; //if ((objPassed != null)&& (objPassed!= (new dhSalary()))) //{ // NSalary = objPassed ;//new dhSalary(); // NSalary.dSrtDate = ((DateTime)(objPassed.dEndDate)).AddDays(1); // this.dddSrtDate.DisplayDateStart = (DateTime)NSalary.dSrtDate; // NSalary.dEndDate = ((DateTime)(NSalary.dSrtDate)).AddDays(Convert.ToDouble(Globalized.ObjPrefernce.ISalaryDays)) > DateTime.Now ? DateTime.Now : ((DateTime)(NSalary.dSrtDate)).AddDays(Convert.ToDouble(Globalized.ObjPrefernce.ISalaryDays)); // this.dddSrtDate.DisplayDateStart = NSalary.dSrtDate; // this.dddEndDate.DisplayDateStart = NSalary.dEndDate; // NSalary.iDays = (((DateTime)(NSalary.dEndDate)) - ((DateTime)(NSalary.dSrtDate))).Days;//Globalized.ObjPrefernce.ISalaryDays; // NSalary.IAbsentdays = 0; // NSalary.iDeduction = 0; // NSalary.iAmount = 0; // NSalary.FOverTime = 0; // this.SalleryBox.DataContext = NSalary; //} //else //{ DateTime StartDate = DateTime.Now; if (objSalary.Count > 0) { NSalary = objSalary[0]; StartDate = ((DateTime)NSalary.dEndDate).AddDays(1); } else { NSalary = new dhSalary(); StartDate = GlobalObjEmployee.DDateOfJoining == null ? DateTime.Now : (DateTime)GlobalObjEmployee.DDateOfJoining; } this.dddSrtDate.DisplayDateStart = StartDate; this.dddEndDate.DisplayDateStart = StartDate; NSalary.dSrtDate = StartDate;//GlobalObjEmployee.DDateOfJoining; DateTime Dend = StartDate.AddDays(Globalized.ObjPrefernce.ISalaryDays); NSalary.dEndDate = Dend; //NSalary.dSrtDate = GlobalObjEmployee.DDateOfJoining == null ? DateTime.Now : (DateTime)GlobalObjEmployee.DDateOfJoining; // GlobalObjEmployee.DDateOfJoining; //DateTime StartDate = GlobalObjEmployee.DDateOfJoining == null ? DateTime.Now : (DateTime)GlobalObjEmployee.DDateOfJoining; // NSalary.dSrtDate = ((DateTime)(objPassed.dEndDate)).AddDays(1); // NSalary.dEndDate = ((DateTime)(NSalary.dSrtDate)).AddDays(Convert.ToDouble(Globalized.ObjPrefernce.ISalaryDays)) > DateTime.Now ? DateTime.Now : ((DateTime)(NSalary.dSrtDate)).AddDays(Convert.ToDouble(Globalized.ObjPrefernce.ISalaryDays)); NSalary.iDays = (((DateTime)(NSalary.dEndDate)) - ((DateTime)(NSalary.dSrtDate))).Days;//Globalized.ObjPrefernce.ISalaryDays; NSalary.IAbsentdays = 0; NSalary.iDeduction = 0; NSalary.iAmount = 0; NSalary.FOverTime = 0; this.SalleryBox.DataContext = NSalary; //if (objSalary.Count > 0) //{ // dhSalary objNewSalary = new dhSalary(); // objNewSalary.dSrtDate = objSalary[0].dEndDate; // DateTime StartDate = (DateTime)objNewSalary.dSrtDate;//GlobalObjEmployee.DDateOfJoining == null ? DateTime.Now : (DateTime)GlobalObjEmployee.DDateOfJoining; // DateTime Dend = StartDate.AddDays(Globalized.ObjPrefernce.ISalaryDays); // objNewSalary.dEndDate = Dend; // objNewSalary.iDays = Globalized.ObjPrefernce.ISalaryDays; // objNewSalary.IAbsentdays = 0; // objNewSalary.iDeduction = 0; // objNewSalary.iAmount = 0; // objNewSalary.FOverTime = 0; // this.SalleryBox.DataContext = objNewSalary; // //CalculateSallary(); //} //else //{ // dhSalary objNewSalary = new dhSalary(); // objNewSalary.dSrtDate = GlobalObjEmployee.DDateOfJoining; // DateTime StartDate = GlobalObjEmployee.DDateOfJoining == null ? DateTime.Now : (DateTime)GlobalObjEmployee.DDateOfJoining; // DateTime Dend = StartDate.AddDays(Globalized.ObjPrefernce.ISalaryDays); // objNewSalary.dEndDate = Dend; // objNewSalary.iDays = Globalized.ObjPrefernce.ISalaryDays; // objNewSalary.IAbsentdays = 0; // objNewSalary.iDeduction = 0; // objNewSalary.iAmount = 0; // objNewSalary.FOverTime = 0; // //objNewSalary. // // int DaysToWork = (DateTime.DaysInMonth(Dend.Year, Dend.Month)); // // objNewSalary.iAmount = (GlobalObjEmployee.IBasicSalary / DaysToWork) * Globalized.ObjPrefernce.ISalaryDays; // this.SalleryBox.DataContext = objNewSalary; //} // } CalculateSallary(); gnrtSalary.Content = "Save"; Globalized.setException("Salary is calculated for the period click to Save to save.", lblSalarymsg, DataHolders.MsgType.Info); }
private void loadData(dhAccount objAccount, Boolean ShowResultCount = false) { dsGeneral.dtPosAccountsDataTable dtAccounts = iFacede.GetAccount(Globalized.ObjDbName, objAccount); EnumerableRowCollection <dsGeneral.dtPosAccountsRow> Filter = null; sequence.Clear(); sequence = ReflectionUtility.DataTableToObservableCollection <dhAccount>(dtAccounts); //if (Globalized.ObjCurrentUser.VUserType == "Super") //{ // Filter = from r in dtAccounts.AsEnumerable() // where (r.Field<int>("VUserType") == Module.IModuleID) && (r.Field<bool>("bIsActive") == true) // select r; //} //if (Globalized.ObjCurrentUser.VUserType == "Owner") //{ // Filter = from r in dtAccounts.AsEnumerable() // where (r.Field<string>("VUserType") == "Admin") || (r.Field<string>("VUserType") == "AccountIn") || (r.Field<string>("VUserType") == "Owner") // select r; //} //if (Globalized.ObjCurrentUser.VUserType == "Admin") //{ // Filter = from r in dtAccounts.AsEnumerable() // where ((r.Field<string>("VUserType") == "Admin") && (r.Field<int>("iAccountid") == Globalized.ObjCurrentUser.IAccountid) ) || (r.Field<string>("VUserType") == "AccountIn") // select r; //} //if (Globalized.ObjCurrentUser.VUserType == "AccountIn") //{ // Filter = from r in dtAccounts.AsEnumerable() // where (r.Field<string>("VUserType") == "AccountIn") && (r.Field<int>("iAccountid") == Globalized.ObjCurrentUser.IAccountid) // select r; //} if (Filter != null) { int CountRowInner = Filter.Count <dsGeneral.dtPosAccountsRow>(); if (CountRowInner > 0) { DataTable dtFilter = Filter.CopyToDataTable(); sequence = ReflectionUtility.DataTableToObservableCollection <dhAccount>(dtFilter); } else { sequence = null; } } AccountList.ItemsSource = sequence; //pageControl.PageContract = null; //pageControl.PageContract = this; // pageControl_PreviewPageChange(null, null); // Globalized.ShowMsg(lblErrorMsg); //if (Globalized.lastMsg != null) //{ // //System.Windows.Forms.MessageBox.Show( ); // lblErrorMsg.Content = Globalized.lastMsg; // lblErrorMsg.Visibility = System.Windows.Visibility.Visible; // Globalized.lastMsg = null; //} //else //{ // lblErrorMsg.Content = ""; // lblErrorMsg.Visibility = System.Windows.Visibility.Hidden; //} // show msg for local search if ((ShowResultCount) && (sequence != null)) { String msg = String.Format(" {0} Search Results Found", sequence.Count); //pageControl.ReLoad(); Globalized.setException(msg, lblErrorMsg, DataHolders.MsgType.Info); Globalized.ShowMsg(lblErrorMsg); } else { if (sequence == null) { String msg = String.Format(" {0} Search Results Found", 0); Globalized.setException(msg, lblErrorMsg, DataHolders.MsgType.Info); Globalized.ShowMsg(lblErrorMsg); } if (ShowResultCount == false) { lblErrorMsg.Visibility = Visibility.Hidden; } } }
private void loadData(dhInvoice objInovice /* , Boolean ShowResultCount = false*/) { DataSet dtInovice = iFacede.GetSaleInovice(Globalized.ObjDbName, objInovice); Invoices = ReflectionUtility.DataTableToObservableCollection <dhInvoice>(dtInovice.Tables[0]); }
private void BuildAllowdModuleCheckBox() { StackPanel OuterStock = new StackPanel(); //OuterStock. = new Thickness(0, 5, 15, -25); dhModule objModule = new dhModule(); // if (objUser != null) // { #region "Allowed Menu" // objModule.AllowdModule = Globalized.objAppPreference.VEnableModules; dsGeneral.dtPosModuleDataTable dtm = iFacede.GetModule(Globalized.ObjDbName, objModule); EnumerableRowCollection <dsGeneral.dtPosModuleRow> result2 = from r in dtm.AsEnumerable() where (r.Field <int>("iModuleParentID") == 0) select r; int CountRow = result2.Count <dsGeneral.dtPosModuleRow>(); if (CountRow > 0) { DataTable dtResult2 = result2.CopyToDataTable(); ObservableCollection <dhModule> sequence = ReflectionUtility.DataTableToObservableCollection <dhModule>(dtResult2); if (sequence.Count > 0) { foreach (dhModule Module in sequence) { GroupBox objGroup = new GroupBox(); objGroup.Header = Module.VDisplayName; objGroup.Margin = new Thickness(0, 0, 0, 15); #region "Grid" Grid grid = new Grid(); // grid.Width = 400; // Create column definitions. ColumnDefinition columnDefinition1 = new ColumnDefinition(); ColumnDefinition columnDefinition2 = new ColumnDefinition(); columnDefinition1.Width = new GridLength(200); columnDefinition2.Width = new GridLength(200); // Attached definitions to grid. grid.ColumnDefinitions.Add(columnDefinition1); grid.ColumnDefinitions.Add(columnDefinition2); CheckBox cb = new CheckBox(); cb.Name = Module.VModuleName.ToString() + Module.IModuleID.ToString(); cb.Content = Module.VDisplayName.ToString(); // cb.Width = 100; cb.Margin = new Thickness(5, 5, 5, 5); cb.DataContext = Module; Binding myBinding = new Binding("BIsActive"); myBinding.Source = Module; cb.SetBinding(CheckBox.IsCheckedProperty, myBinding); cb.Tag = Module; cb.AddHandler(CheckBox.CheckedEvent, new RoutedEventHandler(DynamicCheckBox_Checked)); cb.AddHandler(CheckBox.UncheckedEvent, new RoutedEventHandler(DynamicCheckBox_Unchecked)); RowDefinition rowDefinition1 = new RowDefinition(); rowDefinition1.Height = new GridLength(30); grid.RowDefinitions.Add(rowDefinition1); grid.Children.Add(cb); Grid.SetColumn(cb, 0); Grid.SetRow(cb, 0); #endregion "Grid" EnumerableRowCollection <dsGeneral.dtPosModuleRow> Filter = from r2 in dtm.AsEnumerable() where (r2.Field <int>("iModuleParentID") == Module.IModuleID) select r2; int CountRowInner = result2.Count <dsGeneral.dtPosModuleRow>(); if (CountRowInner > 0) { DataTable dtFilter; if (Filter.Count() > 0) { dtFilter = Filter.CopyToDataTable(); } else { dtFilter = new DataTable(); } ObservableCollection <dhModule> sequencefilter = ReflectionUtility.DataTableToObservableCollection <dhModule>(dtFilter); if (sequencefilter.Count > 0) { // int Bool = 1; int row = 1; int col = 0; RowDefinition rowDefinition = new RowDefinition(); rowDefinition.Height = new GridLength(30); grid.RowDefinitions.Add(rowDefinition); #region "Child Module" foreach (dhModule SubModule in sequencefilter) { //for (int i = 0; i < sequencefilter.Count ; i++) //{ CheckBox NestedCb = new CheckBox(); //NestedStp.Orientation = Orientation.Horizontal; NestedCb.Name = "Sub" + SubModule.VModuleName.ToString() + SubModule.IModuleID.ToString(); NestedCb.Content = SubModule.VDisplayName.ToString(); NestedCb.Margin = new Thickness(35, 5, 5, 5); if (col == 2) { row = row + 1; col = 0; RowDefinition rowDefinition3 = new RowDefinition(); rowDefinition3.Height = new GridLength(30); grid.RowDefinitions.Add(rowDefinition3); } NestedCb.DataContext = Module; Binding mySubBinding = new Binding("BIsActive"); mySubBinding.Source = SubModule; NestedCb.SetBinding(CheckBox.IsCheckedProperty, mySubBinding); NestedCb.Tag = SubModule; grid.Children.Add(NestedCb); Grid.SetColumn(NestedCb, col); Grid.SetRow(NestedCb, row); col += 1; } #endregion "Child Module" objGroup.Content = grid; } OuterStock.Children.Add(objGroup); } } RightsGrid.Children.Add(OuterStock); } } #endregion "Allowed Menu" // } }
private void button1_Click(object sender, RoutedEventArgs e) { dhUsers objUser = new dhUsers(); try { if (String.IsNullOrEmpty(UserName.Text.Trim())) { throw new ApplicationException("Please Enter User Name."); } if (String.IsNullOrEmpty(Password.Password.Trim())) { throw new ApplicationException("Please Enter Password."); } objUser.VLogin = UserName.Text.Trim(); objUser.VPassword = Password.Password.Trim(); objUser = iFacede.Authentication(Globalized.ObjDbName, objUser); if (objUser.LoginStatus == true) { LoadComponent(); if ((objUser.BIsActive != true) && (objUser.VUserType != "Super")) { throw new ApplicationException("Your account status is inactive, contact to administrator/ Support."); } // set the current user Globalized.ObjCurrentUser = objUser; // ModernWindow Obj = (ModernWindow)Application.Current.MainWindow; dhPreference GlobalObjPreference = new dhPreference(); dsGeneral.dtPosPreferenceDataTable dt = iFacede.GetPreference(Globalized.ObjDbName, GlobalObjPreference); // intialize object if (dt.Rows.Count > 0) { ObservableCollection <dhPreference> listItem = ReflectionUtility.DataTableToObservableCollection <dhPreference>(dt); if (listItem.Count > 0) { GlobalObjPreference = listItem.Cast <dhPreference>().SingleOrDefault(); } } else { GlobalObjPreference = new dhPreference(); } Globalized.ObjPrefernce = GlobalObjPreference; //iFacede.GetUserMenu(Globalized.ObjDbName, Obj, objAppPreference, objUser); myMenu = new SublimeMenu(Globalized.ObjCurrentUser); if (myMenu.MenuItems.Count > 0) { this.ListViewMenu.ItemsSource = myMenu.MenuItems; // this.SideMenu.ItemsSource = myMenu.MenuItems; // this.SideMenu.Visibility = System.Windows.Visibility.Visible; this.MainGrid.Visibility = System.Windows.Visibility.Hidden; this.DocLogin.Visibility = Visibility.Visible; } else { // this.SideMenu.Visibility = System.Windows.Visibility.Hidden; this.MainGrid.Visibility = System.Windows.Visibility.Visible; this.DocLogin.Visibility = Visibility.Hidden; } //Obj.ContentSource Globalized.AccountListOptimizated(); } else { throw new ApplicationException("Invalid Username/Password"); } } catch (Exception ex) { lblErrorMsg.Visibility = System.Windows.Visibility.Visible; lblErrorMsg.Foreground = Brushes.Red; lblErrorMsg.Content = ex.Message; } }