Ejemplo n.º 1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            string FileSelected = DocSelectedAbsulutePath.ToLower();

            if (!FileSelected.EndsWith(".pdf"))
            {
                string message, caption;
                string language = ChangeLanguage.ReadConfigValue("language");
                if (language == "he-IL")
                {
                    message = "לא נבחר טופס להחתמה";
                    caption = "מסמכים";
                }
                else
                {
                    message = "No document selected for signature";
                    caption = "Documents";
                }
                MessageBox.Show(message, caption, MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }

            else
            {
                this.Close();
            }
        }
Ejemplo n.º 2
0
        private bool Validation(TextBox t)
        {
            int  n;
            bool error = false;

            if (int.TryParse(t.Text, out n))
            {
                error = true;
                string message, caption;
                string language = ChangeLanguage.ReadConfigValue("language");
                if (language == "he-IL")
                {
                    message = "תו לא חוקי";
                    caption = "שגיאה";
                }
                else
                {
                    message = "Invalid character";
                    caption = "Error";
                }
                MessageBox.Show(message, caption, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }


            return(error);
        }
Ejemplo n.º 3
0
        private void אנגליתToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var ChangeLanguage = new ChangeLanguage();

            ChangeLanguage.UpdateConfig("language", "en-US");

            Application.Restart();
        }
Ejemplo n.º 4
0
        private void BtnSave_Click(object sender, EventArgs e)
        {
            var gtype = comboBoxGroupType.Text;
            var gname = textBox_GroupName.Text;
            var gdesc = textBox_Description.Text;

            Group grp = new Group(gtype, gname, gdesc);

            grp.GType = gtype;
            grp.GName = gname;
            grp.GDesc = gdesc;

            if (bEdit)
            {
                var myItem = DBUtility.GetGroups().Find(item => item.GName == gname);
                if (myItem == null && gname != "")
                {
                    DBUtility.AddGroup(grp);
                    GetGroups();
                }
                else
                {
                    string message, caption;
                    string language = ChangeLanguage.ReadConfigValue("language");
                    if (language == "he-IL")
                    {
                        message = "שם הקבוצה קיים במערכת";
                        caption = "שגיאה";
                    }
                    else
                    {
                        message = "Department name allready exsits in the system";
                        caption = "Error";
                    }
                    MessageBox.Show(message, caption, MessageBoxButtons.OK, MessageBoxIcon.Error);

                    return;
                }
            }
            else
            {
                DBUtility.EditGroup(grp);
            }
            textBox_GroupName.Text   = "";
            textBox_Description.Text = "";
            comboBoxGroupType.Text   = "";
            //instance event args and value has been passed
            var args = new GroupIdentityEventArgs(gtype, gname, gdesc);

            //Event has be raised with update arguments of delegate
            GroupIdentityUpdated?.Invoke(this, args);

            this.Hide();
        }
Ejemplo n.º 5
0
        private void BtnSave_Click(object sender, EventArgs e)
        {
            var employeeNum = txtEmpNum.Text;
            var id          = txtIdNo.Text;
            var name        = txtFullName.Text;
            var mobile      = txtMobile.Text;
            var email       = txtEmail.Text;
            var department  = comboBoxDepartment.Text;

            Employee emp = new Employee(employeeNum, id, name, mobile, email, department);

            if (!bEdit)
            {
                var myItem = DBUtility.GetEmployees().Find(item => item.EmployeeNum == employeeNum);
                if (myItem == null)
                {
                    DBUtility.AddEmployee(emp);
                }
                else
                {
                    string message, caption;
                    string language = ChangeLanguage.ReadConfigValue("language");
                    if (language == "he-IL")
                    {
                        message = "עובד עם מספר זהה קיים במערכת";
                        caption = "שגיאה";
                    }
                    else
                    {
                        message = "Employee with this ID allready exsits in data base";
                        caption = "Error";
                    }
                    MessageBox.Show(message, caption, MessageBoxButtons.OK, MessageBoxIcon.Error);

                    return;
                }
            }
            else
            {
                DBUtility.EditEmployee(emp);
            }

            //instance event args and value has been passed
            var args = new IdentityEventArgs(employeeNum, id, name, mobile, email, department);

            //Event has be raised with update arguments of delegate
            IdentityUpdated?.Invoke(this, args);

            this.Hide();
        }
Ejemplo n.º 6
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            if (dataGridView.SelectedRows.Count > 0)
            {
                try
                {
                    var row   = dataGridView.CurrentCell.RowIndex;
                    var gtype = Convert.ToString(dataGridView.Rows[row].Cells[0].Value);
                    var gname = Convert.ToString(dataGridView.Rows[row].Cells[1].Value);
                    var gdesc = Convert.ToString(dataGridView.Rows[row].Cells[2].Value);

                    _row = row;

                    var addGrp = new AddGroup();

                    addGrp.LoadData(gtype, gname, gdesc);
                    addGrp.GroupIdentityUpdated += this.UpdateRecord;
                    addGrp.btnEdit.Visible       = false;
                    addGrp.btnAdd.Visible        = false;
                    addGrp.dataGridView.Hide();
                    addGrp.Size             = new Size(addGrp.Size.Width, 270);
                    addGrp.btn_Save.Visible = true;



                    addGrp.ShowDialog();
                }
                catch (Exception exception)
                {
                    MessageBox.Show(exception.Message, "Error !", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Log.Write2Log(exception.Message.ToString());
                }
            }
            else
            {
                string message, caption;
                string language = ChangeLanguage.ReadConfigValue("language");
                if (language == "he-IL")
                {
                    message = "אנא בחר/י רשומה מהטבלה לעריכה";
                    caption = "קבוצה";
                }
                else
                {
                    message = "Please select a record for editing";
                    caption = "Department";
                }
                MessageBox.Show(message, caption, MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Ejemplo n.º 7
0
        public void ExportEmployeeListToCSV(List <ShortEmps> mylist)
        {
            var csv = new System.Text.StringBuilder();

            try
            {
                int LastID = DBUtility.GetLastEventID();

                foreach (ShortEmps employeeList in mylist)
                {
                    LastID = LastID + 1;
                    var newLine = string.Format("{0},{1},{2},{3},{4},{5},{6}", employeeList.EmployeeNum, employeeList.Id, employeeList.FullName,
                                                employeeList.Mobile, employeeList.Email, employeeList.DocSelected, LastID);
                    csv.AppendLine(newLine);
                }

                string FileName, OutPath;
                string CurDateTime = DateTime.Now.ToString(@"dd\_MM\_yyyy hh\_mm ");
                OutPath = GetWinsertCollectorDir();
                if (!string.IsNullOrEmpty(OutPath))
                {
                    FileName = OutPath + @"\EmployeeList_" + CurDateTime + ".csv";

                    using (StreamWriter sw = new StreamWriter(FileName, false, System.Text.Encoding.Unicode))  //(File.Exists(OutPath)) ? File.AppendText(OutPath) : File.CreateText(OutPath))
                    {
                        sw.Write(csv.ToString());
                        UpdateDBLog(mylist);
                        string language = ChangeLanguage.ReadConfigValue("language");
                        string message, caption;
                        if (language == "he-IL")
                        {
                            message = "נתונים יוצאו בהצלחה";
                            caption = "הפצת  מסמכים לחתימה";
                        }
                        else
                        {
                            message = "Data successfully exported";
                            caption = "Distribute documents for signature";
                        }
                        MessageBox.Show(message, caption, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message, "Error !", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 8
0
        public void ListFilestoCombo()
        {
            // Select Form file

            if (!IsDirectoryEmpty(dir))
            {
                string[] files    = Directory.GetFiles(dir, "*.pdf", SearchOption.TopDirectoryOnly);
                string   selected = "";
                if (comboDocSelect.Items.Count == 0)
                {
                    foreach (string filePath in files)
                    {
                        comboDocSelect.Items.Add(Path.GetFileName(filePath));
                    }
                }
                selected = this.comboDocSelect.GetItemText(this.comboDocSelect.SelectedItem);

                DocSelectedAbsulutePath = dir + selected;
                CreateFileLink(DocSelectedAbsulutePath);
            }
            else
            {
                string message, caption;
                string language = ChangeLanguage.ReadConfigValue("language");
                if (language == "he-IL")
                {
                    message = "תיקיית מסמכים שלך ריקה";
                    caption = "מסמכים";
                }
                else
                {
                    message = "Documents folder is empty";
                    caption = "Documents";
                }
                MessageBox.Show(message, caption, MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }