/// <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;
     GOVERNORATE delgov = new GOVERNORATE();
     delgov.LoadByPrimaryKey(short.Parse(lnk.CommandArgument));
     delgov.MarkAsDeleted();
     delgov.Save();
     Filter("");
 }
 protected void btnSave_Click(object sender, EventArgs e)
 {
     GOVERNORATE objGovInsUpd = new GOVERNORATE();
     if (txtGoveName.Text.Trim() == "")
     {
         MHOCommon.ShowMessage("يجب ادخال اسم المحافظة", this.Page);
         return;
     }
     if (txtGoveCode.ReadOnly)
     {
         // update case
         objGovInsUpd.LoadByPrimaryKey(short.Parse(txtGoveCode.Text));
         objGovInsUpd.DESCR = txtGoveName.Text.Trim();
         objGovInsUpd.Save();
         txtGoveCode.ReadOnly = false;
         Filter("");
         //txtFilter.Text = "";
         txtGoveCode.Text = "";
         txtGoveName.Text = "";
         btnSave.Text = "اضافة";
     }
     else
     {
         try
         {
             //Insert case
             objGovInsUpd.AddNew();
             objGovInsUpd.CD = short.Parse(txtGoveCode.Text);
             objGovInsUpd.DESCR = txtGoveName.Text.Trim();
             objGovInsUpd.Save();
             Filter("");
             //txtFilter.Text = "";
             txtGoveCode.Text = "";
             txtGoveName.Text = "";
         }
         catch
         {
             MHOCommon.ShowMessage("لقد حاولت ادخال كود موجود اوهناك خطأ فى البيانات", this.Page);
         }
     }
 }
    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 void LoadGoves()
 {
     GOVERNORATE gov = new GOVERNORATE();
     gov.LoadAll();
     drpGov.DataSource = gov.DefaultView;
     drpGov.DataTextField = GOVERNORATE.ColumnNames.DESCR;
     drpGov.DataValueField = GOVERNORATE.ColumnNames.CD;
     drpGov.DataSource = gov.DefaultView;
     drpGov.DataBind();
     drpGov.Items.Insert(0, new ListItem("اختر مديرية", "-1"));
     drpGov.SelectedIndex = 0;
 }
    private void LoadDDls()
    {
        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;

        uiDropDownListPriority.DataSource = SqlHelper.ExecuteDataset(MHOCommon.ConnString, "GetPrioritys");
        uiDropDownListPriority.DataTextField = "PriorityName";
        uiDropDownListPriority.DataValueField = "PriorityID";
        uiDropDownListPriority.DataBind();
        uiDropDownListPriority.Items.Insert(0, new ListItem("---"));
        uiDropDownListPriority.SelectedIndex = 0;

        uiDropDownListStatus.DataSource = SqlHelper.ExecuteDataset(MHOCommon.ConnString, "GetStatuses");
        uiDropDownListStatus.DataTextField = "StatusName";
        uiDropDownListStatus.DataValueField = "StatusID";
        uiDropDownListStatus.DataBind();
        uiDropDownListStatus.Items.Insert(0, new ListItem("---"));
        uiDropDownListStatus.SelectedIndex = 0;
    }
    /// <summary>
    /// load lookup data.
    /// </summary>
    private void LoadLookups()
    {
        GOVERNORATE objGov = new GOVERNORATE();
        objGov.LoadAll();

        drpState.DataSource = objGov.DefaultView;
        drpState.DataTextField = GOVERNORATE.ColumnNames.DESCR;
        drpState.DataValueField = GOVERNORATE.ColumnNames.CD;
        drpState.DataBind();

        ListItem item = new ListItem("-----", "0");
        drpState.Items.Insert(0, item);
        drpSubSection.Items.Insert(0, item);
        dropSection.Items.Insert(0, item);
        drpState.SelectedIndex = 0;

        Jobs jobs = new Jobs ();
        jobs.LoadAll();

        uiDropDownListJob.DataSource = jobs.DefaultView;
        uiDropDownListJob.DataTextField = Jobs.ColumnNames.Name;
        uiDropDownListJob.DataValueField = Jobs.ColumnNames.Id;
        uiDropDownListJob.Items.Insert(0, item);
        uiDropDownListJob.DataBind();
    }
    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("---", "0"));
        uiDropDownListGov.SelectedValue = MHOCommon.CurrentOrgGovID.ToString();

        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;
        }

        uiDropDownListMachineGov.DataSource = gov.DefaultView;
        uiDropDownListMachineGov.DataTextField = GOVERNORATE.ColumnNames.DESCR;
        uiDropDownListMachineGov.DataValueField = GOVERNORATE.ColumnNames.CD;
        uiDropDownListMachineGov.DataBind();
        uiDropDownListMachineGov.Items.Insert(0, new ListItem("---", "0"));
        uiDropDownListMachineGov.SelectedIndex = 0;
    }
 private void LoadGoves()
 {
     GOVERNORATE gov = new GOVERNORATE();
     gov.LoadAll();
     drpGove.DataSource = gov.DefaultView;
     drpGove.DataTextField = GOVERNORATE.ColumnNames.DESCR;
     drpGove.DataValueField = GOVERNORATE.ColumnNames.CD;
     drpGove.DataBind();
     drpGove.SelectedIndex = 0;
 }
    private void Filter( string filter)
    {
        GOVERNORATE objGov = new GOVERNORATE();
        //objGov.Where.DESCR.Value = filter;
        //objGov.Where.DESCR.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal;

        objGov.Query.AddOrderBy(GOVERNORATE.ColumnNames.DESCR, MyGeneration.dOOdads.WhereParameter.Dir.ASC);
        objGov.Query.Load();
        grdGovernate.DataSource = objGov.DefaultView;
        grdGovernate.DataBind();
    }
 /// <summary>
 /// load lookup data.
 /// </summary>
 private void LoadLookups()
 {
     GOVERNORATE objGov = new GOVERNORATE();
     objGov.LoadAll();
 }
    /// <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);
        }
    }
Esempio n. 12
0
    /// <summary>
    /// load lookup data.
    /// </summary>
    private void LoadLookups()
    {
        GOVERNORATE objGov = new GOVERNORATE();
        objGov.LoadAll();

        drpState.DataSource = objGov.DefaultView;
        drpState.DataTextField = GOVERNORATE.ColumnNames.DESCR;
        drpState.DataValueField = GOVERNORATE.ColumnNames.CD;
        drpState.DataBind();
        drpState.SelectedIndex = 0;
    }