///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// protected void btnUpdate_Click(object sender, EventArgs e) { try { if (!Page.IsValid) { ValidatorCollection ValidatorColl = Page.Validators; for (int k = 0; k < ValidatorColl.Count; k++) { if (!ValidatorColl[k].IsValid && !String.IsNullOrEmpty(ValidatorColl[k].ErrorMessage)) { vsSave.ShowSummary = true; return; } vsSave.ShowSummary = false; } return; } AppPro.UsrLoginID = FormSession.LoginUsr; AppPro.UsrPassword = CryptorEngine.Encrypt(txtNewpassword.Text, true); AppPro.TransactionBy = FormSession.LoginUsr; AppSql.UpdatePassword(AppPro); ClearUI(); MessageFun.ShowMsg(this, MessageFun.TypeMsg.Success, General.Msg("Password updated successfully", "تم تعديل كلمة المرور بنجاح")); } catch (Exception Ex) { DBFun.InsertError(FormSession.PageName, "btnSave"); MessageFun.ShowAdminMsg(this, Ex.Message); } }
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// protected void btnSave_Click(object sender, EventArgs e) { System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US"); if (!Page.IsValid) { ValidatorCollection ValidatorColl = Page.Validators; for (int k = 0; k < ValidatorColl.Count; k++) { if (!ValidatorColl[k].IsValid && !String.IsNullOrEmpty(ValidatorColl[k].ErrorMessage)) { vsSave.ShowSummary = true; return; } vsSave.ShowSummary = false; } return; } try { FillPropeties(); SqlClass.InsertUpdate(ProClass); MessageFun.ShowMsg(this, MessageFun.TypeMsg.Success, General.Msg("institution Setting saved successfully", "تم حفظ إعدادات المنشأة")); ClearUI(); } catch (Exception Ex) { DBFun.InsertError(FormSession.PageName, "btnSave"); MessageFun.ShowAdminMsg(this, Ex.Message); } }
/*******************************************************************************************************************************/ /*******************************************************************************************************************************/ ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /*******************************************************************************************************************************/ /*******************************************************************************************************************************/ #region ButtonAction Events protected void btnSave_Click(object sender, EventArgs e) { try { if (!Page.IsValid) { ValidatorCollection ValidatorColl = Page.Validators; for (int k = 0; k < ValidatorColl.Count; k++) { if (!ValidatorColl[k].IsValid && !String.IsNullOrEmpty(ValidatorColl[k].ErrorMessage)) { vsSave.ShowSummary = true; return; } vsSave.ShowSummary = false; } return; } string Action = ViewState["CommandName"].ToString(); FillPropeties(); SqlCs.InsertUpdate(ProCs); ClearItem(); PopulateUI(); ViewState["CommandName"] = "NOT"; MessageFun.ShowMsg(this, MessageFun.TypeMsg.Success, General.Msg("Save Data successfully", "تم الحفظ البيانات بنجاح")); } catch (Exception Ex) { DBFun.InsertError(FormSession.PageName, "btnSave"); MessageFun.ShowAdminMsg(this, Ex.Message); } }
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public void PopulateUI(string pID) { try { if ((btnSave.Text == "Update") || (btnSave.Text == "تعديل")) { DataTable myTableDT = DBFun.FetchData("SELECT * FROM EmployeeMaster WHERE EmpID = '" + pID + "' AND EmpType = '" + ddlEmpType.SelectedValue + "' "); if (DBFun.IsNullOrEmpty(myTableDT)) { ButtonAction("00", true); MessageFun.ShowMsg(this, vsSearch, cvShowMsg, MessageFun.TypeMsg.Warning, "vgSearch", General.Msg("This employee No part of " + GetNameType(Request.QueryString["ac"].ToString()), "الموظف غير موجود ضمن " + GetNameType(Request.QueryString["ac"].ToString()))); return; } FillFromDT(myTableDT); } txtEmpIdentity.Text = txtIDSearch.Text; ButtonAction("11", false); DataItemEnabled(true); } catch (Exception Ex) { DBFun.InsertError(FormSession.PageName, "PopulateUI"); MessageFun.ShowAdminMsg(this, Ex.Message); } }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// protected void btnSave_Click(object sender, EventArgs e) { try { if (!Page.IsValid) { ValidatorCollection ValidatorColl = Page.Validators; for (int k = 0; k < ValidatorColl.Count; k++) { if (!ValidatorColl[k].IsValid && !String.IsNullOrEmpty(ValidatorColl[k].ErrorMessage)) { vsSave.ShowSummary = true; return; } vsSave.ShowSummary = false; } return; } ProClass.UsrLoginID = FormSession.LoginID; ProClass.UsrPassword = txtNewPass.Text; SqlClass.UpdatePassword(ProClass); ClearUI(); MessageFun.ShowMsg(this, MessageFun.TypeMsg.Success, General.Msg("Password updated successfully", "تم تعديل كلمة المرور بنجاح")); } catch (Exception Ex) { MessageFun.ShowAdminMsg(this, Ex.Message); } }
/*##############################################################################################################################*/ /*##############################################################################################################################*/ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /*##############################################################################################################################*/ /*##############################################################################################################################*/ #region ButtonAction Events protected void btnSave_Click(object sender, EventArgs e) { if (!Page.IsValid) { ValidatorCollection ValidatorColl = Page.Validators; for (int k = 0; k < ValidatorColl.Count; k++) { if (!ValidatorColl[k].IsValid && !String.IsNullOrEmpty(ValidatorColl[k].ErrorMessage)) { vsSave.ShowSummary = true; return; } vsSave.ShowSummary = false; } return; } try { FillPropeties(); if (ViewState["CommandName"].ToString() == "Add") { SqlClass.Insert(ProClass); MessageFun.ShowMsg(this, MessageFun.TypeMsg.Success, General.Msg("Employee added successfully", "تمت إضافة الموظف بنجاح")); } if (ViewState["CommandName"].ToString() == "Edit") { SqlClass.Update(ProClass); MessageFun.ShowMsg(this, MessageFun.TypeMsg.Success, General.Msg("Employee updated successfully", "تم تعديل الموظف بنجاح")); } ClearItem(); Search(); } catch (Exception Ex) { MessageFun.ShowAdminMsg(this, Ex.Message); } }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// protected void btnDelete_Click(object sender, EventArgs e) { if (txtUsrLoginID.Text == "admin") { MessageFun.ShowMsg(this, MessageFun.TypeMsg.Error, General.Msg("You can not delete a User : system administrator", "لا يمكن حذف المستخدم : مدير النظام")); return; } if (txtUsrLoginID.Text == FormSession.LoginID) { MessageFun.ShowMsg(this, MessageFun.TypeMsg.Error, General.Msg("You can not delete the current user of the system", "لا يمكن حذف المستخدم الحالي للنظام")); return; } string Q = " SELECT LogTransactionBy FROM TransactionLog WHERE LogTransactionBy = '" + txtUsrLoginID.Text + "' "; dt = DBFun.FetchData(Q); if (!DBFun.IsNullOrEmpty(dt)) { MessageFun.ShowMsg(this, MessageFun.TypeMsg.Error, General.Msg("Deletion can not because of the presence of related records", "لا يمكن الحذف بسبب وجود سجلات مرتبطة")); } else { FillPropeties(); SqlClass.Delete(ProClass); MessageFun.ShowMsg(this, MessageFun.TypeMsg.Success, General.Msg("User deleted successfully", "تم حذف المستخدم بنجاح")); ClearItem(); Search(); } }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// protected void btnSave_Click(object sender, EventArgs e) { if (!Page.IsValid) { ValidatorCollection ValidatorColl = Page.Validators; for (int k = 0; k < ValidatorColl.Count; k++) { if (!ValidatorColl[k].IsValid && !String.IsNullOrEmpty(ValidatorColl[k].ErrorMessage)) { vsSave.ShowSummary = true; return; } vsSave.ShowSummary = false; } return; } try { FillPropeties(); if (ViewState["CommandName"].ToString() == "Save") { SqlCs.Insert(ProCs); MessageFun.ShowMsg(this, MessageFun.TypeMsg.Success, General.Msg("Save Data successfully", "تم الحفظ بنجاح")); } if (ViewState["CommandName"].ToString() == "Update") { SqlCs.Update(ProCs); MessageFun.ShowMsg(this, MessageFun.TypeMsg.Success, General.Msg("Save Data successfully", "تم الحفظ بنجاح")); } if (ViewState["CommandName"].ToString() == "Delete") { //string Q = " SELECT NatID FROM EmployeeMaster WHERE NatID = " + ddlPkID.SelectedValue + " " // + " UNION " // + " SELECT NatID FROM BlackList WHERE NatID = " + ddlPkID.SelectedValue + " "; //dt = DBFun.FetchData(Q); //if (!DBFun.IsNullOrEmpty(dt)) //{ // MessageFun.ShowMsg(this, MessageFun.TypeMsg.Error, General.Msg("Deletion can not because of the presence of related records", "لا يمكن الحذف بسبب وجود سجلات مرتبطة")); //} //else //{ SqlCs.Delete(ProCs); MessageFun.ShowMsg(this, MessageFun.TypeMsg.Success, General.Msg("deleted Data successfully", "تم الحذف بنجاح")); //} } } catch (Exception Ex) { DBFun.InsertError(FormSession.PageName, "btnSave"); MessageFun.ShowAdminMsg(this, Ex.Message); } ClearUI(); Fillddl(); FillGrid(); }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// protected void btnCancelSelectCards_Click(object sender, EventArgs e) { try { System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US"); string confirmValue = Request.Form["confirm_value"]; if (confirmValue == "Yes") { bool isEmpty = false; bool isCheck = false; foreach (GridViewRow row in grdData.Rows) { if (row.RowType == DataControlRowType.DataRow) { if (((CheckBox)(row.FindControl("chkSelect"))).Checked) { isCheck = true; if (string.IsNullOrEmpty(((TextBox)row.FindControl("txtgRejectReason")).Text)) { isEmpty = true; break; } } } } if (!isCheck) { MessageFun.ShowMsg(this, MessageFun.TypeMsg.Validation, General.Msg("Must select a card at least", "يجب اختيار بطاقة على الأقل")); return; } if (!isEmpty) { for (int i = 0; i < grdData.Rows.Count; i++) { GridViewRow gvr = grdData.Rows[i]; bool isChecked = ((CheckBox)(gvr.FindControl("chkSelect"))).Checked; if (isChecked) { string RejectReason = ((TextBox)gvr.FindControl("txtgRejectReason")).Text; if (FormSession.PermUsr.Contains("ACrd")) { SqlClass.Rejected(gvr.Cells[5].Text, FormSession.LoginUsr, DateTime.Now.ToShortDateString(), "-1",RejectReason); } } } FillDDL(); FillGrid(); MessageFun.ShowMsg(this, MessageFun.TypeMsg.Warning, General.Msg(MainNameEn + " Rejected", MainName2Ar + " مرفوضة")); } else { MessageFun.ShowMsg(this, MessageFun.TypeMsg.Validation, General.Msg("You must enter the reason for rejection", "يجب إدخال سبب الرفض")); } } } catch (Exception Ex) { MessageFun.ShowAdminMsg(this, Ex.Message); } }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// protected void btnSave_Click(object sender, EventArgs e) { if (!Page.IsValid) { ValidatorCollection ValidatorColl = Page.Validators; for (int k = 0; k < ValidatorColl.Count; k++) { if (!ValidatorColl[k].IsValid && !String.IsNullOrEmpty(ValidatorColl[k].ErrorMessage)) { vsSave.ShowSummary = true; return; } vsSave.ShowSummary = false; } return; } try { FillPropeties(); if (ViewState["CommandName"].ToString() == "Save") { SqlClass.RoleInsert(ProClass); MessageFun.ShowMsg(this, MessageFun.TypeMsg.Success, General.Msg(MainNameEn + " added successfully", "تمت إضافة " + MainName2Ar + " بنجاح")); } if (ViewState["CommandName"].ToString() == "Update") { SqlClass.RoleUpdate(ProClass); MessageFun.ShowMsg(this, MessageFun.TypeMsg.Success, General.Msg(MainNameEn + " updated successfully", "تم تعديل " + MainName2Ar + " بنجاح")); } if (ViewState["CommandName"].ToString() == "Delete") { //dt = DBFun.FetchData("SELECT BrcID FROM CollegesFaculty WHERE BrcID = " + ddlPkID.SelectedValue); //if (!DBFun.IsNullOrEmpty(dt)) if (txtRoleNameEn.Text == "admin" || txtRoleNameAr.Text == "مدير النظام") { MessageFun.ShowMsg(this, MessageFun.TypeMsg.Error, General.Msg("You can not delete a Role the system administrator", "لا يمكن حذف مجموعة صلاحيات مدير النظام")); //MessageFun.ShowMsg(this, MessageFun.TypeMsg.Error, General.Msg("Deletion can not because of the presence of related records", "لا يمكن الحذف بسبب وجود سجلات مرتبطة")); } else { SqlClass.RoleDelete(ProClass); MessageFun.ShowMsg(this, MessageFun.TypeMsg.Success, General.Msg(MainNameEn + " deleted successfully", "تم حذف " + MainName2Ar + " بنجاح")); } } ClearUI(); Fillddl(); } catch (Exception Ex) { DBFun.InsertError(FormSession.PageName, "btnSaveDelete"); MessageFun.ShowAdminMsg(this, Ex.Message); } }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// protected void btnSave_Click(object sender, EventArgs e) { try { System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US"); if (!Page.IsValid) { ValidatorCollection ValidatorColl = Page.Validators; for (int k = 0; k < ValidatorColl.Count; k++) { if (!ValidatorColl[k].IsValid && !String.IsNullOrEmpty(ValidatorColl[k].ErrorMessage)) { vsSave.ShowSummary = true; return; } vsSave.ShowSummary = false; } return; } if ((btnSave.Text == "Save") || (btnSave.Text == "حفظ")) { ProClass.Printed = false; ProClass.Status = 1; FillObject(); SqlClass.Insert(ProClass); MessageFun.ShowMsg(this, MessageFun.TypeMsg.Success, General.Msg("Sticker details added successfully", "تم اضافة بيانات الملصق بنجاح")); } //if ((btnSave.Text == "Update") || (btnSave.Text == "تعديل")) //{ // ProClass.StickerID = ; // ProClass.ModifiedBy = userName; // ProClass.ModifiedDate = DateTime.Now.ToShortDateString(); // ProClass.Printed = false; // ProClass.Status = true; // ProClass.ExceptionReq = Convert.ToBoolean(ViewState["checkStick"]); // FillObject(); // SqlClass.Update(ProClass); // MessageFun.ShowMsg(this, MessageFun.TypeMsg.Success, General.Msg("Sticker details updated successfully", "تم تعديل بيانات الملصق بنجاح")); // ViewState["checkStick"] = "False"; //} FillGrid(txtIDSearch.Text.Trim()); ClearUI(); } catch (Exception EX) { DBFun.InsertError(FormSession.PageName, "btnSave"); MessageFun.ShowAdminMsg(this, EX.Message); } }
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// protected void btnSave_Click(object sender, EventArgs e) { if (!Page.IsValid) { ValidatorCollection ValidatorColl = Page.Validators; for (int k = 0; k < ValidatorColl.Count; k++) { if (!ValidatorColl[k].IsValid && !String.IsNullOrEmpty(ValidatorColl[k].ErrorMessage)) { vsSave.ShowSummary = true; return; } vsSave.ShowSummary = false; } return; } try { FillPropeties(); if (ViewState["CommandName"].ToString() == "Save") { SqlClass.Insert(ProClass); MessageFun.ShowMsg(this, MessageFun.TypeMsg.Success, General.Msg(MainNameEn + " added successfully", "تمت إضافة " + MainName2Ar + " بنجاح")); } if (ViewState["CommandName"].ToString() == "Update") { SqlClass.Update(ProClass); MessageFun.ShowMsg(this, MessageFun.TypeMsg.Success, General.Msg(MainNameEn + " updated successfully", "تم تعديل " + MainName2Ar + " بنجاح")); } if (ViewState["CommandName"].ToString() == "Delete") { dt = DBFun.FetchData("SELECT CompID FROM EmployeeMaster WHERE CompID = " + ddlPkID.SelectedValue); if (!DBFun.IsNullOrEmpty(dt)) { MessageFun.ShowMsg(this, MessageFun.TypeMsg.Error, General.Msg("Deletion can not because of the presence of related records", "لا يمكن الحذف بسبب وجود سجلات مرتبطة")); } else { SqlClass.Delete(ProClass); MessageFun.ShowMsg(this, MessageFun.TypeMsg.Success, General.Msg(MainNameEn + " deleted successfully", "تم حذف " + MainName2Ar + " بنجاح")); } } ClearUI(); Fillddl(); FillGrid(); } catch (Exception Ex) { DBFun.InsertError(FormSession.PageName, "btnSave"); MessageFun.ShowAdminMsg(this, Ex.Message); } }
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// protected void UserLogin() { System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US"); string loginDate = DateTime.Now.ToString("dd/MM/yyyy"); Session["Permissions"] = null; StringBuilder Q = new StringBuilder(); Q.Append("SELECT * FROM AppUsers WHERE UsrStatus = '1' AND UsrLoginID = @P1 "); if (txtLoginID.Text != "admin") { Q.Append(" AND GETDATE() BETWEEN UsrStartDate AND UsrExpireDate "); } DataTable dt = DBFun.FetchData(Q.ToString(), new string[] { txtLoginID.Text }); if (!DBFun.IsNullOrEmpty(dt)) { if (dt.Rows[0]["UsrPassword"].ToString() == txtPassword.Text) //CryptorEngine.Decrypt("", true) { try { Session["UserName"] = txtLoginID.Text; Session["Permissions"] = CryptorEngine.Decrypt(dt.Rows[0]["UsrPermission"].ToString(), true); //Session["Permissions"] = dt.Rows[0]["UsrPermission"].ToString(); Session["PreferedCulture"] = "en-US"; Session["Language"] = dt.Rows[0]["UsrLanguage"].ToString(); Session["Role"] = "User"; Session["MyTheme"] = "Theme" + Session["Language"].ToString(); string url = InfoTab.FindFirstTab(); //@"~/pages/SettingMachine.aspx"; //MachinePing.aspx"; //InfoTab.FindFirstTab(); //@"~/pages/MachinePing.aspx";// if (!string.IsNullOrEmpty(url)) { Response.Redirect(url, false); } else { MessageFun.ShowMsg(this, MessageFun.TypeMsg.Error, General.Msg("You do not have access,Please contact the Administrator", "لا يمكنك الدخول,الرجاء مراجعة مدير النظام")); } return; } catch (Exception e1) { DBFun.InsertError("Login.aspx", "UserLogin"); } } } MessageFun.ShowMsg(this, MessageFun.TypeMsg.Error, General.Msg("You do not have access,Please contact the Administrator", "لا يمكنك الدخول,الرجاء مراجعة مدير النظام")); }
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /*#############################################################################################################################*/ /*#############################################################################################################################*/ #region grdDocs Events protected void btnUploadDoc_Click(object sender, EventArgs e) { try { if (string.IsNullOrEmpty(txtEmpNationalID.Text)) { MessageFun.ShowMsg(this, MessageFun.TypeMsg.Validation, General.Msg("Please enter the National ID", "يجب إدخال رقم الهوية")); return; } if (string.IsNullOrEmpty(txtDocName.Text)) { MessageFun.ShowMsg(this, MessageFun.TypeMsg.Validation, General.Msg("Please enter the Document Name", "يجب إدخال اسم المستند")); return; } if (fuDocs.PostedFile != null && fuDocs.PostedFile.FileName != "") { string dateFile = String.Format("{0:ddMMYyyyyHHmmss}", DateTime.Now); string FileName = System.IO.Path.GetFileName(fuDocs.PostedFile.FileName); string[] nameArr = FileName.Split('.'); string name = nameArr[0]; string type = nameArr[1]; string NewFileName = txtEmpNationalID.Text + "-Doc" + dateFile + "." + type; fuDocs.PostedFile.SaveAs(Server.MapPath(@"../Import/EmployeesFiles/") + NewFileName); ProClass.EmpID = txtEmpNationalID.Text; ProClass.DocName = txtDocName.Text; ProClass.DocPath = NewFileName; ProClass.TransactionBy = FormSession.LoginUsr; SqlClass.Docs_Insert(ProClass); } else { MessageFun.ShowMsg(this, MessageFun.TypeMsg.Validation, General.Msg("You must choose a file", "يجب اختيار ملف")); return; } FillGrdDocs(txtEmpNationalID.Text); } catch (Exception Ex) { DBFun.InsertError(FormSession.PageName, "btnUploadDoc"); MessageFun.ShowAdminMsg(this, Ex.Message); } }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// protected void grdData_RowCommand(object sender, GridViewCommandEventArgs e) { System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US"); try { string CardID = e.CommandArgument.ToString(); GridViewRow gvr = (GridViewRow)(((Control)e.CommandSource).NamingContainer); int rowIndex = gvr.RowIndex; GridViewRow GDR = grdData.Rows[rowIndex]; string EmpID = ((LinkButton)GDR.FindControl("btnViewEmp")).Text; switch (e.CommandName) { case ("Approve"): if (FormSession.PermUsr.Contains("ACrd")) { SqlClass.Approved(CardID, FormSession.LoginUsr, DateTime.Now.ToShortDateString(), "1"); } MessageFun.ShowMsg(this, MessageFun.TypeMsg.Success, General.Msg(MainNameEn + " Approved", MainName2Ar + " مقبولة")); SE.SendMailToEmp(EmpID, CardID, "W", "Approve"); break; case ("Reject"): string RejectReason = ((TextBox)GDR.FindControl("txtgRejectReason")).Text; if (!string.IsNullOrEmpty(RejectReason)) { string confirmValue = Request.Form["confirm_value"]; if (confirmValue == "Yes") { if (FormSession.PermUsr.Contains("ACrd")) { SqlClass.Rejected(CardID, FormSession.LoginUsr, DateTime.Now.ToShortDateString(), "-1",RejectReason); } MessageFun.ShowMsg(this, MessageFun.TypeMsg.Warning, General.Msg(MainNameEn + " Rejected", MainName2Ar + " مرفوضة")); SE.SendMailToEmp(EmpID, CardID, "W", "Reject"); } } else { MessageFun.ShowMsg(this, MessageFun.TypeMsg.Validation, General.Msg("You must enter the reason for rejection", "يجب إدخال سبب الرفض")); } break; } FillDDL(); FillGrid(); } catch (Exception Ex) { MessageFun.ShowAdminMsg(this, Ex.Message); } }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// protected void btnDelete_Click(object sender, EventArgs e) { string Q = " SELECT * FROM TransactionLog WHERE LogPkID = '" + txtEmpID.Text + "' "; dt = DBFun.FetchData(Q); if (!DBFun.IsNullOrEmpty(dt)) { MessageFun.ShowMsg(this, MessageFun.TypeMsg.Error, General.Msg("Deletion can not because of the presence of related records", "لا يمكن الحذف بسبب وجود سجلات مرتبطة")); } else { ProClass.EmpID = txtEmpID.Text; SqlClass.Delete(ProClass); MessageFun.ShowMsg(this, MessageFun.TypeMsg.Success, General.Msg("Employee deleted successfully", "تم حذف الموظف بنجاح")); ClearItem(); Search(); } }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// protected void btnDelete_Click(object sender, EventArgs e) { //string Q = " SELECT VtpID FROM EmpVacRel WHERE EvrID = " + txtEvrID.Text + " "; //dt = DBFun.FetchData(Q); //if (!DBFun.IsNullOrEmpty(dt)) //{ // MessageFun.ShowMsg(this, MessageFun.TypeMsg.Error, General.Msg("Deletion can not because of the presence of related records", "لا يمكن الحذف بسبب وجود سجلات مرتبطة")); //} //else //{ ProClass.VtpID = txtEvrID.Text; SqlClass.Delete(ProClass); MessageFun.ShowMsg(this, MessageFun.TypeMsg.Success, General.Msg("Vacation deleted for employee successfully", "تم حذف الإجازة للموظف بنجاح")); ClearItem(); Search(); //} }
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// protected void btnSave_Click(object sender, EventArgs e) { try { if (!Page.IsValid) { ValidatorCollection ValidatorColl = Page.Validators; for (int k = 0; k < ValidatorColl.Count; k++) { if (!ValidatorColl[k].IsValid && !String.IsNullOrEmpty(ValidatorColl[k].ErrorMessage)) { vsSave.ShowSummary = true; return; } vsSave.ShowSummary = false; } return; } FillPropeties(); if (ViewState["Action"].ToString() == "A") { SqlClass.Insert(ProClass); MessageFun.ShowMsg(this, MessageFun.TypeMsg.Success, General.Msg(MainNameEn + " data added successfully", "تمت إضافة بيانات " + MainName2Ar + " بنجاح")); } if (ViewState["Action"].ToString() == "U") { SqlClass.Update(ProClass); MessageFun.ShowMsg(this, MessageFun.TypeMsg.Success, General.Msg(MainNameEn + " data updated successfully", "تم تعديل بيانات " + MainName2Ar + " بنجاح")); } ClearUI(); ButtonAction("00", true); //VisImage.EnabledImage(false); } catch (Exception ex) { DBFun.InsertError(FormSession.PageName, "btnSave"); VisImage.PopulateImage(txtVisIdentityNo.Text); MessageFun.ShowAdminMsg(this, ex.Message); } }
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// protected void btnSave_Click(object sender, EventArgs e) { if (!Page.IsValid) { ValidatorCollection ValidatorColl = Page.Validators; for (int k = 0; k < ValidatorColl.Count; k++) { if (!ValidatorColl[k].IsValid && !String.IsNullOrEmpty(ValidatorColl[k].ErrorMessage)) { vsSave.ShowSummary = true; return; } vsSave.ShowSummary = false; } return; } FillPropeties(); SqlClass.InsertUpdate(ProClass); MessageFun.ShowMsg(this, MessageFun.TypeMsg.Success, General.Msg("WorkTime setting added successfully", "تم تحديث اعدادات وقت العمل بنجاح ")); }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// protected void btnMainDelete_Click(object sender, EventArgs e) { string Q = " SELECT DepID FROM Department WHERE DepParentID = " + txtDepID.Text + " " + " UNION SELECT DepID FROM EmployeesInfoView WHERE DepID = " + txtDepID.Text + " "; dt = DBFun.FetchData(Q); if (!DBFun.IsNullOrEmpty(dt)) { MessageFun.ShowMsg(this, MessageFun.TypeMsg.Error, General.Msg("Deletion can not because of the presence of related records", "لا يمكن الحذف بسبب وجود سجلات مرتبطة")); } else { ProClass.DepID = txtDepID.Text; SqlClass.Delete(ProClass); MessageFun.ShowMsg(this, MessageFun.TypeMsg.Success, General.Msg("Department deleted successfully", "تم حذف القسم بنجاح")); ClearItem(); Search(); //FillSubGrid(SubQuery + " AND SdpID = -1"); } }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// protected void btnApproveSelectCards_Click(object sender, EventArgs e) { try { System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US"); bool isCheck = false; foreach (GridViewRow row in grdData.Rows) { if (row.RowType == DataControlRowType.DataRow) { if (((CheckBox)(row.FindControl("chkSelect"))).Checked) { isCheck = true; break; } } } if (!isCheck) { MessageFun.ShowMsg(this, MessageFun.TypeMsg.Validation, General.Msg("Must select a card at least", "يجب اختيار بطاقة على الأقل")); return; } for (int i = 0; i < grdData.Rows.Count; i++) { GridViewRow gvr = grdData.Rows[i]; bool isChecked = ((CheckBox)(gvr.FindControl("chkSelect"))).Checked; if (isChecked) { if (FormSession.PermUsr.Contains("ACrd")) { SqlClass.Approved(gvr.Cells[4].Text, FormSession.LoginUsr, DateTime.Now.ToShortDateString(), "1"); } } } FillDDL(); FillGrid(); MessageFun.ShowMsg(this, MessageFun.TypeMsg.Success, General.Msg(MainNameEn + " Approved", MainName2Ar + " مقبولة")); } catch (Exception Ex) { MessageFun.ShowAdminMsg(this, Ex.Message); } }
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// protected void btnSave_Click(object sender, EventArgs e) { if (!Page.IsValid) { ValidatorCollection ValidatorColl = Page.Validators; for (int k = 0; k < ValidatorColl.Count; k++) { if (!ValidatorColl[k].IsValid && !String.IsNullOrEmpty(ValidatorColl[k].ErrorMessage)) { vsSave.ShowSummary = true; return; } vsSave.ShowSummary = false; } return; } try { ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// if (ddlProcessType.SelectedValue == ViewState["EmpType"].ToString()) { MessageFun.ShowMsg(this, MessageFun.TypeMsg.Warning, General.Msg("Employee is already part of " + GetNameType(ViewState["EmpType"].ToString()), "الموظف موجود فعلياً ضمن قائمة " + GetNameType(ViewState["EmpType"].ToString()))); return; } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// FillPropeties(); SqlClass.UpdateType(ProClass); ClearUI(); txtIDSearch.Text = ""; MessageFun.ShowMsg(this, MessageFun.TypeMsg.Success, General.Msg(MainNameEn + " Update Employee type successfully", "تم تعديل نوع " + MainName2Ar + " بنجاح")); ButtonAction("00", true); } catch (Exception Ex) { DBFun.InsertError(FormSession.PageName, "btnSave"); MessageFun.ShowAdminMsg(this, Ex.Message); } }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// protected void btnSearchDetails_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(txtEmpIDSearch.Text)) { dt = DBFun.FetchData("select * from EmployeeMaster WHERE EmpID = '" + txtEmpIDSearch.Text + "'"); if (!DBFun.IsNullOrEmpty(dt)) { string ID = hfdConnStr.Value + "%" + txtEmpIDSearch.Text + "%" + hfdLoginUser.Value + "%" + hfdLang.Value + "%" + hfdFile.Value; ScriptManager.RegisterStartupScript(this, this.GetType(), "key", "Connect('" + ID + "');", true); } else { MessageFun.ShowMsg(this, MessageFun.TypeMsg.Error, General.Msg("Employee ID does not exist,Please enter different ID", "رقم الموظف غير موجود,من فضلك اختر رقما آخر")); //string ID = hfdConnStr.Value + "%%" + hfdLoginUser.Value + "%" + hfdLang.Value + "%" + hfdFile.Value; //ScriptManager.RegisterStartupScript(this, this.GetType(), "key", "Connect('" + ID + "');", true); } } else { General.ShowMsg(this, "You must enter the employee ID", "يجب إدخال رقم الموظف"); } }
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// protected void btnImport_Click(object sender, ImageClickEventArgs e) { try { if (fudFilePath.HasFile) { string OldName = fudFilePath.FileName; string[] nameArr = OldName.Split('.'); string FName = nameArr[0]; string FType = nameArr[1]; string EmpType = "Visitors"; string FileName = FormSession.LoginUsr + "-" + EmpType + "." + FType; fudFilePath.SaveAs(Server.MapPath(@"../" + EmpType + "/") + FileName); string Path = Server.MapPath(@"../" + EmpType + "/") + FileName; string ExcelConnectionString = getExcelConnectionString(Path); if (!string.IsNullOrEmpty(ExcelConnectionString)) { string SheetName = GetExcelSheetNames(ExcelConnectionString); FillExcelDataSet(ExcelConnectionString, SheetName); FillDB(); if (File.Exists(Path)) { File.Delete(Path); } MessageFun.ShowMsg(this, MessageFun.TypeMsg.Success, General.Msg("succsss Import", "تمت عملية الاستيراد")); } } } catch (Exception ex) { MessageFun.ShowAdminMsg(this, ex.ToString()); } }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// protected void Fetch() { string EmpID = ViewState["EmpID"].ToString(); DateTime LastCardExpire = GetExpireDateCard(EmpID); if (LastCardExpire > DateTime.Now) { MessageFun.ShowMsg(this, MessageFun.TypeMsg.Warning, General.Msg("This employee has already active card and not expired", "هذا الموظف لدية بالفعل بطاقة سارية المفعول")); } int CountCard = FindCount(EmpID); if (CountCard > 0) { lblCntPrint.Text = General.Msg("This employee has " + CountCard.ToString() + " printed Cards ", "هذا الموظف لديه " + CountCard.ToString() + " بطاقات مطبوعة"); lblCntPrint.ForeColor = Color.Red; divCountPrint.Visible = true; } FillGrid(); ButtonAction("111000"); }
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// protected void FillDB() { string[] ExcelFiled = new string[] { "IdentityNo", "NameAr", "NameEn", "MobileNo", "StartDate", "ExpiryDate", "Region1", "Region2", "Region3", "Region4", "Region5", "Region6", "Region7", "Region8", "Region9", "Description" }; System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US"); ProClass.DateType = FormSession.DateType; ProClass.TransactionBy = FormSession.LoginUsr; ProClass.CardStatus = "0"; ProClass.isPrinted = false; ProClass.TmpID = FindTmp(); if (ProClass.TmpID == "0") { MessageFun.ShowMsg(this, MessageFun.TypeMsg.Success, General.Msg("No one has provided a Template for this type of card, you can not import data", "لم تتم إضافة نموذج لهذا النوع من البطاقات,لا يمكن استيراد البيانات")); return; } int Count = 0; int ICount = 0; int ECount = 0; int BCount = 0; foreach (DataRow DR in ExcelDataSet.Tables[0].Rows) { if (DR[ExcelFiled[0]] != DBNull.Value) { ProClass.VisIdentityNo = DR[ExcelFiled[0]].ToString(); ProClass.VisNameAr = DR[ExcelFiled[1]].ToString(); if (!string.IsNullOrEmpty(DR[ExcelFiled[2]].ToString())) { ProClass.VisNameEn = DR[ExcelFiled[2]].ToString(); } if (!string.IsNullOrEmpty(DR[ExcelFiled[3]].ToString())) { ProClass.VisMobileNo = DR[ExcelFiled[3]].ToString(); } ProClass.StartDate = DR[ExcelFiled[4]].ToString(); ProClass.ExpiryDate = DR[ExcelFiled[5]].ToString(); ProClass.VisRegion1 = Convert.ToBoolean(Convert.ToInt32(DR[ExcelFiled[6]].ToString())); ProClass.VisRegion2 = Convert.ToBoolean(Convert.ToInt32(DR[ExcelFiled[7]].ToString())); ProClass.VisRegion3 = Convert.ToBoolean(Convert.ToInt32(DR[ExcelFiled[8]].ToString())); ProClass.VisRegion4 = Convert.ToBoolean(Convert.ToInt32(DR[ExcelFiled[9]].ToString())); ProClass.VisRegion5 = Convert.ToBoolean(Convert.ToInt32(DR[ExcelFiled[10]].ToString())); ProClass.VisRegion6 = Convert.ToBoolean(Convert.ToInt32(DR[ExcelFiled[11]].ToString())); ProClass.VisRegion7 = Convert.ToBoolean(Convert.ToInt32(DR[ExcelFiled[12]].ToString())); ProClass.VisRegion8 = Convert.ToBoolean(Convert.ToInt32(DR[ExcelFiled[13]].ToString())); ProClass.VisRegion9 = Convert.ToBoolean(Convert.ToInt32(DR[ExcelFiled[14]].ToString())); if (!string.IsNullOrEmpty(DR[ExcelFiled[15]].ToString())) { ProClass.Description = DR[ExcelFiled[15]].ToString(); } ProClass.CopiesCount = (Convert.ToInt16(FindCount(ProClass.VisIdentityNo)) + 1).ToString(); try { bool isBlakList = FindBlackList(ProClass.VisIdentityNo); if (isBlakList) { BCount += 1; } else { SqlClass.Insert(ProClass); ICount += 1; } } catch (Exception ex) { ECount += 1; } } Count += 1; } txtAddCount.Text = ICount.ToString(); txtErrCount.Text = ECount.ToString(); txtBlackListCount.Text = BCount.ToString(); }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// protected void btnSave_Click(object sender, EventArgs e) { try { if (!Page.IsValid) { ValidatorCollection ValidatorColl = Page.Validators; for (int k = 0; k < ValidatorColl.Count; k++) { if (!ValidatorColl[k].IsValid && !String.IsNullOrEmpty(ValidatorColl[k].ErrorMessage)) { vsSave.ShowSummary = true; return; } vsSave.ShowSummary = false; } return; } if ((btnSave.Text == "Save") || (btnSave.Text == "حفظ")) { FillIssueObject(); int returnValue = isSql.Insert(isPro); if (returnValue > 0) { for (int i = 0; i < cblConditions.Items.Count; i++) { isPro.IsID = returnValue.ToString(); isPro.ConditionName = cblConditions.Items[i].Text; isSql.InsertCondition(isPro); } ClearUI(); FillGrid(); MessageFun.ShowMsg(this, MessageFun.TypeMsg.Success, General.Msg(MainNameEn + " data added successfully", "تم إضافة بيانات " + MainName2Ar + " بنجاح")); } } if ((btnSave.Text == "Update") || (btnSave.Text == "تعديل")) { FillIssueObject(); isSql.Update(isPro); isSql.DeleteAllCondition(ddlIssue.SelectedValue, FormSession.LoginUsr); for (int i = 0; i < cblConditions.Items.Count; i++) { isPro.ConditionName = cblConditions.Items[i].Text; isSql.InsertCondition(isPro); } ClearUI(); FillGrid(); ddlIssue.ClearSelection(); MessageFun.ShowMsg(this, MessageFun.TypeMsg.Success, General.Msg(MainNameEn + " data updated successfully", "تم تعديل بيانات " + MainName2Ar + " بنجاح")); } if ((btnSave.Text == "Delete") || (btnSave.Text == "حذف")) { isSql.DeleteAllCondition(ddlIssue.SelectedValue, FormSession.LoginUsr); isSql.Delete(ddlIssue.SelectedValue, FormSession.LoginUsr); ClearUI(); FillGrid(); Fillddl(); MessageFun.ShowMsg(this, MessageFun.TypeMsg.Success, General.Msg(MainNameEn + " Deleted successfully", "تم حذف " + MainName2Ar + " بنجاح")); } } catch (Exception Ex) { DBFun.InsertError(FormSession.PageName, "btnSave"); MessageFun.ShowAdminMsg(this, Ex.Message); } }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// protected void btnSave_Click(object sender, EventArgs e) { try { System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US"); if (!Page.IsValid) { ValidatorCollection ValidatorColl = Page.Validators; for (int k = 0; k < ValidatorColl.Count; k++) { if (!ValidatorColl[k].IsValid && !String.IsNullOrEmpty(ValidatorColl[k].ErrorMessage)) { vsSave.ShowSummary = true; return; } vsSave.ShowSummary = false; } return; } FillPropetiesObject(); if (ViewState["CommandName"].ToString() == "Add") //(btnSave.Text == "Save") || (btnSave.Text == "حفظ") { int returnValue = SqlClass.Insert(ProClass); if (returnValue > 0) { if (cblConditions.Items.Count > 0) { for (int i = 0; i < cblConditions.Items.Count; i++) { bool retValue = SqlClass.InsertCondition(returnValue.ToString(), cblConditions.Items[i].Value, cblConditions.Items[i].Text, cblConditions.Items[i].Selected); } } ClearUI(); FillGrid(); ButtonAction("111000"); MessageFun.ShowMsg(this, MessageFun.TypeMsg.Success, General.Msg(MainNameEn + " created successfully", "تمت إضافة بيانات " + MainName2Ar + " بنجاح")); } } if (ViewState["CommandName"].ToString() == "Edit") //(btnSave.Text == "Update") || (btnSave.Text == "تعديل") { dt = DBFun.FetchData("SELECT EmpID,CardID FROM CardMaster WHERE EmpID = '" + txtEmpID.Text.Trim() + "' AND CardStatus = 0 ORDER BY CardID DESC"); if (DBFun.IsNullOrEmpty(dt)) { return; } Int32 cardID = Convert.ToInt32(dt.Rows[0]["CardID"]); ProClass.CardID = cardID.ToString(); bool returnValue = SqlClass.Update(ProClass); if (returnValue) { for (int i = 0; i < cblConditions.Items.Count; i++) { bool retValue = SqlClass.UpdateCondition(cardID.ToString(), cblConditions.Items[i].Value, cblConditions.Items[i].Selected); } ClearUI(); FillGrid(); ButtonAction("111000"); MessageFun.ShowMsg(this, MessageFun.TypeMsg.Success, General.Msg(MainNameEn + " data updated successfully", "تمت تعديل بيانات " + MainName2Ar + " بنجاح")); } } } catch (Exception Ex) { DBFun.InsertError(FormSession.PageName, "btnSave"); MessageFun.ShowAdminMsg(this, Ex.Message); } }
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// protected void btnSave_Click(object sender, EventArgs e) { if (!Page.IsValid) { ValidatorCollection ValidatorColl = Page.Validators; for (int k = 0; k < ValidatorColl.Count; k++) { if (!ValidatorColl[k].IsValid && !String.IsNullOrEmpty(ValidatorColl[k].ErrorMessage)) { vsSave.ShowSummary = true; return; } vsSave.ShowSummary = false; } return; } try { FillPropeties(); if (ViewState["CommandName"].ToString() == "Save") { SqlClass.Insert(ProClass); MessageFun.ShowMsg(this, MessageFun.TypeMsg.Success, General.Msg(MainNameEn + " added successfully", "تمت إضافة " + MainName2Ar + " بنجاح")); } if (ViewState["CommandName"].ToString() == "Update") { SqlClass.Update(ProClass); MessageFun.ShowMsg(this, MessageFun.TypeMsg.Success, General.Msg(MainNameEn + " updated successfully", "تم تعديل " + MainName2Ar + " بنجاح")); } if (ViewState["CommandName"].ToString() == "Delete") { if (txtUsrLoginID.Text == "admin") { MessageFun.ShowMsg(this, MessageFun.TypeMsg.Error, General.Msg("You can not delete a User : system administrator", "لا يمكن حذف المستخدم : مدير النظام")); return; } bool isFound = false; //string Q = " SELECT LogTransactionBy AS CreatedBy FROM TransactionLog WHERE LogTransactionBy = '" + ddlUsrLoginID.SelectedValue + "' " // + " UNION " string Q = " SELECT CreatedBy AS CreatedBy FROM CardMaster WHERE CreatedBy = '" + ddlUsrLoginID.SelectedValue + "'" + " UNION " + " SELECT PrintedBy AS CreatedBy FROM CardMaster WHERE PrintedBy = '" + ddlUsrLoginID.SelectedValue + "'" + " UNION " + " SELECT ApprovedBy AS CreatedBy FROM CardMaster WHERE ApprovedBy = '" + ddlUsrLoginID.SelectedValue + "'" + " UNION " + " SELECT CreatedBy AS CreatedBy FROM StickerMaster WHERE CreatedBy = '" + ddlUsrLoginID.SelectedValue + "'" + " UNION " + " SELECT PrintedBy AS CreatedBy FROM StickerMaster WHERE PrintedBy = '" + ddlUsrLoginID.SelectedValue + "'" + " UNION " + " SELECT ApprovedBy AS CreatedBy FROM StickerMaster WHERE ApprovedBy = '" + ddlUsrLoginID.SelectedValue + "'" + " UNION " + " SELECT CreatedBy AS CreatedBy FROM VisitorsCard WHERE CreatedBy = '" + ddlUsrLoginID.SelectedValue + "'" + " UNION " + " SELECT PrintedBy AS CreatedBy FROM VisitorsCard WHERE PrintedBy = '" + ddlUsrLoginID.SelectedValue + "'"; dt = DBFun.FetchData(Q); if (!DBFun.IsNullOrEmpty(dt)) { isFound = true; } if (isFound) { MessageFun.ShowMsg(this, MessageFun.TypeMsg.Error, General.Msg("Deletion can not because of the presence of related records", "لا يمكن الحذف بسبب وجود سجلات مرتبطة")); } else { SqlClass.Delete(ProClass); MessageFun.ShowMsg(this, MessageFun.TypeMsg.Success, General.Msg(MainNameEn + " deleted successfully", "تم حذف " + MainName2Ar + " بنجاح")); } } ddlUsrLoginID.ClearSelection(); Fillddl(); ClearUI(); } catch (Exception Ex) { DBFun.InsertError(FormSession.PageName, "btnSave"); MessageFun.ShowAdminMsg(this, Ex.Message); } }
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// protected void btnSave_Click(object sender, EventArgs e) { if (!Page.IsValid) { ValidatorCollection ValidatorColl = Page.Validators; for (int k = 0; k < ValidatorColl.Count; k++) { if (!ValidatorColl[k].IsValid && !String.IsNullOrEmpty(ValidatorColl[k].ErrorMessage)) { vsSave.ShowSummary = true; return; } vsSave.ShowSummary = false; } return; } try { if ((btnSave.Text == "Save") || (btnSave.Text == "حفظ")) { if (ddlEmpType.SelectedValue == "Emp" || ddlEmpType.SelectedValue == "Con") { txtIDSearch.Text = txtEmpIdentity.Text = FindMaxID(); } dt = DBFun.FetchData("select EmpID from EmployeeMaster where EmpID = '" + txtEmpIdentity.Text.Trim() + "'"); if (!DBFun.IsNullOrEmpty(dt)) { MessageFun.ShowMsg(this, MessageFun.TypeMsg.Error, General.Msg("Employee ID already exists,Please enter different ID", "رقم الموظف موجود مسبقا,من فضلك اختر رقما آخر")); } else { if (Request.QueryString["ac"] != null) { FillPropeties(); SqlClass.Insert(ProClass); string empid = txtEmpIdentity.Text; ClearUI(); //if (ddlEmpType.SelectedValue == "Emp" || ddlEmpType.SelectedValue == "Con") { SqlClass.Booked_Delete(txtIDSearch.Text); } txtIDSearch.Text = ""; MessageFun.ShowMsg(this, MessageFun.TypeMsg.Success, General.Msg(MainNameEn + " data added successfully, EmployeeID is '" + empid + "'", "تمت إضافة بيانات " + MainName2Ar + " بنجاح, رقم الموظف هو '" + empid + "'")); if (ddlEmpType.SelectedValue == "Emp" || ddlEmpType.SelectedValue == "Con") { txtIDSearch.Text = FindMaxID(); } } } } if ((btnSave.Text == "Update") || (btnSave.Text == "تعديل")) { dt = DBFun.FetchData("select * from EmployeeMaster where EmpID = '" + txtEmpIdentity.Text.Trim() + "'"); if (DBFun.IsNullOrEmpty(dt)) { MessageFun.ShowMsg(this, MessageFun.TypeMsg.Error, General.Msg("This ID No part of " + GetNameType(Request.QueryString["ac"].ToString()) + " ,Please enter different ID", "هذا الرقم لا يوجد ضمن " + GetNameType(Request.QueryString["ac"].ToString()) + " ,من فضلك اختر رقما آخر")); } else { if (Request.QueryString["ac"] != null) { FillPropeties(); SqlClass.Update(ProClass); ClearUI(); txtIDSearch.Text = ""; MessageFun.ShowMsg(this, MessageFun.TypeMsg.Success, General.Msg(MainNameEn + " data updated successfully", "تم تعديل بيانات " + MainName2Ar + " بنجاح")); } } } ButtonAction("00", true); DataItemEnabled(false); EmpImage.PopulateImage(txtEmpNationalID.Text); } catch (Exception Ex) { DBFun.InsertError(FormSession.PageName, "btnSave"); EmpImage.PopulateImage(txtEmpNationalID.Text); MessageFun.ShowAdminMsg(this, Ex.Message); } }