/// <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; POLICE_STATION delpolice = new POLICE_STATION(); delpolice.LoadByPrimaryKey(int.Parse(lnk.CommandArgument)); delpolice.MarkAsDeleted(); delpolice.Save(); Filter(); }
/// <summary> /// Load Police station for selected governate /// </summary> public void LoadPoliceStation() { POLICE_STATION objPolice = new POLICE_STATION(); if (objPolice.LoadPoliceStationsForGoveID(drpState.SelectedValue)) { dropSection.DataSource = objPolice.DefaultView; dropSection.DataTextField = POLICE_STATION.ColumnNames.DESCR; dropSection.DataValueField = POLICE_STATION.ColumnNames.CD; dropSection.DataBind(); } }
protected void btnSave_Click(object sender, EventArgs e) { POLICE_STATION objpolice = new POLICE_STATION(); if (txtPoliceCode.ReadOnly) { try { // update case objpolice.LoadByPrimaryKey(int.Parse(txtPoliceCode.Text)); objpolice.DESCR = txtPoliceName.Text; objpolice.FK_GOVCD = short.Parse(drpGove.SelectedValue); objpolice.Save(); txtPoliceCode.ReadOnly = false; Filter(); //txtFilter.Text = ""; txtPoliceCode.Text = ""; txtPoliceName.Text = ""; btnSave.Text = "اضافة"; } catch { MHOCommon.ShowMessage("اسم القسم موجود من قبل داخل نفس المحافظة", this.Page); } } else { try { //Insert case objpolice.AddNew(); objpolice.CD = int.Parse(txtPoliceCode.Text); objpolice.DESCR = txtPoliceName.Text; objpolice.FK_GOVCD = short.Parse(drpGove.SelectedValue); objpolice.Save(); Filter(); //txtFilter.Text = ""; txtPoliceCode.Text = ""; txtPoliceName.Text = ""; } catch { string ss = "لقد حاولت ادخال كود موجود او اسم القسم موجود من قبل داخل نفس المحافظة"; MHOCommon.ShowMessage(ss, this.Page); } } }
/// <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; POLICE_STATION pol = new POLICE_STATION(); pol.Where.FK_GOVCD.Value = short.Parse(lnk.CommandArgument); pol.Where.FK_GOVCD.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal; CIVIL_OFFICE civ = new CIVIL_OFFICE(); civ.Where.FK_GOVCD.Value = short.Parse(lnk.CommandArgument); civ.Where.FK_GOVCD.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal; if (!pol.Query.Load() && !civ.Query.Load()) { GOVERNORATE delgov = new GOVERNORATE(); delgov.LoadByPrimaryKey(short.Parse(lnk.CommandArgument)); delgov.MarkAsDeleted(); delgov.Save(); Filter(""); } else { MHOCommon.ShowMessage("خطأ فى الحذف بسبب البيانات المرتبطة", this.Page); } }
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> /// 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; AREA area = new AREA(); area.Where.FK_POLICECD.Value = int.Parse(lnk.CommandArgument); area.Where.FK_POLICECD.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal; if (area.Query.Load()) { MHOCommon.ShowMessage("لا يمكن حذف هذا القسم نظرا لما له من بيانات مرتبطة", this.Page); } else { POLICE_STATION delpolice = new POLICE_STATION(); delpolice.LoadByPrimaryKey(int.Parse(lnk.CommandArgument)); delpolice.MarkAsDeleted(); delpolice.Save(); Filter(); } }
private void LoadPolice() { POLICE_STATION pol = new POLICE_STATION(); pol.Where.FK_GOVCD.Value = short.Parse(drpGove.SelectedValue); pol.Where.FK_GOVCD.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal; pol.Query.AddOrderBy(POLICE_STATION.ColumnNames.DESCR, MyGeneration.dOOdads.WhereParameter.Dir.ASC); pol.Query.Load(); drpPoliceStation.DataSource = pol.DefaultView; drpPoliceStation.DataTextField = POLICE_STATION.ColumnNames.DESCR; drpPoliceStation.DataValueField = POLICE_STATION.ColumnNames.CD; drpPoliceStation.DataBind(); }