private void grdList_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            try
            {
                if (grdList.SelectedValue == null)
                {
                    return;
                }

                parentId = (grdList.SelectedValue as dynamic).ID;
                string code = (grdList.SelectedValue as dynamic).Code;
                string name = (grdList.SelectedValue as dynamic).Name;

                Guid?type = Business.GetPersonStructureDefineBusiness().GetByParentID(parentId).Select(r => r.Type).FirstOrDefault();

                SetGrid(type);

                if (LabelList.Count > depth)
                {
                    LabelList.RemoveAt(depth);
                }
                LabelList.Add(new LabelValues()
                {
                    code = code, ID = parentId.ToGUID(), name = name
                });

                AddLabel(LabelList[depth]);
            }
            catch
            {
                throw;
            }
        }
 private void SetGrid(Guid?type)
 {
     if (type == Constants.CodeTitle.PersonIDGroup)
     {
         grdList.ItemsSource = null;
         return;
     }
     grdList.ItemsSource = Business.GetPersonStructureDefineBusiness().GetByType(type).
                           Select(r => new { ID = r.ID, Code = r.Code, Name = r.Name, Type = r.Type }).ToList();
 }
        private void SetGridOnRemove(Guid?id)
        {
            //get removed Parent ID
            Guid?Parentid = Business.GetPersonStructureDefineBusiness().GetById(id).
                            Select(r => r.Parent_ID).FirstOrDefault();

            if (Parentid == null)
            {
                SetGrid(Constants.CodeTitle.PersonPrimeryGroup);
            }
            else
            {
                //set Item source on parentid like removed parentid
                grdList.ItemsSource = Business.GetPersonStructureDefineBusiness().GetAll().Where(r => r.Parent_ID == Parentid).ToList();
            }
        }
Exemple #4
0
        private void commitchange(PayrollPerson payrollPerson)
        {
            payrollPerson.PFristName          = txtFirstName.Text;
            payrollPerson.PLastName           = txtLastName.Text;
            payrollPerson.PFather             = txtFather.Text;
            payrollPerson.PSex                = cmbGender.SelectedValue.ToGUID();
            payrollPerson.PIdNational         = txtNationalCode.Text;
            payrollPerson.PSHSH               = txtSHSH.Text;
            payrollPerson.PMarriage           = cmbMarriageState.SelectedValue.ToGUID();
            payrollPerson.PNumberChild        = txtQTY.Text.ToInt();
            payrollPerson.PPhoneWork          = txtTelWork.Text;
            payrollPerson.PPhoneHome          = txtTelHome.Text;
            payrollPerson.PMobile             = txtMobile.Text;
            payrollPerson.PIdPostal           = txtPostalCode.Text;
            payrollPerson.PBrithDate          = pdcBirthDay.Text;
            payrollPerson.PAddress            = txtAddress.Text;
            payrollPerson.PDescription        = txtDesc.Text;
            payrollPerson.Tax_madrak          = (int)cmbProofTax.SelectedValue;
            payrollPerson.Tax_onvanShoghl     = (int)cmbJobTax.SelectedValue;
            payrollPerson.Tax_serishenasnameh = (int)cmbSeriesTax.SelectedValue;
            payrollPerson.Tax_vazmaskan       = (int)cmbHouseStateTax.SelectedValue;
            payrollPerson.Tax_meliat          = (int)cmbNationalityTax.SelectedValue;
            payrollPerson.Tax_namekeshvar     = (int)cmbCountryTax.SelectedValue;
            payrollPerson.Tax_nezamvazifeh    = cmbMilitaryTax.SelectedValue.ToGUID();
            payrollPerson.Tax_rasteshoghli    = (int)cmbJobCategoriesTax.SelectedValue;
            payrollPerson.Tax_vazmashin       = (int)cmbCarStateTax.SelectedValue;
            payrollPerson.code_moafiat_maliat = (int)cmbLoanInsurance.SelectedValue;
            payrollPerson.Insurance_keshvar   = (int)cmbCountryInsurance.SelectedValue;
            payrollPerson.Insurance_shahr     = (int)cmbPlaceOfIssue.SelectedValue;
            payrollPerson.Insurance_mashagel  = cmbJobsInsurance.SelectedValue.ToString();
            payrollPerson.Insurance_tahsilat  = (int)cmbEducationInsurance.SelectedValue;
            payrollPerson.Insurance_reshteh   = (int)cmbFieldOfStudyInsurance.SelectedValue;
            payrollPerson.Insurance_meliat    = cmbNationalityInsurance.SelectedValue.ToString();
            payrollPerson.code_moafiat_bimeh  = (int)cmbExemptionTax.SelectedValue;
            payrollPerson.PPerson_Code        = string.Format("{0}{1}", txtCodeF.Text, txtCodeS.Text);
            string pname = string.Format("{0} {1}", txtFirstName.Text, txtLastName.Text);

            Data.PersonStructureDefine _personDefine =
                Business.GetPersonStructureDefineChildBusiness().GetStructure(Constants.CodeTitle.PersonIDGroup, pname, PersonParentID, payrollPerson.PPerson_Code);

            payrollPerson.PPerson_Code = _personDefine.Code;

            int    Primerycodelen   = (int)Business.GetCodeTitleBusiness().GetById(Constants.CodeTitle.PersonPrimeryGroup).CodeLen;
            int    Secendarycodelen = (int)Business.GetCodeTitleBusiness().GetById(Constants.CodeTitle.PersonPrimeryGroup).CodeLen;
            string s = Business.GetPersonStructureDefineBusiness().GetMaxCode(PersonCode).Select(r => r.Code).FirstOrDefault();

            _personDefine.Type = Constants.CodeTitle.PersonIDGroup;

            using (var scope = new TransactionScope(TransactionScopeOption.Required, new TransactionOptions()
            {
                IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted,
                Timeout = new TimeSpan(2, 0, 0)
            }))
            {
                Business.GetPersonStructureDefineChildBusiness().SaveWithID(_personDefine);
                payrollPerson.PersonStructerID = _personDefine.ID;
                Business.GetPayrollPersonBusiness().Save(payrollPerson);
                Business.GetPayrollPersonWorkDoneBusiness().Save(new PayrollPersonWorkDone()
                {
                    IDPayrollPerson = payrollPerson.id
                });
                scope.Complete();
            }

            this.Close();
        }