Пример #1
0
        private void FrmEmployees_Load(object sender, EventArgs e)
        {
            Pic.Properties.SizeMode = PictureSizeMode.Stretch;
            Setings.View();
            SaveMsgDontShow = Convert.ToBoolean(Setings.GetFiled("SaveMsgDontShow"));
            BasicDataNo     = Convert.ToBoolean(Setings.GetFiled("BasicDataNo"));

            var ht = new Hashtable();

            ht.Add("1", "مبلغ");
            ht.Add("2", "نسبة من الراتب الاساسى");
            ht.Add("3", "نسبة من الراتب المتغير");
            //grdDeduction.Cols["Type"].DataMap = ht;
            //grdMerit.Cols["Type"].DataMap = ht;

            ///*************************
            //grdHoliDays[1, "EnglishName"] = "Saturday";
            //grdHoliDays[1, "ArabicName"] = "السبت";

            //grdHoliDays[2, "EnglishName"] = "Sunday";
            //grdHoliDays[2, "ArabicName"] = "الأحد";

            //grdHoliDays[3, "EnglishName"] = "Monday";
            //grdHoliDays[3, "ArabicName"] = "الإثنين";

            //grdHoliDays[4, "EnglishName"] = "Tuesday";
            //grdHoliDays[4, "ArabicName"] = "الثلاثاء";

            //grdHoliDays[5, "EnglishName"] = "Wednesday";
            //grdHoliDays[5, "ArabicName"] = "الأربعاء";

            //grdHoliDays[6, "EnglishName"] = "Thursday";
            //grdHoliDays[6, "ArabicName"] = "الخميس";

            //grdHoliDays[7, "EnglishName"] = "Friday";
            //grdHoliDays[7, "ArabicName"] = "الجمعة";

            ///*************************
            FillShifts();
            FillDeduction();
            FillMerit();
            Tree1.FillTree();

            FillCities();
            FillReligion();
            FillHealthOffices();
            FillManagements();
            FillJobs();
            FillDepts();
            FillQualification();



            var v = new MATRIX("Employees");

            v.FillComboBox(cmbManager);

            btnNew_Click(null, null);
            Tree1.CheckEdit1.Checked = true;
        }
Пример #2
0
        public FrmMachiens(MATRIX table, string FormName)
        {
            InitializeComponent();

            mTable = table;
            Text   = FormName;
        }
Пример #3
0
        public FrmJobs(MATRIX table, string FormName, string where = "1=1")
        {
            InitializeComponent();

            mTable     = table;
            Text       = FormName;
            this.where = where;
        }
Пример #4
0
        private void cmbMachines_SelectedIndexChanged(object sender, EventArgs e)
        {
            var m = new MATRIX("Machiens");

            m.View("Code='" + cmbMachines.SelectedValue + "'");
            if (m.DR.HasRows)
            {
                txtIP.Text   = (string)m["ip"];
                txtPort.Text = (string)m["Port"];
            }
            else
            {
                txtIP.Text   = "";
                txtPort.Text = "";
            }
        }
Пример #5
0
        private void FillEmployees()
        {
            var v = new MATRIX("Employees");

            v.FillComboBox(cmbEmployees);
        }
Пример #6
0
        private void FillDeductionsType()
        {
            var v = new MATRIX("DeductionsTypes");

            v.FillComboBox(cmbDeductionsType);
        }
Пример #7
0
        private void FillAdditionsType()
        {
            var v = new MATRIX("AdditionsTypes");

            v.FillComboBox(cmbAdditionsType);
        }
Пример #8
0
        public void btnSave_Click(System.Object sender, System.EventArgs e)
        {
            if (txtCode.Text.Trim() == "")
            {
                MessageBox.Show("من فضلك ادخل الكود", "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
            if (txtName.Text.Trim() == "")
            {
                MessageBox.Show("من فضلك ادخل الاسم", "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
            if (NewRecord && mTable.find("Code=N\'" + txtCode.Text.Trim() + "\'"))
            {
                MessageBox.Show("الكود موجود من قبل...ولا يمكن اضافة جديد بهذا الكود", "", MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
                txtCode.Text = "";
                return;
            }

            if (txtFingerPrintCode.Text.Trim() != "")
            {
                if (mTable.find("Code<>N\'" + txtCode.Text.Trim() + "\' and FingerPrintCode=" + txtFingerPrintCode.Text))
                {
                    MessageBox.Show(
                        string.Format("كود الموظف علي ماكنية البصمة موجود بالفعل علي الموظف : {0}", mTable["Code"]), "",
                        MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txtFingerPrintCode.Text = "";
                    return;
                }
            }
            NewRecord = false;

            mTable.Add_New();

            mTable["Code"]            = (BasicDataNo ? Convert.ToInt64(txtCode.Text).ToString() : txtCode.Text);
            mTable["Name"]            = txtName.Text;
            mTable["FingerPrintCode"] = txtFingerPrintCode.Text;
            mTable["Gender"]          = cmbGender.SelectedIndex;
            mTable["ReligionCode"]    = cmbReligionCode.SelectedValue;
            mTable.SetFiled(txtDateofBirth);
            mTable["PlaceofBirth"] = txtPlaceofBirth.Text;
            mTable["MotherName"]   = txtMotherName.Text;
            mTable["FatherName"]   = txtFatherName.Text;

            mTable["HealthOfficecode"] = cmbHealthOfficecode.SelectedValue;
            mTable["NationalID"]       = txtNationalID.Text;
            mTable.SetFiled(txtNationalIDDate);
            mTable["InusranceID"]     = txtInusranceID.Text;
            mTable["MaterialState"]   = cmbMaterialState.SelectedIndex;
            mTable["MilitaryService"] = cmbMilitaryService.SelectedIndex;
            //--------------------

            if (Pic.Image != null)
            {
                Bitmap newBitmap1 = new Bitmap(Pic.Image);
                var    ms1        = new MemoryStream();
                newBitmap1.Save(ms1, ImageFormat.Jpeg);
                byte[] photoAray1 = new byte[ms1.Length];
                ms1.Position = 0;
                ms1.Read(photoAray1, 0, photoAray1.Length);
                ms1.Close();
                mTable["EmployeePicture"] = photoAray1;
            }

            //--------------------


            mTable["Tel1"]     = txtTel1.Text;
            mTable["Tel2"]     = txtTel2.Text;
            mTable["Mobile1"]  = txtMobile1.Text;
            mTable["Mobile2"]  = txtMobile2.Text;
            mTable["Email"]    = txtEmail.Text;
            mTable["CityCode"] = cmbCity.SelectedValue;
            //--------------------
            mTable["VariableSalary"] = txtVariableSalary.Text;
            mTable["BasicSalary"]    = txtBasicSalary.Text;
            mTable["JobCode"]        = cmbJobs.SelectedValue;
            mTable["DeptCode"]       = cmbDepts.SelectedValue;
            mTable["ManagementCode"] = cmbManagements.SelectedValue;
            mTable["Qualification"]  = cmbQualification.SelectedValue;
            mTable["WorkStatus"]     = cmbWorkStatus.SelectedIndex;
            mTable["Manager"]        = cmbManager.SelectedValue;
            mTable["Specialization"] = txtSpecialization.Text;
            mTable.SetFiled(dtbDateofLeavingWork);
            mTable.SetFiled(dtpDateofAppointment);
            mTable["HourPrice"] = txtHourPrice.Text;

            mTable.Update("Code=N\'" + txtCode.Text.Trim() + "\'");

            //------------shifts---------------
            var mEmployeesShifts = new MATRIX("EmployeesShifts");
            //mEmployeesShifts.Delete(string.Format("Employeecode='{0}'", txtCode.Text));
            //for (int i = 1; i < grdShifts.Rows.Count; i++)
            //{
            //    if (grdShifts[i, "ShiftName"] != null)
            //    {
            //        mEmployeesShifts.Add_New();
            //        mEmployeesShifts.SetFiled("EmployeeCode", txtCode.Text);
            //        mEmployeesShifts.SetFiled("ShiftCode", grdShifts[i, "ShiftName"]);
            //        mEmployeesShifts.Update();
            //    }
            //}
            //------------HoliDays---------------

            var mEmployeesHoliDays = new MATRIX("EmployeesHoliDays");
            //mEmployeesHoliDays.Delete(string.Format("Employeecode='{0}'", txtCode.Text));
            //for (int i = 1; i < grdHoliDays.Rows.Count; i++)
            //{
            //    if (grdHoliDays[i, "chk"] != null && (bool)grdHoliDays[i, "chk"])
            //    {
            //        mEmployeesHoliDays.Add_New();
            //        mEmployeesHoliDays.SetFiled("EmployeeCode", txtCode.Text);
            //        mEmployeesHoliDays.SetFiled("EnglishName", grdHoliDays[i, "EnglishName"]);
            //        mEmployeesHoliDays.Update();
            //    }
            //}

            //------------      الاستقطاعات      ---------------



            var mEmployees2 = new MATRIX("Employees2");


            mEmployees2.Delete(string.Format("Employeecode='{0}'", txtCode.Text));

            //for (int i = 1; i < grdDeduction.Rows.Count; i++)
            //{
            //    if ((grdDeduction[i, "DeductiontName"] + "").Trim() != "")
            //    {
            //        mEmployees2.Add_New();
            //        mEmployees2.SetFiled("EmployeeCode", txtCode.Text);
            //        mEmployees2.SetFiled("Code", grdDeduction[i, "DeductiontName"]);
            //        mEmployees2.SetFiled("DataType", 1);
            //        mEmployees2.SetFiled("Type", grdDeduction[i, "Type"]);
            //        mEmployees2.SetFiled("Qty", grdDeduction[i, "Qty"]);
            //        mEmployees2.SetFiled("Value", grdDeduction[i, "Value"]);
            //        mEmployees2.Update();
            //    }
            //}

            //------------      الاستحقاقات    ---------------
            mEmployees2 = new MATRIX("Employees2");

            //for (int i = 1; i < grdMerit.Rows.Count; i++)
            //{
            //    if ((grdMerit[i, "MerittName"] + "").Trim() != "")
            //    {
            //        mEmployees2.Add_New();
            //        mEmployees2.SetFiled("EmployeeCode", txtCode.Text);
            //        mEmployees2.SetFiled("Code", grdMerit[i, "MerittName"]);
            //        mEmployees2.SetFiled("DataType", 2);
            //        mEmployees2.SetFiled("Type", grdMerit[i, "Type"]);
            //        mEmployees2.SetFiled("Qty", grdMerit[i, "Qty"]);
            //        mEmployees2.SetFiled("Value", grdMerit[i, "Value"]);
            //        mEmployees2.Update();
            //    }
            //}

            //for (int i = 0; i < pnlPic.Controls.Count; i++)
            //{
            //    var doc =new EmployeesDocument();

            //    doc.DocPic= (PictureBox)[i]

            //}
            mEmployees2 = new MATRIX("EmployeesDocuments");
            mEmployees2.Delete(string.Format("Employeecode='{0}'", txtCode.Text));
            foreach (var pic_ in pnlPic.Controls)
            {
                var pic = new PictureBox();
                pic.Image = ((PictureBox)pic_).Image;
                mEmployees2.Add_New();
                mEmployees2["EmployeeCode"] = txtCode.Text;

                //---------------------
                //MemoryStream ms = new MemoryStream();
                //pic.Image.Save(ms, pic.Image.RawFormat);
                //byte[] a = ms.ToArray();

                Bitmap newBitmap = new Bitmap(pic.Image);
                var    ms        = new MemoryStream();
                newBitmap.Save(ms, ImageFormat.Jpeg);
                byte[] photoAray = new byte[ms.Length];
                ms.Position = 0;
                ms.Read(photoAray, 0, photoAray.Length);
                ms.Close();
                mEmployees2["DocPic"] = photoAray;
                //---------------------
                mEmployees2.Update();
            }


            //------------

            if (SaveMsgDontShow)
            {
                btnNew_Click(null, null);
            }
            else if (
                MessageBox.Show("تم حفظ البيانات...هل تريد مستند جديد؟", "حفظ", MessageBoxButtons.YesNo,
                                MessageBoxIcon.Information) == DialogResult.Yes)
            {
                btnNew_Click(null, null);
            }
            else
            {
                Retrieve();
            }
            Tree1.FillTree();
        }
Пример #9
0
        private void FillManagements()
        {
            var v = new MATRIX("Managements");

            v.FillComboBox(cmbManagements);
        }
Пример #10
0
        private void FillDepts()
        {
            var v = new MATRIX("Depts");

            v.FillComboBox(cmbDepts);
        }
Пример #11
0
        private void FillJobs()
        {
            var v = new MATRIX("Jobs");

            v.FillComboBox(cmbJobs);
        }
Пример #12
0
        private void FillHealthOffices()
        {
            var v = new MATRIX("HealthOffices");

            v.FillComboBox(cmbHealthOfficecode);
        }
Пример #13
0
        private void FillReligion()
        {
            var v = new MATRIX("Religion");

            v.FillComboBox(cmbReligionCode);
        }
Пример #14
0
        private void FillCities()
        {
            var v = new MATRIX("Cities");

            v.FillComboBox(cmbCity);
        }
Пример #15
0
        void FillMachiens()
        {
            var m = new MATRIX("Machiens");

            m.FillComboBox(cmbMachines);
        }
Пример #16
0
        private void FillQualification()
        {
            var v = new MATRIX("Qualification");

            v.FillComboBox(cmbQualification);
        }
Пример #17
0
        private void FillHoliDaysType()
        {
            var v = new MATRIX("HoliDaysTypes");

            v.FillComboBox(cmbHoliDaysType);
        }