protected void btnSave_Click(object sender, EventArgs e) { health_office objHo = new health_office(); if (txtHealthOfficeCode.ReadOnly) { // update case objHo.LoadByPrimaryKey(int.Parse(txtHealthOfficeCode.Text)); objHo.HEALTHDESCR = txtHealthOfficeName.Text; objHo.CIVILCD = int.Parse(drpCivilOffice.SelectedValue); objHo.CIVILDESCR = drpCivilOffice.SelectedItem.Text; objHo.POLICECD = int.Parse(drpPoliceStation.SelectedValue); objHo.AREACD = int.Parse(dropArea.SelectedValue); objHo.IsTown = chkIsTown.Checked; objHo.Save(); txtHealthOfficeCode.ReadOnly = false; Filter(); //txtFilter.Text = ""; txtHealthOfficeCode.Text = ""; txtHealthOfficeName.Text = ""; drpGove.Enabled = true; drpCivilOffice.Enabled = true; chkIsTown.Checked = false; drpPoliceStation.SelectedIndex = 0; dropArea.SelectedIndex = 0; btnSave.Text = "اضافة"; } else { try { //Insert case objHo.AddNew(); objHo.HEALTHCD = int.Parse(txtHealthOfficeCode.Text); objHo.HEALTHDESCR = txtHealthOfficeName.Text; objHo.CIVILCD = int.Parse(drpCivilOffice.SelectedValue); objHo.CIVILDESCR = drpCivilOffice.SelectedItem.Text; objHo.POLICECD = int.Parse(drpPoliceStation.SelectedValue); objHo.AREACD = int.Parse(dropArea.SelectedValue); objHo.IsTown = chkIsTown.Checked; objHo.Save(); Filter(); //txtFilter.Text = ""; txtHealthOfficeCode.Text = ""; txtHealthOfficeName.Text = ""; drpGove.Enabled = true; chkIsTown.Checked = false; drpCivilOffice.Enabled = true; drpPoliceStation.SelectedIndex = 0; dropArea.SelectedIndex = 0; } catch { MHOCommon.ShowMessage("لقد حاولت ادخال كود موجود اوهناك خطأ فى البيانات", this.Page); } } }
protected void uiDropDownListCivil_SelectedIndexChanged(object sender, EventArgs e) { if (uiDropDownListCivil.SelectedIndex != 0 && uiDropDownListGov.SelectedIndex != 0) { health_office obj = new health_office(); uiDropDownListHealthOffice.DataSource = obj.GetHealthOfficeDetails(short.Parse(uiDropDownListGov.SelectedValue), short.Parse(uiDropDownListCivil.SelectedValue)).DefaultView; uiDropDownListHealthOffice.DataTextField = health_office.ColumnNames.HEALTHDESCR; uiDropDownListHealthOffice.DataValueField = health_office.ColumnNames.HEALTHCD; uiDropDownListHealthOffice.DataBind(); uiDropDownListHealthOffice.Items.Insert(0, new ListItem("---", "0")); uiDropDownListHealthOffice.SelectedIndex = 0; } }
private void LoadLookups() { GOVERNORATE gov = new GOVERNORATE(); gov.LoadAll(); uiDropDownListGov.DataSource = gov.DefaultView; uiDropDownListGov.DataTextField = GOVERNORATE.ColumnNames.DESCR; uiDropDownListGov.DataValueField = GOVERNORATE.ColumnNames.CD; uiDropDownListGov.DataBind(); uiDropDownListGov.Items.Insert(0, new ListItem("---")); uiDropDownListGov.SelectedIndex = 0; uiDropDownListMachineGov.DataSource = gov.DefaultView; uiDropDownListMachineGov.DataTextField = GOVERNORATE.ColumnNames.DESCR; uiDropDownListMachineGov.DataValueField = GOVERNORATE.ColumnNames.CD; uiDropDownListMachineGov.DataBind(); uiDropDownListMachineGov.Items.Insert(0, new ListItem("---")); uiDropDownListMachineGov.SelectedIndex = 0; CIVIL_OFFICE pol = new CIVIL_OFFICE(); pol.LoadAll(); uiDropDownListCivil.DataSource = pol.DefaultView; uiDropDownListCivil.DataTextField = POLICE_STATION.ColumnNames.DESCR; uiDropDownListCivil.DataValueField = POLICE_STATION.ColumnNames.CD; uiDropDownListCivil.DataBind(); uiDropDownListCivil.Items.Insert(0, new ListItem("---")); uiDropDownListCivil.SelectedIndex = 0; uiDropDownListMachineCivil.DataSource = pol.DefaultView; uiDropDownListMachineCivil.DataTextField = POLICE_STATION.ColumnNames.DESCR; uiDropDownListMachineCivil.DataValueField = POLICE_STATION.ColumnNames.CD; uiDropDownListMachineCivil.DataBind(); uiDropDownListMachineCivil.Items.Insert(0, new ListItem("---")); uiDropDownListMachineCivil.SelectedIndex = 0; health_office obj = new health_office(); obj.LoadAll(); uiDropDownListHealthOffice.DataSource = obj.DefaultView; uiDropDownListHealthOffice.DataTextField = health_office.ColumnNames.HEALTHDESCR; uiDropDownListHealthOffice.DataValueField = health_office.ColumnNames.HEALTHCD; uiDropDownListHealthOffice.DataBind(); uiDropDownListHealthOffice.Items.Insert(0, new ListItem("---")); uiDropDownListHealthOffice.SelectedIndex = 0; uiDropDownListMachineHealthOffice.DataSource = obj.DefaultView; uiDropDownListMachineHealthOffice.DataTextField = health_office.ColumnNames.HEALTHDESCR; uiDropDownListMachineHealthOffice.DataValueField = health_office.ColumnNames.HEALTHCD; uiDropDownListMachineHealthOffice.DataBind(); uiDropDownListMachineHealthOffice.Items.Insert(0, new ListItem("---")); uiDropDownListMachineHealthOffice.SelectedIndex = 0; }
private bool LogicValidateData() { if (drpLocation.SelectedValue == "2" && drpGov.SelectedValue == "-1") { lblMsg.Text = "برجاء اختيار مديرية الصحة"; lblGov.BackColor = System.Drawing.Color.Red; return false; } if (drpLocation.SelectedValue == "3" && drpGov.SelectedValue == "-1") { lblMsg.Text = "برجاء اختيار مديرية الصحة"; lblGov.BackColor = System.Drawing.Color.Red; return false; } else if (drpLocation.SelectedValue == "3" && drpCivil.SelectedValue == "-1") { lblMsg.Text = "برجاء اختيار الادارة الصحية"; lblCivil.BackColor = System.Drawing.Color.Red; return false; } if (drpLocation.SelectedValue == "4" && drpGov.SelectedValue == "-1") { lblMsg.Text = "برجاء اختيار مديرية الصحة"; lblGov.BackColor = System.Drawing.Color.Red; return false; } else if (drpLocation.SelectedValue == "4" && drpCivil.SelectedValue == "-1") { lblMsg.Text = "برجاء اختيار الادارة الصحية"; lblCivil.BackColor = System.Drawing.Color.Red; return false; } else if (drpLocation.SelectedValue == "4" && drpHealthOffice.SelectedValue== "-1") { lblMsg.Text = "برجاء اختيار مكتب الصحة"; lblOffice.BackColor = System.Drawing.Color.Red; return false; } health_office hoObject = new health_office(); if (Session["Edit"] != null) { // update case if (txtIP.Text == OldIP) { return true; } } DataTable dtHodetails = hoObject.GetDefaultHealthOfficeData(txtIP.Text); if (dtHodetails.Rows.Count > 0) { string message=""; if (dtHodetails.Rows[0]["LocationTypeID"].ToString() == "4") { message = "رقم تعريف الحاسب موجود بالفعل فى" + "<br>" + " مديرية:" + dtHodetails.Rows[0]["GoveName"].ToString() + "<br> " + " ادارة:" + dtHodetails.Rows[0]["CivilName"].ToString() + "<br> " + " مكتب صحة:" + dtHodetails.Rows[0]["HEALTHDESCR"].ToString(); } else if (dtHodetails.Rows[0]["LocationTypeID"].ToString() == "3") { message = "رقم تعريف الحاسب موجود بالفعل فى مديرية:" + dtHodetails.Rows[0]["GoveName"].ToString() + "<br> " + " ادارة:" + dtHodetails.Rows[0]["CivilName"].ToString(); } else if (dtHodetails.Rows[0]["LocationTypeID"].ToString() == "2") { message = "رقم تعريف الحاسب موجود بالفعل فى مديرية:" + dtHodetails.Rows[0]["GoveName"].ToString(); } else if (dtHodetails.Rows[0]["LocationTypeID"].ToString() == "1") { message = "رقم تعريف الحاسب موجود بالفعل فى ديوان عام وزارة الصحة"; } lblMsg.Text = message; return false; } return true; }
private void LoadHealthOfficeByCivil() { health_office healthOffice = new health_office(); healthOffice.Where.CIVILCD.Value = drpCivil.SelectedValue; healthOffice.Query.Load(); drpHealthOffice.DataTextField = health_office.ColumnNames.HEALTHDESCR; drpHealthOffice.DataValueField = health_office.ColumnNames.HEALTHCD; drpHealthOffice.DataSource = healthOffice.DefaultView; drpHealthOffice.DataBind(); drpHealthOffice.Items.Insert(0, new ListItem("اختر مكتب", "-1")); }
private void LoadAllHealthOffice() { health_office healthOffice = new health_office(); healthOffice.LoadAll(); drpHealthOffice.DataTextField = health_office.ColumnNames.HEALTHDESCR; drpHealthOffice.DataValueField = health_office.ColumnNames.HEALTHCD; drpHealthOffice.DataSource = healthOffice.DefaultView; drpHealthOffice.DataBind(); drpHealthOffice.Items.Insert(0, new ListItem("اختر مكتب", "-1")); }
private bool LogicValidation() { #region Check If Death Case Exist Dead objDead = new Dead(); if (DeadEventIDParameter != null) { // update case //now we want to be sure that we validating in not Unknown case. if (!IsLostCase || (IsLostCase && (rdTypeList.SelectedValue != "1" && rdTypeList.SelectedValue != "2"))) { if ((UcDeathInfo2.EventDeadNID != currentDeadData.NationalIden) || ( UcDeathInfo2.EventDeadFristName != currentDeadData.FirstName || UcDeathInfo2.EventDeadFatherName != currentDeadData.FatherName || UcDeathInfo2.EventDeadFamilyName != currentDeadData.FamilyName || UcDeathInfo2.EventDeadTitle != currentDeadData.SureName ) ) { if (objDead.IsDeathCaseExist(UcDeathInfo2.EventDeadNID, UcDeathInfo2.EventDeadFristName , UcDeathInfo2.EventDeadFatherName, UcDeathInfo2.EventDeadFamilyName, UcDeathInfo2.EventDeadTitle, currentDeadData._oldRegDate)) { MHOCommon.ShowMessage("بيانات المتوفى موجودة من قبل برجاء مراجعة البيانات و اعادة المحاولة", this.Page); return false; } } } } else { // add new case. // we want to be sure that we validating in not Unknown case. if (!IsLostCase || (IsLostCase && (rdTypeList.SelectedValue != "1" && rdTypeList.SelectedValue != "2"))) { if (objDead.IsDeathCaseExist(UcDeathInfo2.EventDeadNID, UcDeathInfo2.EventDeadFristName , UcDeathInfo2.EventDeadFatherName, UcDeathInfo2.EventDeadFamilyName, UcDeathInfo2.EventDeadTitle, "")) { MHOCommon.ShowMessage("بيانات المتوفى موجودة من قبل برجاء مراجعة البيانات و اعادة المحاولة", this.Page); return false; } } } #endregion #region Check for Date versus National IDs if (UcDeathInfo2.EventDeadNID.Trim() != "0" && UcDeathInfo2.EventDeadNID.Trim().Length == 14) { // Dead has National ID if (MHOCommon.GetDateFromNID(UcDeathInfo2.EventDeadNID) != DateTime.Parse(UcDeathInfo2.EventDeadBirthDate)) { MHOCommon.ShowMessage("تاريخ ميلاد المتوفى يجب ان يتوافق مع رقمه القومى", this.Page); return false; } if (UcMotherInfo2.ParentNID.Trim() != "0" && UcMotherInfo2.ParentNID.Trim().Length == 14) { if (MHOCommon.GetDateFromNID(UcDeathInfo2.EventDeadNID) <= MHOCommon.GetDateFromNID(UcMotherInfo2.ParentNID)) { MHOCommon.ShowMessage("سن المتوفى لابد ان يكون اصغر من سن الام", this.Page); return false; } } } try { DateTime.Parse(UcDeathInfo2.EventDeadBirthDate.Trim()); } catch (Exception ex) { MHOCommon.ShowMessage("خطأ فى تاريخ ميلاد المتوفى", this.Page); return false; } try { DateTime.Parse(UcGeneralDeathInfo1.EventDeadDieDate); } catch (Exception ex) { MHOCommon.ShowMessage("خطأ فى تاريخ الوفاة", this.Page); return false; } #endregion if (!IsLostCase && DeadEventIDParameter == null) { //if (DateTime.Today.AddDays(-3) > DateTime.Parse(UcGeneralDeathInfo1.EventDeadDieDate)) //{ // MHOCommon.ShowMessage("تاريخ تسجيل الوفاة غير صحيح", this.Page); // return false; //} } if (DateTime.Parse(UcDeathInfo2.EventDeadBirthDate) > DateTime.Today) { MHOCommon.ShowMessage("تاريخ ميلاد المتوفى غير صحيح", this.Page); return false; } if (UcDeathInfo2.EventDeadNID.Trim() == UcNotifierInfo2.NotifierNID.Trim()) { MHOCommon.ShowMessage("الرقم القومى للمبلغ لا يمكن ان يكون نفس الرقم القومى للمتوفى", this.Page); return false; } if (UcDeathInfo2.EventDeadNID.Trim() == UcMotherInfo2.ParentNID.Trim() && UcMotherInfo2.ParentNID.Trim() != "0") { MHOCommon.ShowMessage("الرقم القومى للام لا يمكن ان يكون نفس الرقم القومى للمتوفى", this.Page); return false; } if (DateTime.Parse(UcDeathInfo2.EventDeadBirthDate) > DateTime.Parse(UcGeneralDeathInfo1.EventDeadDieDate)) { MHOCommon.ShowMessage("تاريخ الوفاة لابد ان يكون بعد تاريخ الميلاد", this.Page); return false; } if (DateTime.Parse(UcGeneralDeathInfo1.EventDeadDieDate).Date > DateTime.Today.Date) { MHOCommon.ShowMessage("تاريخ وفاة المتوفى غير صحيح", this.Page); return false; } if ((UcMotherInfo2.ParentNID == UcNotifierInfo2.NotifierNID) && UcNotifierInfo2.NotifierRelation == 4) { MHOCommon.ShowMessage("لقد قمت بادخال الرقم القومى للام فى بيانات المبلغ فى حين ان المبلغ هو الاخت", this.Page); return false; } if ((UcMotherInfo2.ParentNID == UcNotifierInfo2.NotifierNID) && UcNotifierInfo2.NotifierRelation != 2) { MHOCommon.ShowMessage("لقد قمت بادخال الرقم القومى للام فى بيانات المبلغ فى حين ان المبلغ ليس الأم", this.Page); return false; } if ((DateTime.Now.Year - DateTime.Parse(UcDeathInfo2.EventDeadBirthDate).Year < 18 ) && UcDeathInfo2.EventDeadCardType == 2) { MHOCommon.ShowMessage("نوع البطاقة غير متوافق مع سن المتوفى", this.Page); return false; } if (!IsLostCase && !MHOCommon.ValidateNationalIDInput(UcDeathInfo2.EventDeadNID, UcDeathInfo2.EventDeadGender != 1)) { MHOCommon.ShowMessage(MHOCommon.NIDValidationMessage + "\\nبيانات المتوفى", this.Page); return false; } if (IsLostCase) { health_office objHealthOffice = new health_office(); if (DeadEventIDParameter != null) { // update case if (currentDescisionNo != DecisionControl1.DecisionNumber) { if (objHealthOffice.IsDecisionNumberExisit(DecisionControl1.DecisionNumber, MHOCommon.CurrentOrgID.Value, false)) { MHOCommon.ShowMessage("عفوا رقم القرار موجود من قبل", this.Page); return false; } } } else { if (objHealthOffice.IsDecisionNumberExisit(DecisionControl1.DecisionNumber, MHOCommon.CurrentOrgID.Value, false)) { MHOCommon.ShowMessage("عفوا رقم القرار موجود من قبل", this.Page); return false; } } if (rdTypeList.SelectedValue != "1") { if (DateTime.Today.AddYears(-1).Date > DateTime.Parse(UcGeneralDeathInfo1.EventDeadDieDate)) { MHOCommon.ShowMessage("تاريخ تسجيل الوفاة غير صحيح", this.Page); return false; } if (DecisionControl1.DecisionDate == null) { MHOCommon.ShowMessage("تاريخ القرار غير صحيح", this.Page); return false; } if (DecisionControl1.DecisionDate.Value.Date > DateTime.Today.Date) { MHOCommon.ShowMessage("تاريخ القرار غير صحيح", this.Page); return false; } if (DateTime.Parse(UcDeathInfo2.EventDeadBirthDate) > DateTime.Today) { MHOCommon.ShowMessage("تاريخ ميلاد المتوفى غير صحيح", this.Page); return false; } if (DateTime.Today.AddDays(-1).Date <= DateTime.Parse(UcGeneralDeathInfo1.EventDeadDieDate)) { MHOCommon.ShowMessage("تاريخ تسجيل الوفاة غير صحيح", this.Page); return false; } //TimeSpan dateDiff = UcBornInfo1.EventBirthDate.Subtract(DecisionControl1.DecisionDate); //if (dateDiff.Days < 15) if (DecisionControl1.DecisionDate.Value.AddDays(-1).Date < DateTime.Parse(UcGeneralDeathInfo1.EventDeadDieDate) || DateTime.Parse(UcDeathInfo2.EventDeadBirthDate) > DateTime.Parse(UcGeneralDeathInfo1.EventDeadDieDate)) { MHOCommon.ShowMessage("تاريخ القرار غير صحيح", this.Page); return false; } } else { if (DecisionControl1.DecisionDate == null) { MHOCommon.ShowMessage("تاريخ القرار غير صحيح", this.Page); return false; } // مجهول الهوية if (DateTime.Parse(UcDeathInfo2.EventDeadBirthDate).Date > DateTime.Today.Date) { MHOCommon.ShowMessage("تاريخ ميلاد المتوفى غير صحيح", this.Page); return false; } if (DateTime.Parse(UcGeneralDeathInfo1.EventDeadDieDate).Date > DateTime.Today.Date) { MHOCommon.ShowMessage("تاريخ وفاة المتوفى غير صحيح", this.Page); return false; } if (DecisionControl1.DecisionDate.Value.Date > DateTime.Today.Date) { MHOCommon.ShowMessage("تاريخ القرار غير صحيح", this.Page); return false; } TimeSpan dateDiff = DateTime.Parse(UcGeneralDeathInfo1.EventDeadDieDate).Subtract(DecisionControl1.DecisionDate.Value); if (dateDiff.Days > 0) { MHOCommon.ShowMessage("تاريخ القرار غير صحيح", this.Page); return false; } } } return true; }
private void setCurrentUserInfo() { try { OrgUser Current = new OrgUser(); if (MHOCommon.CurrentLoggedUserID != null && MHOCommon.CurrentLoggedUserID != Guid.Empty) { Current.LoadByPrimaryKey(MHOCommon.CurrentLoggedUserID); uiTextBoxNotifierName.Text = Current.FirstName.Trim() + " " + Current.FatherName.Trim(); if (Current.GovId != 0) { uiDropDownListGov.SelectedValue = Current.GovId.ToString(); uiDropDownListGov.Enabled = false; uiDropDownListMachineGov.SelectedValue = Current.GovId.ToString(); uiDropDownListMachineGov.Enabled = false; /*********************/ if (uiDropDownListGov.SelectedIndex != 0) { CIVIL_OFFICE pol = new CIVIL_OFFICE(); pol.Where.FK_GOVCD.Value = short.Parse(uiDropDownListGov.SelectedValue); pol.Where.FK_GOVCD.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal; pol.Query.AddOrderBy(CIVIL_OFFICE.ColumnNames.DESCR, MyGeneration.dOOdads.WhereParameter.Dir.ASC); pol.Query.Load(); uiDropDownListCivil.DataSource = pol.DefaultView; uiDropDownListCivil.DataTextField = POLICE_STATION.ColumnNames.DESCR; uiDropDownListCivil.DataValueField = POLICE_STATION.ColumnNames.CD; uiDropDownListCivil.DataBind(); uiDropDownListCivil.Items.Insert(0, new ListItem("---", "0")); uiDropDownListCivil.SelectedIndex = 0; } if (uiDropDownListMachineGov.SelectedIndex != 0) { CIVIL_OFFICE pol = new CIVIL_OFFICE(); pol.Where.FK_GOVCD.Value = short.Parse(uiDropDownListMachineGov.SelectedValue); pol.Where.FK_GOVCD.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal; pol.Query.AddOrderBy(CIVIL_OFFICE.ColumnNames.DESCR, MyGeneration.dOOdads.WhereParameter.Dir.ASC); pol.Query.Load(); uiDropDownListMachineCivil.DataSource = pol.DefaultView; uiDropDownListMachineCivil.DataTextField = POLICE_STATION.ColumnNames.DESCR; uiDropDownListMachineCivil.DataValueField = POLICE_STATION.ColumnNames.CD; uiDropDownListMachineCivil.DataBind(); uiDropDownListMachineCivil.Items.Insert(0, new ListItem("---", "0")); uiDropDownListMachineCivil.SelectedIndex = 0; } if (Current.CivilId != 0) { uiDropDownListCivil.SelectedValue = Current.CivilId.ToString(); uiDropDownListCivil.Enabled = false; uiDropDownListMachineCivil.SelectedValue = Current.CivilId.ToString(); uiDropDownListMachineCivil.Enabled = false; if (uiDropDownListCivil.SelectedIndex != 0 && uiDropDownListGov.SelectedIndex != 0) { health_office obj = new health_office(); uiDropDownListHealthOffice.DataSource = obj.GetHealthOfficeDetails(short.Parse(uiDropDownListGov.SelectedValue), short.Parse(uiDropDownListCivil.SelectedValue)).DefaultView; uiDropDownListHealthOffice.DataTextField = health_office.ColumnNames.HEALTHDESCR; uiDropDownListHealthOffice.DataValueField = health_office.ColumnNames.HEALTHCD; uiDropDownListHealthOffice.DataBind(); uiDropDownListHealthOffice.Items.Insert(0, new ListItem("---", "0")); uiDropDownListHealthOffice.SelectedIndex = 0; } if (uiDropDownListMachineGov.SelectedIndex != 0 && uiDropDownListMachineCivil.SelectedIndex != 0) { health_office obj = new health_office(); uiDropDownListMachineHealthOffice.DataSource = obj.GetHealthOfficeDetails(short.Parse(uiDropDownListMachineGov.SelectedValue), short.Parse(uiDropDownListMachineCivil.SelectedValue)).DefaultView; uiDropDownListMachineHealthOffice.DataTextField = health_office.ColumnNames.HEALTHDESCR; uiDropDownListMachineHealthOffice.DataValueField = health_office.ColumnNames.HEALTHCD; uiDropDownListMachineHealthOffice.DataBind(); uiDropDownListMachineHealthOffice.Items.Insert(0, new ListItem("---", "0")); uiDropDownListMachineHealthOffice.SelectedIndex = 0; } } } /************************/ } } catch (Exception) { // gives error when log out } }
public static void WriteQrsDead(Guid DeadEventID) { Dead deadCase = new Dead(); deadCase.LoadByPrimaryKey(DeadEventID); MHO.BLL.AREA area = new AREA(); area.LoadByPrimaryKey(deadCase.DeadArea); MHO.BLL.POLICE_STATION ps = new POLICE_STATION(); ps.LoadByPrimaryKey(deadCase.DeadSection); MHO.BLL.health_office ho = new health_office(); ho.LoadByPrimaryKey(deadCase.OrgID); NATIONALITY MotherNath = new NATIONALITY(); MotherNath.LoadByPrimaryKey(deadCase.DeadMotherNationality); string gender = (deadCase.DeadGender == 1) ? "ذكر " : "أنثى"; string deadMartialStatus = "اعزب", deadReligion = "مسلم", motherReligion = "مسلم", InformRelation = "الأب"; switch (deadCase.DeadMartialStatus) { case 1: deadMartialStatus = "اعزب"; break; case 2: deadMartialStatus = "متزوج"; break; case 3: deadMartialStatus = "مطلق"; break; case 4: deadMartialStatus = "أرمل"; break; } switch (deadCase.DeadMotherReligion) { case 1: motherReligion = "مسلم"; break; case 2: motherReligion = "مسيحى"; break; case 3: motherReligion = "يهودى"; break; } switch (deadCase.DeadReligion) { case 1: deadReligion = "مسلم"; break; case 2: deadReligion = "مسيحى"; break; case 3: deadReligion = "يهودى"; break; } switch (deadCase.InformerRelation) { case 1: InformRelation = "الاب"; break; case 2: InformRelation = "الام"; break; case 3: InformRelation = "الاخ"; break; case 4: InformRelation = "الاخت"; break; case 5: InformRelation = "العم"; break; case 6: InformRelation = "الخال"; break; case 7: InformRelation = "الجد"; break; case 8: InformRelation = "اخري"; break; case 9: InformRelation = "الابن"; break; case 10: InformRelation = "الابنة"; break; } if (deadCase.RowCount > 0) { QrEncoder encoder = new QrEncoder(ErrorCorrectionLevel.M); QrCode qrCode; StringBuilder builder = new StringBuilder(); builder.AppendLine(deadCase.DeadNID); builder.AppendLine("," + deadCase.DeadFirstName + " " + deadCase.DeadFatherName + " " + deadCase.DeadGrandName + " " + deadCase.DeadFamilyName); builder.AppendLine("," + deadCase.DeadBirthDate.ToShortDateString()); builder.AppendLine("," + deadReligion); builder.AppendLine("," + deadMartialStatus); builder.AppendLine("," + gender); builder.AppendLine("," + deadCase.AddressNo + "," + deadCase.AddressStreet + "," + deadCase.AddressFeatured); builder.AppendLine("," + ps.DESCR); builder.AppendLine("," + area.DESCR); builder.AppendLine("," + deadCase.DeadDieDate.ToShortDateString() + " - " + deadCase.DeadDieHour + ":" + deadCase.DeadDieMin); builder.AppendLine("," + deadCase.DiePlace + "," + deadCase.DiePlaceDescription); builder.AppendLine("," + deadCase.DeadMotherFirstName + " " + deadCase.DeadMotherSecondName + " " + deadCase.DeadMotherFamilyName + " " + deadCase.DaadMotherSureName); builder.AppendLine("," + MotherNath.DESCR); builder.AppendLine("," + motherReligion); builder.AppendLine("," + deadCase.DeadMotherJob); builder.AppendLine("," + deadCase.DeadMotherNID); builder.AppendLine("," + deadCase.InformerFirstName + " " + deadCase.InformerSecondName); builder.AppendLine("," + InformRelation); builder.AppendLine("," + deadCase.InformerNID); builder.AppendLine("," + deadCase.InformerPhone); encoder.TryEncode(builder.ToString(), out qrCode); GraphicsRenderer gRenderer = new GraphicsRenderer( new FixedModuleSize(2, QuietZoneModules.Zero), Brushes.Black, Brushes.White); MemoryStream ms = new MemoryStream(); gRenderer.WriteToStream(qrCode.Matrix, ImageFormat.Bmp, ms); try { SqlCommand cmd = new SqlCommand(); SqlConnection conn = new SqlConnection(ConfigurationManager.AppSettings["dbConnection"].ToString()); cmd.CommandText = "insert into QRSDead (ID,QrCode) values (@ID,@Picture)"; cmd.Parameters.Add("@ID", System.Data.SqlDbType.UniqueIdentifier); cmd.Parameters.Add("@Picture", System.Data.SqlDbType.VarBinary); cmd.Connection = conn; cmd.Parameters["@ID"].Value = DeadEventID; cmd.Parameters["@Picture"].Value = ms.ToArray(); conn.Open(); cmd.ExecuteNonQuery(); conn.Close(); } catch (Exception ex) { } } }
public static void WriteQrsBorn(Guid BornEventID) { Born bornCase = new Born(); bornCase.LoadByPrimaryKey(BornEventID); MHO.BLL.AREA area = new AREA(); area.LoadByPrimaryKey(bornCase.BornArea); MHO.BLL.POLICE_STATION ps = new POLICE_STATION(); ps.LoadByPrimaryKey(bornCase.BornSection); MHO.BLL.health_office ho = new health_office(); ho.LoadByPrimaryKey(bornCase.OrgID); NATIONALITY FatherNath = new NATIONALITY(); FatherNath.LoadByPrimaryKey(bornCase.FatherNationality); NATIONALITY MotherNath = new NATIONALITY(); MotherNath.LoadByPrimaryKey(bornCase.MotherNationality); string gender = (bornCase.BornGender == 1) ? "ذكر " : "أنثى"; string fatherReligion = "مسلم", motherReligion = "مسلم", InformRelation = "الأب"; switch (bornCase.FatherReligion) { case 1: fatherReligion = "مسلم"; break; case 2: fatherReligion = "مسيحى"; break; case 3: fatherReligion = "يهودى"; break; } switch (bornCase.MotherReligion) { case 1: motherReligion = "مسلم"; break; case 2: motherReligion = "مسيحى"; break; case 3: motherReligion = "يهودى"; break; } switch (bornCase.InformerRelation) { case 1: InformRelation = "الاب"; break; case 2: InformRelation = "الام"; break; case 3: InformRelation = "الاخ"; break; case 4: InformRelation = "الاخت"; break; case 5: InformRelation = "العم"; break; case 6: InformRelation = "الخال"; break; case 7: InformRelation = "الجد"; break; case 8: InformRelation = "اخري"; break; case 9: InformRelation = "الابن"; break; case 10: InformRelation = "الابنة"; break; } if (bornCase.RowCount > 0) { QrEncoder encoder = new QrEncoder(ErrorCorrectionLevel.M); QrCode qrCode; StringBuilder builder = new StringBuilder(); builder.AppendLine(bornCase.BornName + " " + bornCase.FirstFatherName + " " + bornCase.SecondFatherName + " " + bornCase.FatherSureName); builder.AppendLine("," + ps.DESCR); builder.AppendLine("," + area.DESCR); builder.AppendLine("," + gender); builder.AppendLine("," + bornCase.BirthDate.ToShortDateString() + " " + bornCase.BirthDate.Minute.ToString() + ":" + bornCase.BirthDate.Hour.ToString()); builder.AppendLine("," + bornCase.FirstFatherName + " " + bornCase.SecondFatherName + " " + bornCase.FamilyFatherName + " " + bornCase.FatherSureName); builder.AppendLine("," + FatherNath.DESCR); builder.AppendLine("," + fatherReligion); builder.AppendLine(","); builder.AppendLine("," + bornCase.FatherJob); builder.AppendLine("," + bornCase.FatherNID); builder.AppendLine("," + bornCase.FirstMotherName + " " + bornCase.SecondMotherName + " " + bornCase.FamilyMotherName + " " + bornCase.MotherSureName); builder.AppendLine("," + MotherNath.DESCR); builder.AppendLine("," + motherReligion); builder.AppendLine(","); builder.AppendLine("," + bornCase.MotherJob); builder.AppendLine("," + bornCase.MotherNID); builder.AppendLine("," + bornCase.InformerFirstName + " " + bornCase.InformerSecondName); builder.AppendLine("," + InformRelation); builder.AppendLine("," + bornCase.InformerNID); builder.AppendLine("," + bornCase.InformerPhone); encoder.TryEncode(builder.ToString(), out qrCode); GraphicsRenderer gRenderer = new GraphicsRenderer( new FixedModuleSize(2, QuietZoneModules.Zero), Brushes.Black, Brushes.White); MemoryStream ms = new MemoryStream(); gRenderer.WriteToStream(qrCode.Matrix, ImageFormat.Bmp, ms); try { SqlCommand cmd = new SqlCommand(); SqlConnection conn = new SqlConnection(ConfigurationManager.AppSettings["dbConnection"].ToString()); cmd.CommandText = "insert into QRSBorn (ID,QrCode) values (@ID,@Picture)"; cmd.Parameters.Add("@ID", System.Data.SqlDbType.UniqueIdentifier); cmd.Parameters.Add("@Picture", System.Data.SqlDbType.VarBinary); cmd.Connection = conn; cmd.Parameters["@ID"].Value = BornEventID; cmd.Parameters["@Picture"].Value = ms.ToArray(); conn.Open(); cmd.ExecuteNonQuery(); conn.Close(); } catch (Exception ex) { } } }
/// <summary> /// Load current organization data through current org ID /// </summary> /// <param name="ip"></param> public static bool LoadCurrentOrgData(string ip) { health_office objHealth = new health_office(); DataTable dtHealth = objHealth.GetDefaultHealthOfficeData(ip); if (dtHealth.Rows.Count > 0) { if (int.Parse(dtHealth.Rows[0]["LocationTypeId"].ToString()) == 1) { // return Ministry of health as title. UnitDisplayTitle = dtHealth.Rows[0]["descr"].ToString(); return true; } if (int.Parse(dtHealth.Rows[0]["LocationTypeId"].ToString()) == 2) { // return Ministry of health as title. UnitDisplayTitle = dtHealth.Rows[0]["descr"].ToString() + " " + dtHealth.Rows[0]["GoveName"].ToString(); CurrentOrgGovID = short.Parse(dtHealth.Rows[0]["GovId"].ToString()); return true; } if (int.Parse(dtHealth.Rows[0]["LocationTypeId"].ToString()) == 3) { // return Ministry of health as title. UnitDisplayTitle = dtHealth.Rows[0]["descr"].ToString() + " " + dtHealth.Rows[0]["CivilName"].ToString(); return true; } if (int.Parse(dtHealth.Rows[0]["LocationTypeId"].ToString()) == 4) { CurrentOrgID = int.Parse(dtHealth.Rows[0]["HealthOfficeId"].ToString()); CurrentOrgName = dtHealth.Rows[0]["HEALTHDESCR"].ToString(); CurrentOrgGovID = short.Parse(dtHealth.Rows[0]["GovId"].ToString()); CurrentOrgGovName = dtHealth.Rows[0]["GoveName"].ToString(); if (!string.IsNullOrEmpty(dtHealth.Rows[0]["PoliceID"].ToString())) { CurrentOrgPoliceStationID = int.Parse(dtHealth.Rows[0]["PoliceID"].ToString()); CurrentOrgPoliceStationName = dtHealth.Rows[0]["PoliceName"].ToString(); } if (!string.IsNullOrEmpty(dtHealth.Rows[0]["AreaID"].ToString())) { CurrentOrgAreaID = int.Parse(dtHealth.Rows[0]["AreaID"].ToString()); CurrentOrgAreaName = dtHealth.Rows[0]["AreaName"].ToString(); } UnitDisplayTitle = UnitDisplayTitle = dtHealth.Rows[0]["descr"].ToString() + " " + dtHealth.Rows[0]["HEALTHDESCR"].ToString(); } return true; } else { return false; } }
private void GetLogicValidation() { health_office hoObject = new health_office(); DataTable dtHodetails = hoObject.GetDefaultHealthOfficeData(MHOCommon.CurrentOrgIP); if (dtHodetails.Rows.Count > 0) { if (dtHodetails.Rows[0]["LocationTypeID"].ToString() == "4") { drpGov.SelectedIndex = drpGov.Items.IndexOf(drpGov.Items.FindByText(dtHodetails.Rows[0]["GoveName"].ToString())); drpGov_SelectedIndexChanged(null,null); drpCivil.SelectedIndex = drpCivil.Items.IndexOf( drpCivil.Items.FindByText(dtHodetails.Rows[0]["CivilName"].ToString())); drpCivil_SelectedIndexChanged(null,null); drpHealthOffice.SelectedIndex = drpHealthOffice.Items.IndexOf(drpHealthOffice.Items.FindByText(dtHodetails.Rows[0]["HEALTHDESCR"].ToString())); drpGov.Enabled = false; drpCivil.Enabled = false; drpHealthOffice.Enabled = false; } else if (dtHodetails.Rows[0]["LocationTypeID"].ToString() == "3") { drpGov.SelectedIndex = drpGov.Items.IndexOf(drpGov.Items.FindByText(dtHodetails.Rows[0]["GoveName"].ToString())); drpGov_SelectedIndexChanged(null,null); drpCivil.SelectedIndex = drpCivil.Items.IndexOf( drpCivil.Items.FindByText(dtHodetails.Rows[0]["CivilName"].ToString())); drpCivil_SelectedIndexChanged(null,null); drpGov.Enabled = false; drpCivil.Enabled = false; } else if (dtHodetails.Rows[0]["LocationTypeID"].ToString() == "2") { drpGov.SelectedIndex = drpGov.Items.IndexOf(drpGov.Items.FindByText(dtHodetails.Rows[0]["GoveName"].ToString())); drpGov_SelectedIndexChanged(null,null); drpCivil.SelectedIndex = drpCivil.Items.IndexOf( drpCivil.Items.FindByText(dtHodetails.Rows[0]["CivilName"].ToString())); drpCivil_SelectedIndexChanged(null,null); drpGov.Enabled = false; } else if (dtHodetails.Rows[0]["LocationTypeID"].ToString() == "1") { // TO DO } } }
private void Filter() { health_office obj = new health_office(); grdGovernate.DataSource = obj.GetHealthOfficeDetails(short.Parse(drpGove.SelectedValue), short.Parse(drpCivilOffice.SelectedValue)).DefaultView; grdGovernate.DataBind(); }
/// <summary> /// Link Gove code click handler /// to allow edit this gov /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void lnkDelete_Click(object sender, EventArgs e) { LinkButton lnk = (LinkButton)sender; health_office delarea = new health_office(); delarea.LoadByPrimaryKey(int.Parse(lnk.CommandArgument)); delarea.MarkAsDeleted(); delarea.Save(); Filter(); }
/// <summary> /// Link Gove code click handler /// to allow edit this gov /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void lnkAreaCode_Click(object sender, EventArgs e) { LinkButton lnk = (LinkButton)sender; health_office obj = new health_office(); obj.LoadByPrimaryKey(int.Parse(lnk.Text)); txtHealthOfficeCode.Text = lnk.Text; txtHealthOfficeName.Text = obj.HEALTHDESCR; if (obj.s_IsTown != "") chkIsTown.Checked = obj.IsTown; else chkIsTown.Checked = false; //drpGove.SelectedIndex = drpGove.Items.IndexOf(drpGove.Items.FindByValue(obj.GOVCD.ToString())); // drpCivilOffice.SelectedIndex = drpCivilOffice.Items.IndexOf(drpCivilOffice.Items.FindByValue(obj.CIVILCD.ToString())); drpGove.Enabled = false; drpCivilOffice.Enabled = false; if (obj.s_POLICECD != "") drpPoliceStation.SelectedIndex = drpPoliceStation.Items.IndexOf( drpPoliceStation.Items.FindByValue(obj.POLICECD.ToString())); else drpPoliceStation.SelectedIndex = 0; if (obj.s_AREACD != "") { LoadArea(); dropArea.SelectedIndex = dropArea.Items.IndexOf( dropArea.Items.FindByValue(obj.AREACD.ToString())); } else dropArea.SelectedIndex = 0; btnSave.Text = "تعديل"; txtHealthOfficeCode.ReadOnly = true; }
private bool logicValidation() { if (UcFatherInfo2.ParentNID == "0") { MHOCommon.ShowMessage("الرقم القومى للأب غير صحيح", this.Page); return false; } if (UcNotifierInfo1.NotifierNID == "0") { MHOCommon.ShowMessage("الرقم القومى للمبلغ غير صحيح", this.Page); return false; } if (!MHOCommon.ValidateNationalIDInput(UcFatherInfo2.ParentNID, false)) { MHOCommon.ShowMessage(MHOCommon.NIDValidationMessage + "\\nبيانات الأب", this.Page); return false; } if (!MHOCommon.ValidateNationalIDInput(UcMotherInfo2.ParentNID, true)) { MHOCommon.ShowMessage(MHOCommon.NIDValidationMessage + "\\nبيانات الأم", this.Page); return false; } if (UcMotherInfo2.ParentNID == "0") { MHOCommon.ShowMessage("الرقم القومى للأم غير صحيح", this.Page); return false; } if (UcBornInfo1.EventBirthDate == null) { MHOCommon.ShowMessage("خطأ فى تاريخ او وقت الميلاد", this.Page); return false; } if ((UcFatherInfo2.ParentNID == UcNotifierInfo1.NotifierNID) && UcNotifierInfo1.NotifierRelation != 1) { MHOCommon.ShowMessage("لقد ادخلت الرقم القومى للاب فى بيانات المبلغ فى حين ان المبلغ ليس الاب", this.Page); return false; } if ((UcMotherInfo2.ParentNID == UcNotifierInfo1.NotifierNID) && UcNotifierInfo1.NotifierRelation != 2) { MHOCommon.ShowMessage("لقد ادخلت الرقم القومى للأم فى بيانات المبلغ فى حين ان المبلغ ليس الأم", this.Page); return false; } if (UcMotherInfo2.ParentNID == UcFatherInfo2.ParentNID) { MHOCommon.ShowMessage("خطأ . الرقم القومى للأب والأم متطابقين", this.Page); return false; } #region Check For Repeated Birth cases. Born objBorn = new Born(); if (BornEventIdParameter != null) { // Update case. if (UcBornInfo1.EventBirthDate.ToString() != currentBornData.BirthDateTime || UcBornInfo1.EventChildName != currentBornData.BornName || UcFatherInfo2.ParentNID != currentBornData.FatherNationalID || UcMotherInfo2.ParentNID != currentBornData.MotherNationalID) { if (objBorn.IsBornCaseExist(UcFatherInfo2.ParentNID, UcMotherInfo2.ParentNID, UcBornInfo1.EventChildName, UcBornInfo1.EventBirthDate.Value.ToString("yyyy-MM-dd HH:mm"), Convert.ToDateTime(currentBornData.BornRegDate).ToString("yyyy-MM-dd"))) { MHOCommon.ShowMessage("بيانات المولود موجودة من قبل برجاء مراجعة البيانات و اعادة المحاولة", this.Page); return false; } } } else { // Add Case if (objBorn.IsBornCaseExist(UcFatherInfo2.ParentNID, UcMotherInfo2.ParentNID, UcBornInfo1.EventChildName, UcBornInfo1.EventBirthDate.Value.ToString("yyyy-MM-dd HH:mm"), "")) { MHOCommon.ShowMessage("بيانات المولود موجودة من قبل برجاء مراجعة البيانات و اعادة المحاولة", this.Page); return false; } } #endregion if (!IsLostCase) { if (UcBornInfo1.EventBirthDate.Value.Date > DateTime.Today.Date) { MHOCommon.ShowMessage("تاريخ الميلاد يجب ان يكون اقل من او يساوى تاريخ اليوم", this.Page); return false; } if (DateTime.Today.AddDays(-15) >= UcBornInfo1.EventBirthDate) { MHOCommon.ShowMessage("تاريخ تسجيل الميلاد يجب ان لا يزيد عن 15 يوم من تاريخ الميلاد", this.Page); return false; } } if (IsLostCase) { if (DecisionControl1.DecisionDate == null) { MHOCommon.ShowMessage("تاريخ القرار غير صحيح", this.Page); return false; } health_office objHealthOffice = new health_office(); if (BornEventIdParameter != null) { // update case if (currentDescisionNo != DecisionControl1.DecisionNumber) { if (objHealthOffice.IsDecisionNumberExisit(DecisionControl1.DecisionNumber,MHOCommon.CurrentOrgID.Value, true)) { MHOCommon.ShowMessage("عفوا رقم القرار موجود من قبل", this.Page); return false; } } } else { if (objHealthOffice.IsDecisionNumberExisit(DecisionControl1.DecisionNumber, MHOCommon.CurrentOrgID.Value, true)) { MHOCommon.ShowMessage("عفوا رقم القرار موجود من قبل", this.Page); return false; } } if (rdTypeList.SelectedValue != "1") { if (UcBornInfo1.EventBirthDate.Value.Date > DateTime.Today.Date) { MHOCommon.ShowMessage("تاريخ الميلاد يجب ان يكون اقل من او يساوى تاريخ اليوم", this.Page); return false; } if (DateTime.Today.AddYears(-1).Date > UcBornInfo1.EventBirthDate.Value.Date) { MHOCommon.ShowMessage("تاريخ تسجيل الميلاد غير صحيح", this.Page); return false; } if (DateTime.Today.AddDays(-15).Date <= UcBornInfo1.EventBirthDate.Value.Date) { MHOCommon.ShowMessage("تاريخ تسجيل الميلاد غير صحيح", this.Page); return false; } if (DecisionControl1.DecisionDate.Value.Date > DateTime.Today.Date) { MHOCommon.ShowMessage("تاريخ القرار غير صحيح", this.Page); return false; } //TimeSpan dateDiff = UcBornInfo1.EventBirthDate.Subtract(DecisionControl1.DecisionDate); //if (dateDiff.Days < 15) if (DecisionControl1.DecisionDate.Value.AddDays(-15).Date < UcBornInfo1.EventBirthDate.Value.Date) { MHOCommon.ShowMessage("تاريخ القرار غير صحيح", this.Page); return false; } } else { if (DecisionControl1.DecisionDate == null) { MHOCommon.ShowMessage("تاريخ القرار غير صحيح", this.Page); return false; } if (UcBornInfo1.EventBirthDate.Value.Date > DateTime.Today.Date) { MHOCommon.ShowMessage("تاريخ الميلاد يجب ان يكون اقل من او يساوى تاريخ اليوم", this.Page); return false; } TimeSpan dateDiff = UcBornInfo1.EventBirthDate.Value.Subtract(DecisionControl1.DecisionDate.Value); if (dateDiff.Days > 0) { MHOCommon.ShowMessage("تاريخ القرار غير صحيح", this.Page); return false; } if (DecisionControl1.DecisionDate.Value.Date > DateTime.Today.Date) { MHOCommon.ShowMessage("تاريخ القرار غير صحيح", this.Page); return false; } } } return true; }