///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// protected void BirthDateValidate_ServerValidate(Object source, ServerValidateEventArgs e) { try { if (source.Equals(cvcalBirthDate)) { if (string.IsNullOrEmpty(CalBirthDate.getDate())) { General.ValidMsg(this, ref cvcalBirthDate, false, "Birth Date is required", "تاريخ الميلاد مطلوب"); e.IsValid = false; return; } else { int iStartDate = DateFun.ConvertDateTimeToInt(FormSession.DateType, CalBirthDate.getDate()); int iEndDate = DateFun.ConvertDateTimeToInt(FormSession.DateType, (DateFun.ToAnyFormat(FormSession.DateType, DateTime.Now))); General.ValidMsg(this, ref cvcalBirthDate, true, "Birthday greater than today's date", "تاريخ الميلاد أكبر من تاريخ اليوم"); if (iStartDate > iEndDate) { e.IsValid = false; } } } } catch { e.IsValid = false; } }
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public void ClearUI() { System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US"); int returnValue = DBFun.ExecuteData("DELETE FROM TempImage WHERE Type = 'Employee' AND EmpID='" + txtEmpNationalID.Text + "'"); txtEmpIdentity.Text = ""; txtEmpNameAr.Text = ""; txtEmpNameEn.Text = ""; txtJobTitleAr.Text = ""; txtJobTitleEn.Text = ""; txtEmpNationalID.Text = ""; txtMobile.Text = ""; txtEmail.Text = ""; CalBirthDate.ClearDate(); CalHireDate.ClearDate(); ddlNatID.SelectedIndex = -1; ddlBloodGroup.SelectedIndex = -1; ddlCompID.SelectedIndex = -1; ddlSecID.SelectedIndex = -1; rdlGender.SelectedIndex = 0; EmpImage.ClearImage(); }
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public void DataItemEnabled(bool status) { txtEmpIdentity.Enabled = status; txtEmpNameAr.Enabled = status; txtEmpNameEn.Enabled = status; ddlNatID.Enabled = status; CalBirthDate.setEnabled(status); txtEmpNationalID.Enabled = status; txtJobTitleAr.Enabled = status; txtJobTitleEn.Enabled = status; ddlBloodGroup.Enabled = status; ddlCompID.Enabled = status; ddlSecID.Enabled = status; CalHireDate.setEnabled(status); rdlGender.Enabled = status; txtMobile.Enabled = status; txtEmail.Enabled = status; EmpImage.EnabledImage(status); }
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public void FillFromDT(DataTable DT) { txtEmpIdentity.Text = DT.Rows[0]["EmpID"].ToString(); txtEmpNameAr.Text = DT.Rows[0]["EmpNameAr"].ToString(); txtEmpNameEn.Text = DT.Rows[0]["EmpNameEn"].ToString(); txtJobTitleAr.Text = DT.Rows[0]["EmpJobTitleAr"].ToString(); txtJobTitleEn.Text = DT.Rows[0]["EmpJobTitleEn"].ToString(); txtEmpNationalID.Text = DT.Rows[0]["EmpNationalID"].ToString(); txtMobile.Text = DT.Rows[0]["EmpMobileNo"].ToString(); txtEmail.Text = DT.Rows[0]["EmpEmailID"].ToString(); CalBirthDate.setDBDate(DT.Rows[0]["EmpBirthDate"], "S"); CalHireDate.setDBDate(DT.Rows[0]["EmpHireDate"], "S"); ddlNatID.SelectedIndex = ddlNatID.Items.IndexOf(ddlNatID.Items.FindByValue(DT.Rows[0]["NatID"].ToString())); ddlBloodGroup.SelectedIndex = ddlBloodGroup.Items.IndexOf(ddlBloodGroup.Items.FindByValue(DT.Rows[0]["EmpBloodGroup"].ToString())); if (DT.Rows[0]["CompID"] != DBNull.Value) { ddlCompID.SelectedIndex = ddlCompID.Items.IndexOf(ddlCompID.Items.FindByValue(DT.Rows[0]["CompID"].ToString())); } if (DT.Rows[0]["SecID"] != DBNull.Value) { ddlSecID.SelectedIndex = ddlSecID.Items.IndexOf(ddlSecID.Items.FindByValue(DT.Rows[0]["SecID"].ToString())); } if (DT.Rows[0]["EmpGender"] != DBNull.Value) { rdlGender.SelectedIndex = rdlGender.Items.IndexOf(rdlGender.Items.FindByValue(DT.Rows[0]["EmpGender"].ToString())); } if ((DT.Rows[0]["image"] == DBNull.Value) || (DT.Rows[0]["ImageLength"].ToString() == "0")) { EmpImage.ClearImage(); } else { EmpImage.setImage(DT.Rows[0]["EmpNationalID"].ToString()); } FillGrdDocs(txtEmpNationalID.Text); }
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public void FillPropeties() { try { System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US"); ProClass.DateType = FormSession.DateType; ProClass.EmpID = txtEmpIdentity.Text; ProClass.EmpType = ddlEmpType.SelectedValue; ProClass.EmpNameEn = txtEmpNameEn.Text; ProClass.EmpNameAr = txtEmpNameAr.Text; ProClass.EmpBirthDate = CalBirthDate.getDate(); ProClass.EmpJobTitleAr = txtJobTitleAr.Text; ProClass.EmpJobTitleEn = txtJobTitleEn.Text; ProClass.EmpNationalID = txtEmpNationalID.Text; ProClass.EmpHireDate = CalHireDate.getDate(); ProClass.EmpMobileNo = txtMobile.Text; ProClass.EmpEmailID = txtEmail.Text; if (ddlNatID.SelectedIndex > 0) { ProClass.NatID = ddlNatID.SelectedValue; } if (ddlBloodGroup.SelectedIndex > 0) { ProClass.EmpBloodGroup = ddlBloodGroup.SelectedValue; } if (ddlCompID.SelectedIndex > 0) { ProClass.CompID = ddlCompID.SelectedValue; } if (ddlSecID.SelectedIndex > 0) { ProClass.SecID = ddlSecID.SelectedValue; } if (rdlGender.SelectedIndex > -1) { ProClass.EmpGender = Convert.ToChar(rdlGender.SelectedValue); } ProClass.TransactionBy = FormSession.LoginUsr; ProClass.TransactionDate = DateTime.Now.ToShortDateString(); ////////////////////////////////////////////// Byte[] pImage = new Byte[0]; string pImageContentType = ""; int pImageLength = 0; EmpImage.GetImage(out pImage, out pImageContentType, out pImageLength); if (pImageLength != 0) { ProClass.EmpImage = CryptoImage.EncryptBytes(pImage); } else { ProClass.EmpImage = pImage; } ProClass.EmpImageContentType = pImageContentType; ProClass.EmpImageLength = pImageLength; ////////////////////////////////////////////// } catch (Exception Ex) { DBFun.InsertError(FormSession.PageName, "FillPropeties"); MessageFun.ShowAdminMsg(this, Ex.Message); } }