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);
                    }
                }

          
            

        }
示例#2
0
        private void Stock_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
                dhParty objTodisplay = new dhParty();

                objTodisplay = ((dhParty)dgr.Item);
                if (objTodisplay != null)
                {
                    objTodisplay.IUpdate = 1;
                    AddPartyViewModel ObjSetToEdit = new AddPartyViewModel(objTodisplay);
                    //objvm.SelectToEdit(new AddPartyViewModel(objTodisplay));
                    Globalized.LoadThisObject(ObjSetToEdit, "Edit Party '" + objTodisplay.VPartyName + "'", Globalized.AppModuleList.Where(xx => xx.VModuleName == "Party").FirstOrDefault().VShortDescription);
                }
            }
        }
        private void DocList_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
                dhDoctors objTodisplay = new dhDoctors();
                // need to update to docview // first get view object then create new doctore obj
                dhDoctorView objtemp = ((dhDoctorView)dgr.Item);


                objTodisplay = this.MyViewModel.db.Doctors.Find(objtemp.IDocid);
                if (objTodisplay != null)
                {
                    objTodisplay.IUpdate = 1;
                    AddDoctorsViewModel ObjSetToEdit = new AddDoctorsViewModel(objTodisplay);
                    //objvm.SelectToEdit(new AddPartyViewModel(objTodisplay));
                    Globalized.LoadThisObject(ObjSetToEdit, "Edit Doctor '" + objTodisplay.VfName + " " + objTodisplay.VlName + "'", Globalized.AppModuleList.Where(xx => xx.VModuleName == "Doctors").FirstOrDefault().VShortDescription);
                }
            }
        }
        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);
            }
        }