private void BtnDeleteProc_Click(object sender, RoutedEventArgs e) { try { MessageBoxResult messageBoxResult = System.Windows.MessageBox.Show("Are you sure?", "Delete Confirmation", System.Windows.MessageBoxButton.YesNo); if (messageBoxResult == MessageBoxResult.Yes) { if (ObjToEditPro != null) { dhDocProcedures obj = MyViewModel.db.DocProcedures.Find(ObjToEditPro.IDocProceduresId); if (obj != null) { obj.BIsActive = false; MyViewModel.db.SaveChanges(); MyViewModel.ObjNewDoctor.DocProcedures.Remove(ObjToEditPro); this.DocProcedures.ItemsSource = this.MyViewModel.ObjNewDoctor.DocProcedures; } else { MyViewModel.ObjNewDoctor.DocProcedures.Remove(ObjToEditPro); this.DocProcedures.ItemsSource = this.MyViewModel.ObjNewDoctor.DocProcedures; } } MyViewModel.ObjNewDoctor.DocProcedures = MyViewModel.GetDocProcedures(); Globalized.SetMsg("DOC04", DataHolders.MsgType.Info); Globalized.ShowMsg(lblErrorMsg); } } catch (Exception ex) { // throw; } }
private void InsertRecord() { dhItems objInsert = new dhItems(); objInsert = (dhItems)this.ItemGrid_.DataContext; DataSet ds = iFacedeLayer.iFacede.InsertUpdateItem(Globalized.ObjDbName, objInsert); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["iItemID"].ToString() != "-1") { if (objInsert.IUpdate == 1) { Globalized.SetMsg("I02", DataHolders.MsgType.Info); } else { Globalized.SetMsg("I01", DataHolders.MsgType.Info); objInsert.IUpdate = 1; } AddItemViewModel ObjSetToEdit = new AddItemViewModel(objInsert); Globalized.LoadThisObject(ObjSetToEdit, "Edit Item '" + objInsert.VItemName + "'", Globalized.AppModuleList.Where(xx => xx.VModuleName == "Store").FirstOrDefault().VShortDescription); } else{ Globalized.SetMsg("I013", MsgType.Error); Globalized.ShowMsg(lblErrorMsg); } } }
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); }
private void UserControl_Loaded_1(object sender, RoutedEventArgs e) { vCityList.DataContext = GetTable(); vCityList.DisplayMemberPath = "VCityName"; vCityList.SelectedValuePath = "VCityName"; Globalized.ShowMsg(lblErrorMsg); }
// dhParty GlobalObjParty = new dhParty(); public AddPartyView(dhParty Obj) { InitializeComponent(); dhSaleMan objSaleMan = new dhSaleMan(); Globalized.ShowMsg(lblErrorMsg); }
private void InsertUpdateAccount() { dhAccount objInsert = new dhAccount(); objInsert = (dhAccount)this.AccountDt.DataContext; dhAccountValidator validator = new dhAccountValidator(); FluentValidation.Results.ValidationResult results = validator.Validate(objInsert); bool validationSucceeded = results.IsValid; IList <ValidationFailure> failures = results.Errors; if (validationSucceeded) { if (this.vAccountType.SelectedValue != null) { objInsert.IFinaceType = Convert.ToInt32(this.vAccountType.SelectedValue.ToString()); } else { throw new ApplicationException("Please Select Account Type."); } DataSet ds = iFacede.InsertUpdateAccount(Globalized.ObjDbName, objInsert); if (ds.Tables[0].Rows.Count > 0) { if (objInsert.IUpdate == 1) { string msg = "Account '" + objInsert.AccountName + "' information is updated successfully."; Globalized.setException(msg, lblErrorMsg, DataHolders.MsgType.Info); //Globalized.SetMsg(msg, DataHolders.MsgType.Info); //Globalized.ShowMsg(lblErrorMsg); } else { System.Media.SystemSounds.Beep.Play(); lblErrorMsg.Visibility = Visibility.Hidden; Globalized.SetMsg("New Acount '" + objInsert.AccountName + "' is added successfully.", DataHolders.MsgType.Info); objTodisplay.IUpdate = 1; this.DataContext = objTodisplay; Globalized.ShowMsg(lblErrorMsg); } } Globalized.AccountListOptimizated(); } else { throw new ApplicationException(failures.First().ErrorMessage); } }
private void UserControl_Loaded_1(object sender, RoutedEventArgs e) { Globalized.ShowMsg(lblErrorMsg); //if ((GlobalDhItem == null) && (GlobalDhItem.IUpdate != 1)) //{ // GlobalDhItem = new dhItems(); // if (Globalized.ObjCurrentUser.BCanMakeEditAble != false) // { // this.bIsEditable.Visibility = Visibility.Visible; // } //} }
private void SaveAppointment(object sender, RoutedEventArgs e) { try { blAppointment objBlAppointment = new blAppointment(); dhAppointment ObjNewAppointment = (dhAppointment)this.AppointmentInfo.DataContext; // cehck for patient dhPatient ObjPatient = (dhPatient)this.PatientInformationGrid.DataContext; // doctor long iDocId = ((dhDoctorView)this.DoctorInformationGrid.DataContext).IDocid; dhDoctors objDoc = MyViewModel.db.Doctors.AsNoTracking().Where(x => x.IDocid == iDocId && x.BActive == true).FirstOrDefault(); if (objDoc == null) { return; } if (ObjPatient.iPatid == 0 || ObjPatient.iPatid < 0) { BlPatient objBl = new BlPatient(); objBl.AddNewPatient(ObjPatient); // need to save the patient first //MyViewModel.db.Patients.Add(ObjPatient); //MyViewModel.db.SaveChanges(); // set for patatient id ObjNewAppointment.IPatid = ObjPatient.iPatid; } // check for doctors if (ObjNewAppointment != null) { Dictionary <long, string> objDic = objBlAppointment.GetNextToken(objDoc, ObjNewAppointment); ObjNewAppointment.FormatedTokenNumber = objDic.First().Value; ObjNewAppointment.IToken_Number = objDic.First().Key; MyViewModel.db.Appointments.Add(ObjNewAppointment); MyViewModel.db.SaveChanges(); } this.AppointmentInfo.DataContext = ObjNewAppointment; Globalized.SetMsg("AOC01", DataHolders.MsgType.Info); Globalized.ShowMsg(lblErrorMsg); } catch (Exception ex) { Globalized.SetMsg(ex.Message, MsgType.Error); Globalized.ShowMsg(lblErrorMsg); } }
private void loadData(dhEmployee objEmployee, Boolean ShowResultCount = false) { dsGeneral.dtEmployeeDataTable dtEmployee = iFacede.GetEmployee(Globalized.ObjDbName, objEmployee); sequence = ReflectionUtility.DataTableToObservableCollection <dhEmployee>(dtEmployee); EmployeeList.ItemsSource = sequence; // pageControl.PageContract = null; //pageControl.PageContract = this; Globalized.ShowMsg(lblErrorMsg); // 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); } }
public AddItemView(dhItems Obj) { Globalized.ShowMsg(lblErrorMsg); // GlobalDhItem.VItemName = "asdasd"; //GlobalDhItem = Obj; //InitializeComponent(); //this.DataContext = GlobalDhItem; //btnCancel.Visibility = Visibility.Hidden; //if (Obj.IUpdate == 1) //{ // //lblHeading.Text = "Edit Item"; // ShowStock.Visibility = Visibility.Visible; // // lblInStock.Visibility = Visibility.Hidden; // // vItemBarcodeTextBox_Copy1.Visibility = Visibility.Hidden; //} //if (Globalized.ObjCurrentUser.BCanMakeEditAble != false) //{ // this.bIsEditable.Visibility = Visibility.Visible; //} }
private void LoadData() { VMartialStatus.DataContext = GetTable(); cmbIEmpTypeId.DataContext = GetEmType(); VMartialStatus.DisplayMemberPath = "MartialStatus"; VMartialStatus.SelectedValuePath = "MartialStatus"; cmbIEmpTypeId.DisplayMemberPath = "vEmpType"; cmbIEmpTypeId.SelectedValuePath = "iEmpTypeId"; if ((GlobalObjEmployee != null) && (GlobalObjEmployee.IEmpid > 0)) { EmpInfo.DataContext = GlobalObjEmployee; VMartialStatus.SelectedValue = GlobalObjEmployee.VMartialStatus; cmbIEmpTypeId.SelectedValue = GlobalObjEmployee.IEmpTypeId; if (GlobalObjEmployee.Active != true) { SalleryBox.IsEnabled = false; } else { SalleryBox.IsEnabled = true; } //else //{ // SalleryBox.DataContext = new dhSalary(); //} BindSalary(); } else { GlobalObjEmployee = new dhEmployee(); EmpInfo.DataContext = GlobalObjEmployee; SalleryBox.IsEnabled = false; } MyViewModel.ObjAddEdit = GlobalObjEmployee; MyViewModel.EmployeeAccount = Globalized.GetAccountByMdule(MyViewModel.db, MyViewModel.ObjAddEdit.IEmpid, MyViewModel.MyModuel.IModuleID); this.AccountInfo.DataContext = MyViewModel.EmployeeAccount; Globalized.ShowMsg(lblErrorMsg); }
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 BtnSaveDoctor_Click(object sender, RoutedEventArgs e) { try { if (objNewDoctor.IUpdate == 0 || objNewDoctor.IUpdate == null) { if (objNewDoctor.TokenStart == "" || objNewDoctor.TokenStart == null) { objNewDoctor.TokenStart = objNewDoctor.VfName.Substring(0, 2).ToUpper(); } MyViewModel.db.Doctors.Add(objNewDoctor); MyViewModel.db.SaveChanges();; // for investigations foreach (DocInvestigations item in objNewDoctor.DocInvestigations) { item.IDocid = objNewDoctor.IDocid; item.BIsActive = true; MyViewModel.db.DocInvestigations.Add(item); } // for doc procedures dhAccount objAccount = MyViewModel.InsertUpdateAccount(objNewDoctor); MyViewModel.db.Accounts.Add(objAccount); // need to set for doc proc this.AddEditDocProcedures(); Globalized.SetMsg("DOC01", DataHolders.MsgType.Info); } // if update flag is set if (objNewDoctor.IUpdate == 1) { // dhDoctors temp = MyViewModel.db.Doctors.Find(objNewDoctor.IDocid); objNewDoctor = (dhDoctors)this.NewDoctorGrid.DataContext; if (objNewDoctor.TokenStart == "" || objNewDoctor.TokenStart == null) { objNewDoctor.TokenStart = objNewDoctor.VfName.Substring(0, 2).ToUpper(); } MyViewModel.db.Doctors.Attach(objNewDoctor); //.State = EntityState.Added; MyViewModel.db.Entry(objNewDoctor).State = EntityState.Modified; dhAccount objAccount = MyViewModel.InsertUpdateAccount(objNewDoctor); // MyViewModel.db.Accounts.Attach(objAccount); MyViewModel.db.Entry(objAccount).State = EntityState.Modified; // check existing investigation ObservableCollection <DocInvestigations> crntInv = MyViewModel.db.DocInvestigations.Where(x => x.IDocid == objNewDoctor.IDocid && x.BIsActive == true).ToObservableCollection(); foreach (DocInvestigations item in objNewDoctor.DocInvestigations) { item.IDocid = objNewDoctor.IDocid; // make this investigation active item.BIsActive = true; if (crntInv.Select(x => x.IDocInvestigationsId == item.IDocInvestigationsId).FirstOrDefault() == false) { MyViewModel.db.DocInvestigations.Add(item); } else { DocInvestigations tempDoinv = this.MyViewModel.db.DocInvestigations.Find(item.IDocInvestigationsId); if (tempDoinv != null) { tempDoinv = item; } } // if(crntInv.fi) } // need to set for doc proc this.AddEditDocProcedures(); Globalized.SetMsg("DOC02", DataHolders.MsgType.Info); } // final save and update model objNewDoctor.IUpdate = 1; // now it will ebe update object MyViewModel.db.SaveChanges(); // set Doctor MyViewModel.ObjNewDoctor = objNewDoctor; MyViewModel.ObjNewDoctor.DocInvestigations = MyViewModel.GetActiveDocInvestigations(); MyViewModel.DoctorAccount = MyViewModel.GetDocAccount(); this.AccountInfo.DataContext = MyViewModel.DoctorAccount; Globalized.ShowMsg(lblErrorMsg); } catch (Exception ex) { Globalized.SetMsg(ex.Message, MsgType.Error); Globalized.ShowMsg(lblErrorMsg); } // this.DataContext }
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; } } }
public AddItemView() { InitializeComponent(); Globalized.ShowMsg(lblErrorMsg); }
private void SaveTheParty(object sender, RoutedEventArgs e) { try { dhParty objParty = new dhParty(); objParty = (dhParty)grid1.DataContext; objParty.VCity = vCityList.SelectedValue != null?this.vCityList.SelectedValue.ToString() : null; dsGeneral.dtPosPartyDataTable dtParty = iFacede.GetParty(Globalized.ObjDbName, new dhParty()); ObservableCollection <dhParty> listItem = BL.ReflectionUtility.DataTableToObservableCollection <dhParty>(dtParty); string bFound = null; foreach (dhParty item in listItem) { string[] words = item.VPartyName.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); string[] filter = objParty.VPartyName.ToLower().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); if ((objParty.IPartyID != null) && (item.IPartyID == objParty.IPartyID)) { continue; } bFound = words.Where(x => filter.Contains(x.ToLower())).FirstOrDefault(); if (bFound != null) { break; } } if (bFound != null) { if (!blUtil.OverrideInformation(objParty.VPartyName, bFound)) { this.vPartyNameTextBox.SelectAll(); this.vPartyNameTextBox.Focus(); return; } } objParty.VPartyadress = objParty.VMarket + " , " + objParty.VArea + " , " + objParty.VDistrict + " , " + objParty.VCity; lblErrorMsg.Visibility = Visibility.Hidden; DataSet dsr = iFacede.InsertUpdateParty(Globalized.ObjDbName, objParty); if (dsr.Tables.Count > 0) { DataTable dtb = dsr.Tables[0]; if (dtb.Rows.Count > 0) { objParty = BL.ReflectionUtility.DataTableToObservableCollection <dhParty>(dtb).FirstOrDefault(); } } if (((dhParty)grid1.DataContext).IUpdate == 1) { Globalized.SetMsg("P02", DataHolders.MsgType.Info); } else { Globalized.SetMsg("P01", DataHolders.MsgType.Info); objParty.IUpdate = 1; AddPartyViewModel ObjSetToEdit = new AddPartyViewModel(objParty); Globalized.LoadThisObject(ObjSetToEdit, "Edit Party '" + objParty.VPartyName + "'", Globalized.AppModuleList.Where(xx => xx.VDisplayName == "Party").FirstOrDefault().VShortDescription); } Globalized.ShowMsg(lblErrorMsg); } catch (Exception ex) { Globalized.GlobalMsg = null; Globalized.SetMsg(ex.Message, MsgType.Error); Globalized.ShowMsg(lblErrorMsg); } }