예제 #1
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (checkRequiredData())
            {
                DataTable dt = Db.GetDataAsDataTable("select TOP 1 * from v_Users where userid=@user and userpassword=@pass and status='active'"
                                                     , "user", "@user", txtOpId.Text, "@pass", Security.Cryptography.Encrypt(txtPassword.Text, true, SharedParam.USER_PASSWORD_KEY));
                if (dt != null)
                {
                    DataRow UserDataRow = dt.Rows[0];

                    ui = new SharedParam.UserInfo(UserDataRow["userid"].ToString()
                                                  , UserDataRow["username"].ToString()
                                                  , UserDataRow["role_id"].ToString()
                                                  , UserDataRow["rolename"].ToString()
                                                  , Boolean.Parse(UserDataRow["single_class"].ToString())
                                                  , Boolean.Parse(UserDataRow["employee_class"].ToString())
                                                  , Boolean.Parse(UserDataRow["company_class"].ToString())
                                                  , Boolean.Parse(UserDataRow["founder_class"].ToString()));
                    SharedParam.CurrentUser = ui;
                    Config.Load();

                    frm_Dashboard frm = new frm_Dashboard();
                    this.Hide();
                    frm.Show();
                }
                else
                {
                    Dialogs.Dg_Error frm = new Dialogs.Dg_Error("رمز المستخدم او كلمة المرور غير صحيح");
                    frm.ShowDialog();
                    txtOpId.Focus();
                }
            }
        }
예제 #2
0
        bool checkRequiredData()
        {
            if (string.IsNullOrEmpty(txtUserId.Text))
            {
                Dialogs.Dg_Error frm = new Dialogs.Dg_Error("يجب ادخال رمز المستخدم");
                frm.ShowDialog();
                txtUserId.Focus();
                return(false);
            }
            if (string.IsNullOrEmpty(txtUserName.Text))
            {
                Dialogs.Dg_Error frm = new Dialogs.Dg_Error("يجب ادخال اسم المستخدم");
                frm.ShowDialog();
                txtUserName.Focus();
                return(false);
            }
            if (string.IsNullOrEmpty(txtPassword.Text) && Operation_Type == "new")
            {
                Dialogs.Dg_Error frm = new Dialogs.Dg_Error("يجب ادخال كلمة المرور ");
                frm.ShowDialog();
                txtPassword.Focus();
                return(false);
            }
            if (coRole.SelectedValue.ToString() == "none")
            {
                Dialogs.Dg_Error frm = new Dialogs.Dg_Error("يجب تحديد المجموعة ");
                frm.ShowDialog();
                coRole.Focus();
                return(false);
            }

            return(true);
        }
예제 #3
0
 private void btn_Commit_Click(object sender, EventArgs e)
 {
     if (checkRequiredData())
     {
         if (Db.HasData("users", " WHERE userid='" + SharedParam.CurrentUser.UserID
                        + "' and userpassword='******'"))
         {
             string result = Db.ChangeUserPassword(SharedParam.CurrentUser.UserID,
                                                   Security.Cryptography.Encrypt(txtNewPass.Text, true, SharedParam.USER_PASSWORD_KEY));
             if (result == "success")
             {
                 Dialogs.Dg_Info frm = new Dialogs.Dg_Info("تم تغيير كلمة المرور بنجاح ");
                 frm.ShowDialog();
             }
             else if (result == "fail")
             {
                 Dialogs.Dg_Error frm = new Dialogs.Dg_Error("حدث خطأ عند محاولة تغيير كلمة المرور");
                 frm.ShowDialog();
             }
         }
         else
         {
             Dialogs.Dg_Error frm = new Dialogs.Dg_Error("كلمة المرور القديمة غير صحيحة");
             frm.ShowDialog();
         }
     }
 }
예제 #4
0
        bool checkRequiredData()
        {
            if (string.IsNullOrEmpty(txtOldPass.Text))
            {
                Dialogs.Dg_Error frm = new Dialogs.Dg_Error("يجب ادخال كلمة المرور القديمة");
                frm.ShowDialog();
                txtOldPass.Focus();
                return(false);
            }
            if (string.IsNullOrEmpty(txtNewPass.Text))
            {
                Dialogs.Dg_Error frm = new Dialogs.Dg_Error("يجب ادخال كلمة المرور الجديدة");
                frm.ShowDialog();
                txtNewPass.Focus();
                return(false);
            }
            if (!txtNewPass.Text.Equals(txtNewPass2.Text))
            {
                Dialogs.Dg_Error frm = new Dialogs.Dg_Error("يجب تطابق كلمة المرور الجديدة مع التاكيد");
                frm.ShowDialog();
                txtNewPass2.Focus();
                return(false);
            }


            return(true);
        }
예제 #5
0
 private void btn_Commit_Click(object sender, EventArgs e)
 {
     if (Operation_Type == "new")
     {
         if (checkRequiredData())
         {
             string result = Db.CreateUser(txtUserId.Text, Security.Cryptography.Encrypt(txtPassword.Text, true, SharedParam.USER_PASSWORD_KEY), txtUserName.Text, coRole.SelectedValue.ToString()
                                           , chSingle.Checked, chEmployee.Checked, chCompany.Checked, chFounder.Checked, SharedParam.CurrentUser.UserID);
             if (result == "success")
             {
                 Dialogs.Dg_Info frm = new Dialogs.Dg_Info("تم انشاء المستخدم بنجاح ");
                 frm.ShowDialog();
                 ClearData();
             }
             else if (result == "exists")
             {
                 Dialogs.Dg_Error frm = new Dialogs.Dg_Error("المستخدم تم انشائه مسبقاً");
                 frm.ShowDialog();
             }
             else if (result == "fail")
             {
                 Dialogs.Dg_Error frm = new Dialogs.Dg_Error("حدث خطأ عند محاولة انشاء المستخدم");
                 frm.ShowDialog();
             }
         }
     }
     if (Operation_Type == "edit")
     {
         if (checkRequiredData())
         {
             string result = Db.UpdateUser(CurrentUser, coStatus.SelectedValue.ToString(), coRole.SelectedValue.ToString()
                                           , chSingle.Checked, chEmployee.Checked, chCompany.Checked, chFounder.Checked);
             if (result == "success")
             {
                 Dialogs.Dg_Info frm = new Dialogs.Dg_Info("تم تعديل بيانات المستخدم بنجاح ");
                 frm.ShowDialog();
                 this.Close();
             }
             else if (result == "not_exists")
             {
                 Dialogs.Dg_Error frm = new Dialogs.Dg_Error("المستخدم غير موجود");
                 frm.ShowDialog();
                 this.Close();
             }
             else if (result == "fail" || result.Substring(0, 5) == "Error")
             {
                 Dialogs.Dg_Error frm = new Dialogs.Dg_Error("حدث خطأ عند محاولة تعديل بيانات المستخدم المستخدم" + Environment.NewLine + result);
                 frm.ShowDialog();
                 this.Close();
             }
         }
     }
 }
예제 #6
0
 private void btn_vote_reprint_Click(object sender, EventArgs e)
 {
     if (Db.HasRight(SharedParam.CurrentUser.RoleId, 5, 1, "ReprintVotePaper"))
     {
         frm_PrintVote frm = new frm_PrintVote("reprint", string.Empty, "vote");
         frm.ShowDialog();
     }
     else
     {
         Dialogs.Dg_Error frm = new Dialogs.Dg_Error("ليس لديك الصلاحية الكافية");
         frm.ShowDialog();
     }
 }
예제 #7
0
 private void mnuEdit_Click(object sender, EventArgs e)
 {
     if (Db.HasRight(SharedParam.CurrentUser.RoleId, 4, 2, "Allow_Candidate_Edit"))
     {
         frm_NewCandidate frm = new frm_NewCandidate("edit"
                                                     , "نظام ادارة اجتماع الجمعية العمومية ليمن موبايل -  تعديل بيانات المرشحين"
                                                     , dgv_Cand["cand_no", dgv_Cand.CurrentRow.Index].Value.ToString(), coClass.SelectedValue.ToString());
         frm.ShowDialog();
     }
     else
     {
         Dialogs.Dg_Error frm = new Dialogs.Dg_Error("ليس لديك الصلاحية الكافية");
         frm.ShowDialog();
     }
 }
예제 #8
0
 private void btn_can_edit_Click(object sender, EventArgs e)
 {
     if (Db.HasRight(SharedParam.CurrentUser.RoleId, 4, 2, "Allow_Candidate_Edit"))
     {
         frm_CandidateQuery frm = new frm_CandidateQuery(true);
         frm.ShowDialog();
     }
     else
     {
         Dialogs.Dg_Error frm = new Dialogs.Dg_Error("ليس لديك الصلاحية الكافية");
         frm.ShowDialog();
     }
     //frm_NewCandidate frm = new frm_NewCandidate("edit", "نظام ادارة اجتماع الجمعية العمومية ليمن موبايل -  تعديل بيانات المرشحين", "0");
     //frm.ShowDialog();
 }
예제 #9
0
 bool checkRequiredData()
 {
     if (string.IsNullOrEmpty(txtOpId.Text))
     {
         Dialogs.Dg_Error frm = new Dialogs.Dg_Error("يجب ادخال رمز المستخدم");
         frm.ShowDialog();
         txtOpId.Focus();
         return(false);
     }
     if (string.IsNullOrEmpty(txtPassword.Text))
     {
         Dialogs.Dg_Error frm = new Dialogs.Dg_Error("يجب ادخال كلمة المرور");
         frm.ShowDialog();
         txtPassword.Focus();
         return(false);
     }
     return(true);
 }
예제 #10
0
 private void txtEntryDocNo_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         if (_OpType == "first_print")
         {
             LoadData(txtEntryDocNo.Text);
         }
         else if (_OpType == "reprint")
         {
             if (Db.HasRight(SharedParam.CurrentUser.RoleId, 5, 1, "ReprintVotePaper"))
             {
                 LoadData(txtEntryDocNo.Text);
             }
             else
             {
                 Dialogs.Dg_Error frm = new Dialogs.Dg_Error("ليس لديك الصلاحية الكافية");
                 frm.ShowDialog();
             }
         }
     }
 }
예제 #11
0
 private void btn_Delete_Click(object sender, EventArgs e)
 {
     if (Db.HasRight(SharedParam.CurrentUser.RoleId, 4, 2, "Allow_Delete_Candidate"))
     {
         if (Operation_Type == "edit")
         {
             string Msg = "هل تريد بالتأكيد حذف البيانات؟" + Environment.NewLine + Environment.NewLine + "تنبيه : لايمكن  التراجع عن الحذف.";
             if (new Dialogs.Dg_ComfirmMessage("حذف", Msg).MessageResult() == DialogResult.Yes)
             {
                 string CurrentStatus = Db.GetFieldData("status"
                                                        , "select status from candidate where cand_no=@candno", "candno", string.IsNullOrEmpty(TargetCanNo) ? "0" : TargetCanNo);
                 if (!string.IsNullOrEmpty(CurrentStatus))
                 {
                     if (CurrentStatus == "request")
                     {
                         if (Db.ExecuteSQLCommand("DELETE FROM candidate where cand_no=" + TargetCanNo + " AND cand_class='" + TargetClass + "'"))
                         {
                             Dialogs.Dg_Info frm = new Dialogs.Dg_Info("تم الحذف بنجاح ");
                             frm.ShowDialog();
                             ClearAllData();
                         }
                     }
                     else
                     {
                         Dialogs.Dg_Error frm = new Dialogs.Dg_Error("لا يمكن حذف المرشح الحالي بسبب حالته ");
                         frm.ShowDialog();
                     }
                 }
             }
         }
     }
     else
     {
         Dialogs.Dg_Error frm = new Dialogs.Dg_Error("ليس لديك الصلاحية الكافية");
         frm.ShowDialog();
     }
 }
예제 #12
0
        private void btn_Print_Click(object sender, EventArgs e)
        {
            if (Db.GetPrinterName(Utility.GetMACAddress()) == "N/A")
            {
                MessageBox.Show("لم يتم تحديد الطابعة التي سيتم عبرها طباعة بطاقة الدخول", "خطأ"
                                , MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1,
                                MessageBoxOptions.RightAlign);
            }
            else
            {
                //var CandidateCount = Db.isHolderClassHasCandidates(EntryDocInfo.Rows[0]["DetailsClass"].ToString());
                //if (!CandidateCount)
                //{
                //    MessageBox.Show("لا يمكن طباعة ورقة الاقتراع لهذه لفئة  " + txtClassName.Text + Environment.NewLine  + " نظرا لعدم وجود مرشحين"
                //                             , "خطأ", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RightAlign);
                //    return;
                //}
                string Msg = string.Empty;
                if (_OpType == "first_print")
                {
                    Msg = "هل تريد بالتأكيد طباعة ورقة الاقتراع؟" + Environment.NewLine + Environment.NewLine + "تنبيه : لايمكن  التراجع بعد الحفظ.";
                }
                else if (_OpType == "reprint")
                {
                    if (_DocType == "vote")
                    {
                        Msg = "هل تريد بالتأكيد إعادة طباعة ورقة الاقتراع؟" + Environment.NewLine + Environment.NewLine + "تنبيه : لايمكن  التراجع بعد الحفظ.";
                    }
                    else if (_DocType == "entry")
                    {
                        Msg = "هل تريد بالتأكيد إعادة طباعة بطاقة الحضور؟" + Environment.NewLine + Environment.NewLine + "تنبيه : لايمكن  التراجع بعد الحفظ.";
                    }
                }
                if (new Dialogs.Dg_ComfirmMessage("طباعة ورقة اقتراع", Msg).MessageResult() == DialogResult.Yes)
                {
                    #region Confirm to print ...
                    if ((_DocType == "vote") &&
                        (Db.PrintedTimes(int.Parse(EntryDocInfo.Rows[0]["Entry_doc_no"].ToString()), "entry") == 0))
                    {
                        MessageBox.Show("لم يتم طباعة بطاقة الدخول بعد" + Environment.NewLine + Environment.NewLine + " يجب اولا طباعة بطاقة الدخول (الحضور) ثم طباعة ورقة الاقتراع"
                                        , "خطأ", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RightAlign);
                    }
                    else
                    {
                        if (_OpType == "first_print")
                        {
                            if (Db.PrintedTimes(int.Parse(EntryDocInfo.Rows[0]["Entry_doc_no"].ToString()), _DocType) < Config.MaxVotePaperPrintTimes)
                            {
                                if (DataLoaded)
                                {
                                    string result = Db.CreatePrint(int.Parse(EntryDocInfo.Rows[0]["Entry_doc_no"].ToString())
                                                                   , _DocType, "first_print", SharedParam.CurrentUser.UserID, "other", string.Empty);
                                    if (result == "success")
                                    {
                                        PrintToPrinter(EntryDocInfo.Rows[0]["Entry_doc_no"].ToString()
                                                       , EntryDocInfo.Rows[0]["DetailsClass"].ToString()
                                                       , EntryDocInfo.Rows[0]["TotalShareQty"].ToString()
                                                       , EntryDocInfo.Rows[0]["DetailsClassName"].ToString());
                                        Dialogs.Dg_Info frm = new Dialogs.Dg_Info("تمت عملية الطباعة بنجاح ");
                                        frm.ShowDialog();
                                        ClearData();
                                    }
                                    else
                                    {
                                        MessageBox.Show("فشلت عملية الطباعة");
                                    }
                                }
                                else
                                {
                                    MessageBox.Show("لا توجد بيانات");
                                }
                            }
                            else
                            {
                                MessageBox.Show("عدد مرات طباعة ورقة الاقتراع تجاوز الحد الاقصى المسموح به");
                            }
                        }
                        else if (_OpType == "reprint")
                        {
                            if (_DocType == "vote")
                            {
                                if (!Db.HasRight(SharedParam.CurrentUser.RoleId, 5, 1, "ReprintVotePaper"))
                                {
                                    MessageBox.Show("ليس لديك الصلاحية الكافية");
                                    return;
                                }
                            }
                            else if (_DocType == "entry")
                            {
                                if (!Db.HasRight(SharedParam.CurrentUser.RoleId, 1, 3, "ReprintEntryDoc"))
                                {
                                    MessageBox.Show("ليس لديك الصلاحية الكافية");
                                    return;
                                }
                            }

                            bool PrintTimesExceeded = false;
                            int  PrintedTimes       = Db.PrintedTimes(int.Parse(EntryDocInfo.Rows[0]["Entry_doc_no"].ToString()), _DocType);
                            PrintTimesExceeded = PrintedTimes >= (_DocType == "vote" ? Config.MaxVotePaperPrintTimes : Config.MaxEntryDocPrintTimes);
                            if (!PrintTimesExceeded)
                            {
                                if (coreason.SelectedValue.ToString() == "other")
                                {
                                    if (string.IsNullOrEmpty(txtReason.Text))
                                    {
                                        Dialogs.Dg_Error frm = new Dialogs.Dg_Error("يجب ادخال السبب");
                                        frm.ShowDialog();
                                        return;
                                    }
                                }
                                if (DataLoaded)
                                {
                                    string result = string.Empty;
                                    if (PrintedTimes == 0)
                                    {
                                        result = Db.CreatePrint(int.Parse(EntryDocInfo.Rows[0]["Entry_doc_no"].ToString())
                                                                , _DocType, "first_print", SharedParam.CurrentUser.UserID
                                                                , "other"
                                                                , txtReason.Text);
                                    }
                                    else
                                    {
                                        result = Db.CreatePrint(int.Parse(EntryDocInfo.Rows[0]["Entry_doc_no"].ToString())
                                                                , _DocType, "reprint", SharedParam.CurrentUser.UserID, coreason.SelectedValue.ToString()
                                                                , txtReason.Text);
                                    }
                                    if (result == "success")
                                    {
                                        PrintToPrinter(EntryDocInfo.Rows[0]["Entry_doc_no"].ToString()
                                                       , EntryDocInfo.Rows[0]["DetailsClass"].ToString()
                                                       , EntryDocInfo.Rows[0]["TotalShareQty"].ToString()
                                                       , EntryDocInfo.Rows[0]["DetailsClassName"].ToString());
                                        Dialogs.Dg_Info frm = new Dialogs.Dg_Info("تمت عملية إعادة الطباعة بنجاح ");
                                        frm.ShowDialog();
                                        ClearData();
                                        if (!string.IsNullOrEmpty(_EntryDocNo))
                                        {
                                            this.Close();
                                        }
                                    }
                                    else
                                    {
                                        MessageBox.Show("فشلت عملية إعادة الطباعة");
                                    }
                                }
                                else
                                {
                                    MessageBox.Show("لا توجد بيانات");
                                }
                            }
                            else
                            {
                                MessageBox.Show("عدد مرات الطباعة تجاوز الحد الاقصى المسموح به");
                            }
                        }
                    }
                    #endregion
                }
            } // Check Printer ...
        }
예제 #13
0
        bool CheckRequiredFields()
        {
            if (string.IsNullOrEmpty(txtfullname.Text))
            {
                Dialogs.Dg_Error frm = new Dialogs.Dg_Error("يجب ادخال اسم المرشح كاملا");
                frm.ShowDialog();
                txtfullname.Focus();
                return(false);
            }
            if (!Utility.IsValidDate(txtDOB.Text))
            {
                Dialogs.Dg_Error frm = new Dialogs.Dg_Error("تاريخ الميلاد خاطئ!");
                frm.ShowDialog();
                txtDOB.Focus();
                return(false);
            }
            if (string.IsNullOrEmpty(txtBirthPlace.Text))
            {
                Dialogs.Dg_Error frm = new Dialogs.Dg_Error("يجب تحديد مكان الميلاد و عدم تركه فارغاً");
                frm.ShowDialog();
                txtBirthPlace.Focus();
                return(false);
            }
            if (string.IsNullOrEmpty(txtAddress.Text))
            {
                Dialogs.Dg_Error frm = new Dialogs.Dg_Error("يجب ادخال محل الاقامة الحالية");
                frm.ShowDialog();
                txtAddress.Focus();
                return(false);
            }
            if (string.IsNullOrEmpty(txtIdNo.Text))
            {
                Dialogs.Dg_Error frm = new Dialogs.Dg_Error("يجب ادخال محل الاقامة الحالية");
                frm.ShowDialog();
                txtAddress.Focus();
                return(false);
            }
            if (string.IsNullOrEmpty(txtIdPlace.Text))
            {
                Dialogs.Dg_Error frm = new Dialogs.Dg_Error("يجب ادخال محل الاقامة الحالية");
                frm.ShowDialog();
                txtAddress.Focus();
                return(false);
            }
            if (!Utility.IsValidDate(txtIdDate.Text))
            {
                Dialogs.Dg_Error frm = new Dialogs.Dg_Error("تاريخ اصدار الهوية غير صحيح!");
                frm.ShowDialog();
                txtIdDate.Focus();
                return(false);
            }
            if (string.IsNullOrEmpty(txtIdPlace.Text))
            {
                Dialogs.Dg_Error frm = new Dialogs.Dg_Error("يجب ادخال مكان اصدار الهوية");
                frm.ShowDialog();
                txtIdPlace.Focus();
                return(false);
            }
            if (string.IsNullOrEmpty(txtJobOrg.Text))
            {
                Dialogs.Dg_Error frm = new Dialogs.Dg_Error("يجب ادخال محل جهة العمل");
                frm.ShowDialog();
                txtJobOrg.Focus();
                return(false);
            }
            if (string.IsNullOrEmpty(txtJob.Text))
            {
                Dialogs.Dg_Error frm = new Dialogs.Dg_Error("يجب ادخال بيانات الوظيفة");
                frm.ShowDialog();
                txtJob.Focus();
                return(false);
            }
            if (string.IsNullOrEmpty(txtMobileNo.Text))
            {
                Dialogs.Dg_Error frm = new Dialogs.Dg_Error("يجب ادخال رقم الموبايل");
                frm.ShowDialog();
                txtMobileNo.Focus();
                return(false);
            }
            if (coClass.SelectedValue.ToString() == SharedParam.COMPANY_HOLDER_CLASS)
            {
                if (string.IsNullOrEmpty(txtLegalName.Text))
                {
                    Dialogs.Dg_Error frm = new Dialogs.Dg_Error("يجب ادخال الاسم الاعتباري");
                    frm.ShowDialog();
                    txtLegalName.Focus();
                    return(false);
                }
                if (string.IsNullOrEmpty(txtMainActivity.Text))
                {
                    Dialogs.Dg_Error frm = new Dialogs.Dg_Error("يجب ادخال النشاط الرئيسي");
                    frm.ShowDialog();
                    txtMainActivity.Focus();
                    return(false);
                }
                if (string.IsNullOrEmpty(txtLegalForm.Text))
                {
                    Dialogs.Dg_Error frm = new Dialogs.Dg_Error("يجب ادخال الشكل القانوني");
                    frm.ShowDialog();
                    txtLegalForm.Focus();
                    return(false);
                }
                if (string.IsNullOrEmpty(txtLicenceNo.Text))
                {
                    Dialogs.Dg_Error frm = new Dialogs.Dg_Error("يجب ادخال رقم السجل التجاري");
                    frm.ShowDialog();
                    txtLicenceNo.Focus();
                    return(false);
                }
                if (string.IsNullOrEmpty(txtLicencePlace.Text))
                {
                    Dialogs.Dg_Error frm = new Dialogs.Dg_Error("يجب ادخال مكان اصدر السجل التجاري");
                    frm.ShowDialog();
                    txtLicencePlace.Focus();
                    return(false);
                }
                if (!Utility.IsValidDate(txtLicenceDate.Text))
                {
                    Dialogs.Dg_Error frm = new Dialogs.Dg_Error("تاريخ اصدار السجل التجاري غير صحيح!");
                    frm.ShowDialog();
                    txtLicenceDate.Focus();
                    return(false);
                }
            }
            for (int i = 0; i < dgv_LastJobs.Rows.Count; ++i)
            {
                if (!object.ReferenceEquals(dgv_LastJobs["job", i].Value, null) && !string.IsNullOrEmpty(dgv_LastJobs["job", i].Value.ToString()))
                {
                    if (!Utility.IsValidDate(dgv_LastJobs["startdate", i].Value.ToString())
                        ||
                        !Utility.IsValidDate(dgv_LastJobs["enddate", i].Value.ToString()))
                    {
                        Dialogs.Dg_Error frm = new Dialogs.Dg_Error("تاريخ بداية او نهاية الوظائف التي شغلها"
                                                                    + Environment.NewLine + "المرشح خلال الثلاث السنوات الاخيرة خاطئ "
                                                                    + Environment.NewLine + "يرجى مراجعة التاريخ  والمحاولة لاحقا ");
                        frm.ShowDialog();
                        txtLicenceDate.Focus();
                        return(false);
                    }
                }
            }


            if (!HasShares())
            {
                Dialogs.Dg_Error frm = new Dialogs.Dg_Error("المرشح لا يمتلك شهادات ملكية اسهم");
                frm.ShowDialog();
                dgv_Certs.Focus();
                return(false);
            }
            return(true);
        }
예제 #14
0
        void LoadCandidateData(string candidateno, string CandClass)
        {
            try {
                string    strsql    = "select TOP 1 * from candidate where cand_no=@candno and cand_class=@candclass";
                DataTable CandTable = Db.GetDataAsDataTable(strsql, "candidate", "candno", candidateno, "candclass", CandClass);
                if (CandTable != null)
                {
                    coClass.SelectedValue  = CandTable.Rows[0]["cand_class"];
                    txtCandNo.Text         = CandTable.Rows[0]["cand_no"].ToString();
                    txtfullname.Text       = CandTable.Rows[0]["cand_name"].ToString();
                    txtDOB.Text            = DBNull.Value.Equals(CandTable.Rows[0]["DOB"]) ? string.Empty : DateTime.Parse(CandTable.Rows[0]["DOB"].ToString()).ToString("dd/MM/yyyy");
                    txtBirthPlace.Text     = CandTable.Rows[0]["birth_place"].ToString();
                    txtAddress.Text        = CandTable.Rows[0]["address"].ToString();
                    coIdType.SelectedValue = CandTable.Rows[0]["id_type"];
                    txtIdNo.Text           = CandTable.Rows[0]["id_no"].ToString();
                    txtIdDate.Text         = DBNull.Value.Equals(CandTable.Rows[0]["id_date"]) ? string.Empty : DateTime.Parse(CandTable.Rows[0]["id_date"].ToString()).ToString("dd/MM/yyyy");
                    txtIdPlace.Text        = CandTable.Rows[0]["id_place"].ToString();
                    txtJobOrg.Text         = CandTable.Rows[0]["work_org"].ToString();
                    txtJob.Text            = CandTable.Rows[0]["job"].ToString();
                    txtMobileNo.Text       = CandTable.Rows[0]["mobile_no"].ToString();
                    txtHomeTel.Text        = CandTable.Rows[0]["home_tel"].ToString();
                    txtWorkTel.Text        = CandTable.Rows[0]["work_tel"].ToString();
                    txtFax.Text            = CandTable.Rows[0]["fax"].ToString();
                    txtEmail.Text          = CandTable.Rows[0]["email"].ToString();
                    txtWebsite.Text        = CandTable.Rows[0]["website"].ToString();
                    txtLegalName.Text      = CandTable.Rows[0]["legal_name"].ToString();
                    txtMainActivity.Text   = CandTable.Rows[0]["main_activity"].ToString();
                    txtLegalForm.Text      = CandTable.Rows[0]["legal_form"].ToString();
                    txtLicenceNo.Text      = CandTable.Rows[0]["licence_no"].ToString();
                    txtLicenceDate.Text    = DBNull.Value.Equals(CandTable.Rows[0]["licence_date"]) ? string.Empty : DateTime.Parse(CandTable.Rows[0]["licence_date"].ToString()).ToString("dd/MM/yyyy");
                    txtLicencePlace.Text   = CandTable.Rows[0]["licence_place"].ToString();
                    txtcompanyaddress.Text = CandTable.Rows[0]["company_address"].ToString();
                    lblPicFileName.Text    = CandTable.Rows[0]["cand_pic_name"].ToString();
                    // begin load image ...
                    if (!CandTable.Rows[0]["cand_pic"].Equals(DBNull.Value))
                    {
                        try {
                            MemoryStream stream = new MemoryStream();
                            byte[]       image  = (byte[])CandTable.Rows[0]["cand_pic"];
                            stream.Write(image, 0, image.Length);
                            Bitmap bitmap = new Bitmap(stream);
                            cand_pic.Image    = bitmap;
                            cand_pic.SizeMode = PictureBoxSizeMode.StretchImage;
                            cand_pic.Refresh();
                        }
                        catch (Exception ex)
                        {
                            //MessageBox.Show(ex.GetType().Name);
                        }
                    }
                    // end load image ...
                    strsql = "SELECT cert_no certno,share_qty shareqty,holder_name holdername "
                             + "   ,dbo.GetClassName(class_id)  classname,class_id classid "
                             + "   FROM dbo.candidate_certs where cand_no=@candno  and cand_class=@candclass";
                    dt_CandCerts = Db.GetDataAsDataTable(strsql, "candidatecerts", "candno", candidateno, "candclass", CandClass);
                    if (dt_CandCerts != null)
                    {
                        dgv_Certs.DataSource = dt_CandCerts;
                    }

                    strsql = "SELECT qualification qual FROM candidate_qualification where cand_no=@candno and cand_class=@candclass order by line_no";
                    dt_CandQualifications = Db.GetDataAsDataTable(strsql, "candidatequal", "candno", candidateno, "candclass", CandClass);
                    if (dt_CandQualifications != null)
                    {
                        dgv_Qual.DataSource = dt_CandQualifications;
                    }

                    strsql            = "SELECT experience exp FROM candidate_experience where cand_no=@candno and cand_class=@candclass order by line_no";
                    dt_CandExperience = Db.GetDataAsDataTable(strsql, "candidateexp", "candno", candidateno, "candclass", CandClass);
                    if (dt_CandExperience != null)
                    {
                        dgv_Exp.DataSource = dt_CandExperience;
                    }
                    strsql          = "SELECT job,start_date startdate,end_date enddate,org_name orgname FROM candidate_lastjobs where cand_no=@candno  and cand_class=@candclass order by line_no";
                    dt_CandLastJobs = Db.GetDataAsDataTable(strsql, "candidatelast", "candno", candidateno, "candclass", CandClass);
                    if (dt_CandLastJobs != null)
                    {
                        dgv_LastJobs.DataSource = dt_CandLastJobs;
                    }
                }
                else
                {
                    Dialogs.Dg_Error frm = new Dialogs.Dg_Error("لا يوجد مرشح بهذا الرقم ، يرجى التأكد و المحاولة لاحقا");
                    frm.ShowDialog();
                    txtCandNo.Focus();
                }
            }catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }