示例#1
0
    protected void GridViewOnPreRender(object sender, EventArgs e)
    {
        int cliendId = Util.ValidateInt(HiddenFieldClientId.Value, 0);
        int modelId = Util.ValidateInt(HiddenFieldModelId.Value, 0);
        GridViewRow gridViewRowData = GridView1.FooterRow;

        HiddenFieldTerritoryId.Value = CurrentUser.TerritoryId.ToString();

        DropDownListModel = (PolytexControls.DropDownList)(gridViewRowData.FindControl("DropDownListModel"));
        DropDownListClient = (PolytexControls.DropDownList)(gridViewRowData.FindControl("DropDownListClient"));
        TextBoxSerial = (PolytexControls.TextBox)(gridViewRowData.FindControl("TextBoxSerial"));
        TextBoxDescription = (PolytexControls.TextBox)(gridViewRowData.FindControl("TextBoxDescription"));
        TextBoxUnitIp = (PolytexControls.TextBox)(gridViewRowData.FindControl("TextBoxUnitIp"));
        TextBoxCameraIp = (PolytexControls.TextBox)(gridViewRowData.FindControl("TextBoxCameraIp"));
        TextBoxSWVersion = (PolytexControls.TextBox)(gridViewRowData.FindControl("TextBoxSWVersion"));

        TextBoxSerial.Text = HiddenFieldSerial.Value;
        TextBoxDescription.Text = HiddenFieldDescription.Value;
        TextBoxUnitIp.Text = HiddenFieldUnitIP.Value;
        TextBoxCameraIp.Text = HiddenFieldCameraIP.Value;
        TextBoxSWVersion.Text = HiddenFieldSWVersion.Value;

        if (cliendId > 0)
        {
            DropDownListClient.AspDropDownList.SelectedValue = cliendId.ToString();
        }
        if (modelId > 0)
        {
            DropDownListModel.AspDropDownList.SelectedValue = modelId.ToString();
        }
    }
示例#2
0
    protected void GridViewOnRowCommand(object sender, GridViewCommandEventArgs e)
    {
        string commandName = e.CommandName;

        //Response.Write(commandName);

        GridViewRow gridViewRowData;
        
        switch (commandName)
        {
            case "Insert":
                PolyGridViewUtils.ClearSetRows(GridView1, true, true);
                gridViewRowData = GridView1.FooterRow;

                Page.Validate("GridAddItem");
                if (Page.IsValid)
                {
                    SetInputControls(gridViewRowData);
                    systemUserId = Manage_Units.Insert(DropDownListClient.AspDropDownList.SelectedValue, DropDownListModel.AspDropDownList.SelectedValue, TextBoxSerial.Text.Trim(), TextBoxDescription.Text.Trim(), TextBoxUnitIp.Text.Trim(), TextBoxCameraIp.Text.Trim(), TextBoxSWVersion.Text.Trim());
                    PolyGridViewUtils.ClearSetRows(GridView1, true, true);
                    PolyGridViewUtils.SetSelectedRow(GridView1, systemUserId);
                    SetActionMessage(ActionMessage.InsertedSuccessfuly); 
                }
                else
                {
                    SetActionMessage(ActionMessage.InsertFailure);
                }

                break;
            case "UpdateUnits":
                gridViewRowData = GridView1.Rows[GridView1.EditIndex];

                systemUserId = Convert.ToInt32(e.CommandArgument);

                Page.Validate("GridEditItem");

                if (Page.IsValid)
                {
                    SetInputControls(gridViewRowData);

                    if (Manage_Units.Update(systemUserId, DropDownListClient.AspDropDownList.SelectedValue, DropDownListModel.AspDropDownList.SelectedValue, TextBoxSerial.Text.Trim(), TextBoxDescription.Text.Trim(), TextBoxUnitIp.Text.Trim(), TextBoxCameraIp.Text.Trim(), TextBoxSWVersion.Text.Trim()))
                    {
                        PolyGridViewUtils.SetSelectedRow(GridView1, systemUserId);
                        SetActionMessage(ActionMessage.UpdatedSuccessfuly);
                    }
                    else
                    {
                        SetActionMessage(ActionMessage.UpdateFailure);
                    }
                }
                else
                {
                    SetActionMessage(ActionMessage.UpdateFailure);
                }

                break;
            case "Enable":
                Manage_Units.Enable(Convert.ToInt32(e.CommandArgument), true);
                PolyGridViewUtils.SetSelectedRow(GridView1, e.CommandArgument);
                SetActionMessage(ActionMessage.EnabledSuccessfuly);
                break;
            case "Disable":
                Manage_Units.Disable(Convert.ToInt32(e.CommandArgument), false);
                if (CheckBoxIncludeDisabled.Checked)
                {
                    PolyGridViewUtils.SetSelectedRow(GridView1, e.CommandArgument);
                }
                else
                {
                    PolyGridViewUtils.SetSelectedRow(GridView1, 0);
                }
                SetActionMessage(ActionMessage.DisabledSuccessfuly);

                break;
            case "Filter":
                gridViewRowData = GridView1.FooterRow;
                DropDownListClient = (PolytexControls.DropDownList)(gridViewRowData.FindControl("DropDownListClient"));
                DropDownListModel = (PolytexControls.DropDownList)(gridViewRowData.FindControl("DropDownListModel"));
                TextBoxSerial = (PolytexControls.TextBox)(gridViewRowData.FindControl("TextBoxSerial"));
                TextBoxDescription = (PolytexControls.TextBox)(gridViewRowData.FindControl("TextBoxDescription"));
                TextBoxUnitIp = (PolytexControls.TextBox)(gridViewRowData.FindControl("TextBoxUnitIp"));
                TextBoxCameraIp = (PolytexControls.TextBox)(gridViewRowData.FindControl("TextBoxCameraIp"));
                TextBoxSWVersion = (PolytexControls.TextBox)(gridViewRowData.FindControl("TextBoxSWVersion"));
                ObjectDataSource1.SelectParameters["serial"].DefaultValue = TextBoxSerial.Text;
                ObjectDataSource1.SelectParameters["clientId"].DefaultValue = Util.ValidateInt(DropDownListClient.AspDropDownList.SelectedValue, 0).ToString();
                ObjectDataSource1.SelectParameters["modelId"].DefaultValue =  Util.ValidateInt(DropDownListModel.AspDropDownList.SelectedValue, 0).ToString();
                ObjectDataSource1.SelectParameters["description"].DefaultValue = TextBoxDescription.Text;
                ObjectDataSource1.SelectParameters["unitIp"].DefaultValue = TextBoxUnitIp.Text;
                ObjectDataSource1.SelectParameters["cameraIp"].DefaultValue = TextBoxCameraIp.Text;
                ObjectDataSource1.SelectParameters["swVersion"].DefaultValue = TextBoxSWVersion.Text;
                ObjectDataSource1.DataBind();
                HiddenFieldClientId.Value = Util.ValidateInt(DropDownListClient.AspDropDownList.SelectedValue, 0).ToString();
                HiddenFieldSerial.Value = TextBoxSerial.Text;
                HiddenFieldModelId.Value = Util.ValidateInt(DropDownListModel.AspDropDownList.SelectedValue, 0).ToString();
                HiddenFieldDescription.Value = TextBoxDescription.Text;
                HiddenFieldCameraIP.Value = TextBoxCameraIp.Text;
                HiddenFieldSWVersion.Value = TextBoxSWVersion.Text;
                HiddenFieldUnitIP.Value = TextBoxUnitIp.Text;
                break;
            case "Clear":
                HiddenFieldClientId.Value = "0";
                HiddenFieldSerial.Value = "";
                HiddenFieldModelId.Value = "0";
                HiddenFieldDescription.Value = "";
                ObjectDataSource1.SelectParameters["description"].DefaultValue = "";
                ObjectDataSource1.SelectParameters["clientId"].DefaultValue = "0";
                ObjectDataSource1.SelectParameters["serial"].DefaultValue = "";
                ObjectDataSource1.SelectParameters["clientId"].DefaultValue = "0";
                ObjectDataSource1.SelectParameters["modelId"].DefaultValue = "0";
                ObjectDataSource1.SelectParameters["unitIp"].DefaultValue = "";
                ObjectDataSource1.SelectParameters["cameraIp"].DefaultValue = "";
                ObjectDataSource1.SelectParameters["swVersion"].DefaultValue = "";
                break;
        }
    }
示例#3
0
 //Assigns the right controls to global controls variables
 public void SetInputControls(GridViewRow gridViewRowData)
 {
     DropDownListClient = (PolytexControls.DropDownList)(gridViewRowData.FindControl("DropDownListClient"));
     DropDownListModel = (PolytexControls.DropDownList)(gridViewRowData.FindControl("DropDownListModel"));
     TextBoxSerial = (PolytexControls.TextBox)(gridViewRowData.FindControl("TextBoxSerial"));
     TextBoxDescription = (PolytexControls.TextBox)(gridViewRowData.FindControl("TextBoxDescription"));
     territoryId = getTerritoryIdByClient(Util.ValidateInt(DropDownListClient.AspDropDownList.SelectedValue.ToString(), 0));
     TextBoxUnitIp = (PolytexControls.TextBox)(gridViewRowData.FindControl("TextBoxUnitIP"));
     TextBoxCameraIp = (PolytexControls.TextBox)(gridViewRowData.FindControl("TextBoxCameraIP"));
     TextBoxSWVersion = (PolytexControls.TextBox)(gridViewRowData.FindControl("TextBoxSWVersion"));
 }
示例#4
0
    protected void GridViewOnRowCommand(object sender, GridViewCommandEventArgs e)
    {
        string commandName = e.CommandName;
        int activityId;
        switch (commandName)
        {
            case "Edit":
                activityId = Convert.ToInt32(e.CommandArgument);
                Response.Redirect("ActivityDetails.aspx?activityId=" + activityId.ToString(), true);
                break;
            case "Enable":
                Manage_Activities.Enable(Convert.ToInt32(e.CommandArgument), true);
                PolyGridViewUtils.SetSelectedRow(GridView1, e.CommandArgument);
                SetActionMessage(ActionMessage.EnabledSuccessfuly);
                break;
            case "Disable":
                Manage_Activities.Disable(Convert.ToInt32(e.CommandArgument), false);
                if (CheckBoxIncludeDisabled.Checked)
                {
                    PolyGridViewUtils.SetSelectedRow(GridView1, e.CommandArgument);
                }
                else
                {
                    PolyGridViewUtils.SetSelectedRow(GridView1, 0);
                }
                SetActionMessage(ActionMessage.DisabledSuccessfuly);
                break;
            case "Filter":

                GridViewRow gridViewRowData = GridView1.FooterRow;
                DropDownListSystemUser = (PolytexControls.DropDownList)(gridViewRowData.FindControl("DropDownListSystemUser"));
                DropDownListClient = (PolytexControls.DropDownList)(gridViewRowData.FindControl("DropDownListClient"));
                TextBoxDateStart = (PolytexControls.TextBox)(gridViewRowData.FindControl("TextBoxDateStart"));
                TextBoxUnit = (PolytexControls.TextBox)(gridViewRowData.FindControl("TextBoxUnit"));
                DropDownListActivityGroupName = (PolytexControls.DropDownList)(gridViewRowData.FindControl("DropDownListGroupName"));
                DropDownListActivityTypeName = (PolytexControls.DropDownList)(gridViewRowData.FindControl("DropDownListActivityTypeName"));

                ObjectDataSource1.SelectParameters["clientId"].DefaultValue = Util.ValidateInt(DropDownListClient.AspDropDownList.SelectedValue, 0).ToString();
                ObjectDataSource1.SelectParameters["systemUserId"].DefaultValue = Util.ValidateInt(DropDownListSystemUser.AspDropDownList.SelectedValue, 0).ToString();
                ObjectDataSource1.SelectParameters["unit"].DefaultValue = TextBoxUnit.Text;
                ObjectDataSource1.SelectParameters["dateStart"].DefaultValue = (TextBoxDateStart.Text != "" ? DateTime.Parse(TextBoxDateStart.Text).ToString() : "");
                ObjectDataSource1.SelectParameters["activityGroupId"].DefaultValue = Util.ValidateInt(DropDownListActivityGroupName.AspDropDownList.SelectedValue, 0).ToString();
                ObjectDataSource1.SelectParameters["activitytypeId"].DefaultValue = Util.ValidateInt(DropDownListActivityTypeName.AspDropDownList.SelectedValue, 0).ToString();
                ObjectDataSource1.DataBind();

                HiddenFieldClientId.Value = Util.ValidateInt(DropDownListClient.AspDropDownList.SelectedValue, 0).ToString();
                HiddenFieldSystemUserId.Value = Util.ValidateInt(DropDownListSystemUser.AspDropDownList.SelectedValue, 0).ToString();
                HiddenFieldDateStart.Value = TextBoxDateStart.Text;
                HiddenFieldUnit.Value = TextBoxUnit.Text;
                HiddenFieldActivityGroup.Value = Util.ValidateInt(DropDownListActivityGroupName.AspDropDownList.SelectedValue, 0).ToString();
                HiddenFieldActivityType.Value = Util.ValidateInt(DropDownListActivityTypeName.AspDropDownList.SelectedValue, 0).ToString();
                break;
            case "Clear":

                HiddenFieldClientId.Value = "0";
                HiddenFieldSystemUserId.Value = "0";
                HiddenFieldActivityGroup.Value = "0";
                HiddenFieldActivityType.Value = "0";
                HiddenFieldDateStart.Value = "";
                HiddenFieldUnit.Value = "";

                ObjectDataSource1.SelectParameters["clientId"].DefaultValue = "0";
                ObjectDataSource1.SelectParameters["systemUserId"].DefaultValue = "0";
                ObjectDataSource1.SelectParameters["unit"].DefaultValue = "";
                ObjectDataSource1.SelectParameters["dateStart"].DefaultValue = "";
                ObjectDataSource1.SelectParameters["activityGroupId"].DefaultValue = "0";
                ObjectDataSource1.SelectParameters["activitytypeId"].DefaultValue = "0";
                break;
        }
    }
示例#5
0
    protected void GridViewOnPreRender(object sender, EventArgs e)
    {

        int cliendId = Util.ValidateInt(HiddenFieldClientId.Value, 0);
        int systemUserId = Util.ValidateInt(HiddenFieldSystemUserId.Value, 0);
        int activityGroupId = Util.ValidateInt(HiddenFieldActivityGroup.Value, 0);
        int activityTypeId = Util.ValidateInt(HiddenFieldActivityType.Value, 0);

        GridViewRow gridViewRowData = GridView1.FooterRow;

        DropDownListSystemUser = (PolytexControls.DropDownList)(gridViewRowData.FindControl("DropDownListSystemUser"));
        DropDownListClient = (PolytexControls.DropDownList)(gridViewRowData.FindControl("DropDownListClient"));
        TextBoxDateStart = (PolytexControls.TextBox)(gridViewRowData.FindControl("TextBoxDateStart"));
        TextBoxUnit = (PolytexControls.TextBox)(gridViewRowData.FindControl("TextBoxUnit"));
        DropDownListActivityGroupName = (PolytexControls.DropDownList)(gridViewRowData.FindControl("DropDownListGroupName"));
        DropDownListActivityTypeName = (PolytexControls.DropDownList)(gridViewRowData.FindControl("DropDownListActivityTypeName"));

        if (!IsPostBack)
        {
            if (CurrentUser.CurrentRoleType.ToString() == "Technician")
            {
                DropDownListSystemUser.AspDropDownList.SelectedValue = CurrentUser.SystemUserId.ToString();
            }
        }

        TextBoxDateStart.Text = HiddenFieldDateStart.Value;
        TextBoxUnit.Text = HiddenFieldUnit.Value;

        if (cliendId > 0)
        {
            DropDownListClient.AspDropDownList.SelectedValue = cliendId.ToString();
        }
        if (systemUserId > 0)
        {
            DropDownListSystemUser.AspDropDownList.SelectedValue = systemUserId.ToString();
        }
        if (activityGroupId > 0)
        {
            DropDownListActivityGroupName.AspDropDownList.SelectedValue = activityGroupId.ToString();
        }
        if (activityTypeId > 0)
        {
            DropDownListActivityTypeName.AspDropDownList.SelectedValue = activityTypeId.ToString();
        }
    }
示例#6
0
 protected void GridViewOnRowCommand(object sender, GridViewCommandEventArgs e)
 {
     string commandName = e.CommandName;
     GridViewRow gridViewRowData;
     switch (commandName)
     {
         case "Insert":
             PolyGridViewUtils.ClearSetRows(GridView1, true, true);
             gridViewRowData = GridView1.FooterRow;
             Page.Validate("GridEditItem");
             if (Page.IsValid)
             {
                 SetInputControls(gridViewRowData);
                 systemUserId = Manage_Clients.Insert(TextBoxName.Text.Trim(), DropDownListTerritoryId.AspDropDownList.SelectedValue, TextBoxManagerVersion.Text.Trim());
                 PolyGridViewUtils.ClearSetRows(GridView1, true, true);
                 PolyGridViewUtils.SetSelectedRow(GridView1, systemUserId);
                 SetActionMessage(ActionMessage.InsertedSuccessfuly); 
             }
             else
             {
                 SetActionMessage(ActionMessage.InsertFailure);
             }
             break;
         case "UpdateClient":
             gridViewRowData = GridView1.Rows[GridView1.EditIndex];
             systemUserId = Convert.ToInt32(e.CommandArgument);
             Page.Validate("GridEditItem");
             if (Page.IsValid)
             {
                 SetInputControls(gridViewRowData);
                 if (Manage_Clients.Update(systemUserId, TextBoxName.Text, DropDownListTerritoryId.AspDropDownList.SelectedValue,TextBoxManagerVersion.Text))
                 {
                     PolyGridViewUtils.SetSelectedRow(GridView1, systemUserId);
                     SetActionMessage(ActionMessage.UpdatedSuccessfuly);
                 }
                 else
                 {
                     SetActionMessage(ActionMessage.UpdateFailure);
                 }
             }
             else
             {
                 SetActionMessage(ActionMessage.UpdateFailure);
             }
             break;
         case "Enable":
             Manage_Clients.Enable(Convert.ToInt32(e.CommandArgument), true);
             PolyGridViewUtils.SetSelectedRow(GridView1, e.CommandArgument);
             SetActionMessage(ActionMessage.EnabledSuccessfuly);
             break;
         case "Disable":
             Manage_Clients.Disable(Convert.ToInt32(e.CommandArgument), false);
             if (CheckBoxIncludeDisabled.Checked)
             {
                 PolyGridViewUtils.SetSelectedRow(GridView1, e.CommandArgument);
             }
             else
             {
                 PolyGridViewUtils.SetSelectedRow(GridView1, 0);
             }
             SetActionMessage(ActionMessage.DisabledSuccessfuly);
             break;
         case "Filter":
             gridViewRowData = GridView1.FooterRow;
             TextBoxName = (PolytexControls.TextBox)(gridViewRowData.FindControl("TextBoxName"));
             DropDownListTerritoryId = (PolytexControls.DropDownList)(gridViewRowData.FindControl("DropDownListTerritory"));
             TextBoxManagerVersion = (PolytexControls.TextBox)(gridViewRowData.FindControl("TextBoxManagerVersion"));
             ObjectDataSource1.SelectParameters["territoryId"].DefaultValue = Util.ValidateInt(DropDownListTerritoryId.AspDropDownList.SelectedValue, CurrentUser.TerritoryId).ToString();
             ObjectDataSource1.SelectParameters["clientName"].DefaultValue = TextBoxName.Text;
             ObjectDataSource1.SelectParameters["version"].DefaultValue = TextBoxManagerVersion.Text;
             ObjectDataSource1.DataBind();
             HiddenFieldTerritoryId.Value = Util.ValidateInt(DropDownListTerritoryId.AspDropDownList.SelectedValue, CurrentUser.TerritoryId).ToString();
             HiddenFieldClient.Value = TextBoxName.Text;
             HiddenFieldVersion.Value = TextBoxManagerVersion.Text;
             break;
         case "Clear":
             HiddenFieldTerritoryId.Value = CurrentUser.TerritoryId.ToString();
             HiddenFieldClient.Value = "";
             HiddenFieldVersion.Value = "";
             ObjectDataSource1.SelectParameters["territoryId"].DefaultValue = CurrentUser.TerritoryId.ToString();
             ObjectDataSource1.SelectParameters["clientName"].DefaultValue = "";
             ObjectDataSource1.SelectParameters["version"].DefaultValue = "";
             break;
     }
 }
示例#7
0
 //Assigns the right controls to global controls variables
 public void SetInputControls(GridViewRow gridViewRowData)
 {
     TextBoxName = (PolytexControls.TextBox)(gridViewRowData.FindControl("TextBoxName"));
     DropDownListTerritoryId = (PolytexControls.DropDownList)(gridViewRowData.FindControl("DropDownListTerritory"));
     TextBoxManagerVersion = (PolytexControls.TextBox)(gridViewRowData.FindControl("TextBoxManagerVersion"));
 }
示例#8
0
    protected void GridViewOnPreRender(object sender, EventArgs e)
    {
        int territoryId = Util.ValidateInt(HiddenFieldTerritoryId.Value, CurrentUser.TerritoryId);
        GridViewRow gridViewRowData = GridView1.FooterRow;

        TextBoxName = (PolytexControls.TextBox)(gridViewRowData.FindControl("TextBoxName"));
        DropDownListTerritoryId = (PolytexControls.DropDownList)(gridViewRowData.FindControl("DropDownListTerritory"));
        TextBoxManagerVersion = (PolytexControls.TextBox)(gridViewRowData.FindControl("TextBoxManagerVersion"));

        TextBoxManagerVersion.Text = HiddenFieldVersion.Value;
        TextBoxName.Text = HiddenFieldClient.Value;
        if (territoryId > 0)
        {
            DropDownListTerritoryId.AspDropDownList.SelectedValue = territoryId.ToString();
        }
        else
        {
            DropDownListTerritoryId.AspDropDownList.SelectedValue = null;
        }
        
    }