예제 #1
0
 private void btnEdit_Click(object sender, EventArgs e)
 {
     try
     {
         if (dgv_Reception["userid", dgv_Reception.CurrentRow.Index].Value.ToString() == SharedParam.CurrentUser.UserID)
         {
             if (dgv_Reception["status", dgv_Reception.CurrentRow.Index].Value.ToString() == "pending")
             {
                 if (!Db.HasRight(SharedParam.CurrentUser.RoleId, 2, 5, "Allow_Edit"))
                 {
                     string msg = "ليس لديك الصلاحية الكافية";
                     MessageBox.Show(msg, "تعديل بطاقة حضور", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1, MessageBoxOptions.RightAlign);
                 }
                 else
                 {
                     if (dgv_Reception["holder_class", dgv_Reception.CurrentRow.Index].Value.ToString() == SharedParam.SINGLE_HOLDER_CLASS &&
                         SharedParam.CurrentUser.HasSingleHolderClass)
                     {
                         frm_DlgReception frm = new frm_DlgReception(SharedParam.SINGLE_HOLDER_CLASS, "edit", dgv_Reception["Entry_doc_no", dgv_Reception.CurrentRow.Index].Value.ToString());
                         frm.ShowDialog();
                     }
                     else if (dgv_Reception["holder_class", dgv_Reception.CurrentRow.Index].Value.ToString() == SharedParam.EMPLOYEE_HOLDER_CLASS &&
                              SharedParam.CurrentUser.HasEmployeeHolderClass)
                     {
                         frm_DlgReception frm = new frm_DlgReception(SharedParam.EMPLOYEE_HOLDER_CLASS, "edit", dgv_Reception["Entry_doc_no", dgv_Reception.CurrentRow.Index].Value.ToString());
                         frm.ShowDialog();
                     }
                     else if (dgv_Reception["holder_class", dgv_Reception.CurrentRow.Index].Value.ToString() == SharedParam.COMPANY_HOLDER_CLASS &&
                              SharedParam.CurrentUser.HasCompanyHolderClass)
                     {
                     }
                     else if (dgv_Reception["holder_class", dgv_Reception.CurrentRow.Index].Value.ToString() == SharedParam.FOUNDER_HOLDER_CLASS &&
                              SharedParam.CurrentUser.HasFounderHolderClass)
                     {
                     }
                     else
                     {
                         string msg = "ليس لديك الصلاحية للتعامل مع بيانات المساهمين من فئة " + dgv_Reception["holder_class_name", dgv_Reception.CurrentRow.Index].Value.ToString();
                         MessageBox.Show(msg, "تعديل بطاقة حضور", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1, MessageBoxOptions.RightAlign);
                     }
                 }
             } // if status = pending
             else
             {
                 string msg = " لا يمكن تعديل بيانات بطاقة الحضور بعد اعتمادها ";
                 MessageBox.Show(msg, "تعديل بطاقة حضور", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1, MessageBoxOptions.RightAlign);
             }
         } // if the same user
         else
         {
             string msg = "بطاقة الحضور المختارة تم انشائها من قبل مستخدم آخر" + Environment.NewLine
                          + "المستخدم " + dgv_Reception["username", dgv_Reception.CurrentRow.Index].Value.ToString() + Environment.NewLine
                          + " هو المخول فقط بتعديل بيانات هذه البطاقة ";
             MessageBox.Show(msg, "تعديل بطاقة حضور", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1, MessageBoxOptions.RightAlign);
         }
     }
     catch
     { }
 }
예제 #2
0
 private void btn_Del_ReceptionEmployee_Click(object sender, EventArgs e)
 {
     if (SharedParam.CurrentUser.HasEmployeeHolderClass)
     {
         frm_DlgReception frm = new frm_DlgReception(SharedParam.EMPLOYEE_HOLDER_CLASS, "new", "0");
         frm.ShowDialog();
     }
 }