Exemple #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request.Cookies["adminid"] != null && Request.Cookies["adminid"].Value != "")
     {
         intProfile = Int32.Parse(Request.Cookies["adminid"].Value);
     }
     else
     {
         Reload();
     }
     oApplication = new Applications(intProfile, dsn);
     oPage        = new Pages(intProfile, dsn);
     oAppPage     = new AppPages(intProfile, dsn);
     btnClose.Attributes.Add("onclick", "return HidePanel();");
     if (!IsPostBack)
     {
         int intApplication = 0;
         if (Request.QueryString["applicationid"] != null && Request.QueryString["applicationid"] != "")
         {
             lblApplication.Text = Request.QueryString["applicationid"];
             intApplication      = Int32.Parse(Request.QueryString["applicationid"]);
         }
         LoadPages(null, 0, intApplication);
         if (intApplication > 0)
         {
             lblName.Text = oApplication.GetName(intApplication);
         }
         else
         {
             lblName.Text = "GLOBAL ADD";
         }
     }
 }
Exemple #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     Response.Cookies["loginreferrer"].Value   = "/admin/services_pending.aspx";
     Response.Cookies["loginreferrer"].Expires = DateTime.Now.AddDays(30);
     if (Request.Cookies["adminid"] != null && Request.Cookies["adminid"].Value != "")
     {
         intProfile = Int32.Parse(Request.Cookies["adminid"].Value);
     }
     else
     {
         Response.Redirect("/admin/login.aspx");
     }
     oService       = new Services(intProfile, dsn);
     oServiceEditor = new ServiceEditor(intProfile, dsn);
     oRequestItem   = new RequestItems(intProfile, dsn);
     oApplication   = new Applications(intProfile, dsn);
     oUser          = new Users(intProfile, dsn);
     if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
     {
         intService      = Int32.Parse(Request.QueryString["id"]);
         panView.Visible = true;
         if (!IsPostBack)
         {
             LoadServices(0);
             lblName.Text = oService.GetName(intService);
             int intItem = oService.GetItemId(intService);
             lblItem.Text        = oRequestItem.GetItemName(intItem);
             lblApplication.Text = oApplication.GetName(oRequestItem.GetItemApplication(intItem));
             DataSet ds = oService.GetUser(intService, -1);
             if (ds.Tables[0].Rows.Count > 0)
             {
                 lblUser.Text = oUser.GetFullName(Int32.Parse(ds.Tables[0].Rows[0]["userid"].ToString()));
             }
         }
     }
     else
     {
         panAll.Visible     = true;
         rptView.DataSource = oService.GetPending();
         rptView.DataBind();
     }
     btnSave.Attributes.Add("onclick", "return confirm('Are you sure you want to save this service?');");
     btnDelete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this service?');");
 }
 private void LoadProperties()
 {
     ds = oPermission.Get(Int32.Parse(hdnId.Value));
     if (ds.Tables[0].Rows.Count > 0)
     {
         int intApplication = Int32.Parse(ds.Tables[0].Rows[0]["applicationid"].ToString());
         hdnApplication.Value = intApplication.ToString();
         if (intApplication == 0)
         {
             lblApplication.Text = "No Application";
         }
         else
         {
             lblApplication.Text = oApplication.GetName(intApplication);
         }
         ddlGroup.SelectedValue      = ds.Tables[0].Rows[0]["groupid"].ToString();
         ddlPermission.SelectedValue = ds.Tables[0].Rows[0]["permission"].ToString();
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request.Cookies["adminid"] != null && Request.Cookies["adminid"].Value != "")
     {
         intProfile = Int32.Parse(Request.Cookies["adminid"].Value);
     }
     else
     {
         Reload();
     }
     oPermission  = new Permissions(intProfile, dsn);
     oApplication = new Applications(intProfile, dsn);
     oGroup       = new Groups(intProfile, dsn);
     if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
     {
         if (!IsPostBack)
         {
             hdnApplication.Value = "0";
             lblApplication.Text  = "No Category";
             hdnId.Value          = Request.QueryString["id"];
             LoadLists();
             if (Request.QueryString["applicationid"] != null && Request.QueryString["applicationid"] != "")
             {
                 hdnApplication.Value = Request.QueryString["applicationid"];
                 int intApplication = Int32.Parse(hdnApplication.Value);
                 lblApplication.Text = oApplication.GetName(intApplication);
             }
             if (hdnId.Value == "0")
             {
                 btnDelete.Visible = false;
             }
             else
             {
                 btnSave.Text = "Update";
                 LoadProperties();
                 btnDelete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this permission?');");
             }
             btnClose.Attributes.Add("onclick", "return HidePanel();");
         }
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.Cookies["adminid"] != null && Request.Cookies["adminid"].Value != "")
            {
                intProfile = Int32.Parse(Request.Cookies["adminid"].Value);
            }
            else
            {
                Reload();
            }
            oVariable    = new Variables(intEnvironment);
            oCustomized  = new Customized(intProfile, dsn);
            oService     = new Services(intProfile, dsn);
            oApplication = new Applications(intProfile, dsn);
            oUser        = new Users(intProfile, dsn);
            Int32.TryParse(Request.QueryString["applicationid"], out intApplication);
            if (intApplication > 0)
            {
                litApplication.Text = oApplication.GetName(intApplication);
            }

            if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
            {
                lblId.Text = Request.QueryString["id"];
            }
            string strControl     = "";
            string strControlText = "";

            if (Request.QueryString["control"] != null)
            {
                strControl = Request.QueryString["control"];
            }
            if (Request.QueryString["controltext"] != null)
            {
                strControlText = Request.QueryString["controltext"];
            }
            btnNone.Attributes.Add("onclick", "return Reset(0,'" + hdnId.ClientID + "','No Document','" + txtName.ClientID + "');");
            btnSave.Attributes.Add("onclick", "return Update('" + hdnId.ClientID + "','" + strControl + "','" + txtName.ClientID + "','" + strControlText + "');");
            btnClose.Attributes.Add("onclick", "return HidePanel();");
            LoadTree();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            intProfile       = Int32.Parse(Request.Cookies["profileid"].Value);
            oProjectRequest  = new ProjectRequest(intProfile, dsn);
            oResourceRequest = new ResourceRequest(intProfile, dsn);
            oProjectNumber   = new ProjectNumber(intProfile, dsn);
            oPage            = new Pages(intProfile, dsn);
            oUser            = new Users(intProfile, dsn);
            oRequestItem     = new RequestItems(intProfile, dsn);
            oApplication     = new Applications(intProfile, dsn);
            oRequest         = new Requests(intProfile, dsn);
            oVariable        = new Variables(intEnvironment);
            oService         = new Services(intProfile, dsn);
            oDelegate        = new Delegates(intProfile, dsn);
            oStatusLevel     = new StatusLevels();
            oEnhancement     = new Enhancements(intProfile, dsn);
            oLog             = new Log(intProfile, dsn);
            oFunction        = new Functions(intProfile, dsn, intEnvironment);

            if (Request.QueryString["pageid"] != null && Request.QueryString["pageid"] != "")
            {
                intPage = Int32.Parse(Request.QueryString["pageid"]);
            }
            if (Request.QueryString["action"] != null && Request.QueryString["action"] != "")
            {
                panFinish.Visible = true;
            }
            else
            {
                if (Request.QueryString["applicationid"] != null && Request.QueryString["applicationid"] != "")
                {
                    intApplication = Int32.Parse(Request.QueryString["applicationid"]);
                }
                if (Request.Cookies["application"] != null && Request.Cookies["application"].Value != "")
                {
                    intApplication = Int32.Parse(Request.Cookies["application"].Value);
                }
                if (!IsPostBack)
                {
                    if (Request.QueryString["rrid"] != null && Request.QueryString["rrid"] != "")
                    {
                        lblResourceParent.Text = Request.QueryString["rrid"];
                        int intResourceParent = Int32.Parse(lblResourceParent.Text);
                        ds = oResourceRequest.Get(intResourceParent);
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            int      intItem    = Int32.Parse(ds.Tables[0].Rows[0]["itemid"].ToString());
                            int      intService = Int32.Parse(ds.Tables[0].Rows[0]["serviceid"].ToString());
                            int      intNumber  = Int32.Parse(ds.Tables[0].Rows[0]["number"].ToString());
                            int      intRequest = Int32.Parse(ds.Tables[0].Rows[0]["requestid"].ToString());
                            Forecast oForecast  = new Forecast(intProfile, dsn);
                            if (intService == intStorageService)
                            {
                                try
                                {
                                    OnDemandTasks oOnDemandTask = new OnDemandTasks(0, dsn);
                                    Locations     oLocation     = new Locations(0, dsn);
                                    DataSet       dsDesign      = oOnDemandTask.GetServerStorage(intRequest, intItem, intNumber);
                                    if (dsDesign.Tables[0].Rows.Count == 1)
                                    {
                                        int intAnswer  = Int32.Parse(dsDesign.Tables[0].Rows[0]["answerid"].ToString());
                                        int intAddress = Int32.Parse(oForecast.GetAnswer(intAnswer, "addressid"));
                                        lblLocation.Text    = oLocation.GetFull(intAddress);
                                        panLocation.Visible = true;
                                    }
                                }
                                catch { }
                            }
                            int     intProject  = Int32.Parse(oRequest.Get(intRequest, "projectid"));
                            int     intApp      = oRequestItem.GetItemApplication(intItem);
                            int     intForecast = 0;
                            DataSet dsForecast  = oForecast.GetProject(intProject);
                            if (dsForecast.Tables[0].Rows.Count > 0)
                            {
                                intForecast = Int32.Parse(dsForecast.Tables[0].Rows[0]["id"].ToString());
                            }
                            if (intForecast > 0)
                            {
                                btnView.Attributes.Add("oncontextmenu", "return OpenWindow('NEW_WINDOW','" + oPage.GetFullLink(intDesignBuilder) + "?id=" + intForecast.ToString() + "');");
                            }
                            else
                            {
                                btnView.Attributes.Add("oncontextmenu", "alert('There is no design for this project');return false;");
                            }
                            if (ds.Tables[0].Rows[0]["solo"].ToString() == "0")
                            {
                                btnView.Attributes.Add("onclick", "return OpenWindow('PRINTER_FRIENDLY','?page=" + intViewRequest.ToString() + "&rid=" + intRequest.ToString() + "');");
                                btnView.Text = "Click here to view the project details";
                                lblType.Text = "Project Request";
                            }
                            else
                            {
                                btnView.Attributes.Add("onclick", "return OpenWindow('PRINTER_FRIENDLY','?page=" + intViewResourceRequest.ToString() + "&rrid=" + intResourceParent.ToString() + "');");
                                if (oApplication.Get(intApp, "tpm") == "1")
                                {
                                    btnView.Text = "Click here to view the project details";
                                }
                                else
                                {
                                    btnView.Text = "Click here to view this request";
                                }
                                lblType.Text = "Service Request";
                            }
                            btnAssignments.Attributes.Add("onclick", "return OpenWindow('PRINTER_FRIENDLY','?page=" + intSearchPage.ToString() + "&pid=" + intProject + "&aid=" + intApp.ToString() + "&sort=userid');");
                            //btnAssignments.Attributes.Add("onclick", "return OpenNewWindowMenu('/datapoint/projects/datapoint_projects.aspx?id=" + oFunction.encryptQueryString(intProject.ToString()) + "', '800', '600');");
                            lblItem.Text    = intItem.ToString();
                            lblService.Text = oService.GetName(intService);
                            if (oApplication.Get(intApp, "request_items") == "1")
                            {
                                lblGroup.Text = oApplication.GetName(intApp) + " | " + oRequestItem.GetItemName(intItem);
                            }
                            else
                            {
                                lblGroup.Text = oApplication.GetName(intApp);
                            }
                            int intUser       = Int32.Parse(oRequest.Get(intRequest, "userid"));
                            int intAppManager = oApplication.GetManager(intApp);
                            if (ds.Tables[0].Rows[0]["accepted"].ToString() == "-1" && oApplication.Get(intApp, "tpm") == "1")
                            {
                                if (intUser == intProfile || oDelegate.Get(intUser, intProfile) > 0)
                                {
                                    panRequest.Visible      = true;
                                    panAssignSingle.Visible = true;
                                    txtHours.Text           = double.Parse(ds.Tables[0].Rows[0]["allocated"].ToString()).ToString("F");
                                    panHours.Visible        = !(oApplication.Get(intApp, "tpm") == "1");
                                    txtHours.Enabled        = (oService.Get(intService, "disable_hours") == "1" ? false : true);
                                    lblQuantity.Text        = ds.Tables[0].Rows[0]["devices"].ToString();
                                    lblStatus.Text          = oStatusLevel.HTML(Int32.Parse(ds.Tables[0].Rows[0]["status"].ToString()));
                                    panQuantity.Visible     = (lblQuantity.Text != "0");
                                    txtQuantity.Text        = lblQuantity.Text;
                                    txtQuantity.Enabled     = (txtQuantity.Text != "0");
                                    txtQuantity.Enabled     = false;
                                    lblAssign.Text          = oUser.GetFullName(intProfile);
                                    strSummary = oResourceRequest.GetBodyOverallFix(intResourceParent, 0, intEnvironment, false);
                                }
                                else
                                {
                                    Response.Write("no rights");
                                    panDenied.Visible = true;
                                }
                                btnSubmit.Attributes.Add("onclick", "return ValidateNumber0('" + txtHours.ClientID + "','Please enter a valid number for the hours allocated') && ValidateHidden('" + hdnManager.ClientID + "','" + txtManager.ClientID + "','Please enter a valid LAN ID') && ProcessButton(this);");
                            }
                            else
                            {
                                string strValidate = "";
                                if (oUser.IsAdmin(intProfile) || oService.IsManager(intService, intProfile) || (oApplication.IsManager(intApp, intProfile) && oApplication.Get(intApp, "disable_manager") != "1"))
                                {
                                    panRequest.Visible        = true;
                                    panAssignMultiple.Visible = true;
                                    btnSubmit.Enabled         = (ds.Tables[0].Rows[0]["assigned"].ToString() == "");
                                    if (ds.Tables[0].Rows[0]["status"].ToString() == "5")
                                    {
                                        radHold.Checked            = true;
                                        divChoice.Style["display"] = "inline";
                                        divHold.Style["display"]   = "inline";
                                        txtHold.Text = ds.Tables[0].Rows[0]["reason"].ToString();
                                    }
                                    else
                                    {
                                        divChoice.Style["display"] = (ds.Tables[0].Rows[0]["accepted"].ToString() == "0" ? "inline" : "none");
                                        divAccept.Style["display"] = (ds.Tables[0].Rows[0]["accepted"].ToString() == "1" ? "inline" : "none");
                                    }
                                    int intEnhancementService = 0;
                                    Int32.TryParse(ConfigurationManager.AppSettings["HELP_ENHANCEMENT_SERVICEID"], out intEnhancementService);
                                    if (intService == intEnhancementService)
                                    {
                                        panEnhancement.Visible   = true;
                                        ddlModule.DataTextField  = "name";
                                        ddlModule.DataValueField = "id";
                                        ddlModule.DataSource     = oEnhancement.GetModules(1);
                                        ddlModule.DataBind();
                                        ddlModule.Items.Insert(0, new ListItem("-- SELECT --", "0"));

                                        strValidate += "ValidateDropDown('" + ddlModule.ClientID + "','Select a classification') && ";
                                        radEnhancementShort.Checked = true;
                                        radEnhancementReject.Attributes.Add("onclick", "ShowHideDiv('" + trEnhancementReject.ClientID + "','inline');ShowHideDiv('" + trEnhancementClassification.ClientID + "','none');ShowHideDiv('" + divAccept.ClientID + "','none');");
                                        radEnhancementDuplicate.Attributes.Add("onclick", "ShowHideDiv('" + trEnhancementReject.ClientID + "','inline');ShowHideDiv('" + trEnhancementClassification.ClientID + "','none');ShowHideDiv('" + divAccept.ClientID + "','none');");
                                        radEnhancementShort.Attributes.Add("onclick", "ShowHideDiv('" + trEnhancementReject.ClientID + "','none');ShowHideDiv('" + trEnhancementClassification.ClientID + "','inline');ShowHideDiv('" + divAccept.ClientID + "','inline');");
                                        radEnhancementLong.Attributes.Add("onclick", "ShowHideDiv('" + trEnhancementReject.ClientID + "','inline');ShowHideDiv('" + trEnhancementClassification.ClientID + "','inline');ShowHideDiv('" + divAccept.ClientID + "','inline');");
                                    }
                                    panDelete.Visible = (intItem == intImplementorDistributed || intItem == intImplementorMidrange);
                                    btnDelete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this request');");
                                    txtHours.Text       = double.Parse(ds.Tables[0].Rows[0]["allocated"].ToString()).ToString("F");
                                    panHours.Visible    = !(oApplication.Get(intApp, "tpm") == "1");
                                    txtHours.Enabled    = (oService.Get(intService, "disable_hours") == "1" ? false : true);
                                    lblQuantity.Text    = ds.Tables[0].Rows[0]["devices"].ToString();
                                    panQuantity.Visible = (lblQuantity.Text != "0");
                                    txtQuantity.Text    = lblQuantity.Text;
                                    txtQuantity.Enabled = (txtQuantity.Text != "0");
                                    txtQuantity.Enabled = false;
                                    lblStatus.Text      = oStatusLevel.HTML(Int32.Parse(ds.Tables[0].Rows[0]["status"].ToString()));
                                    trAssigned.Visible  = !(btnSubmit.Enabled);
                                    string  strAssign = "";
                                    DataSet dsManager = oService.GetUser(intService, 1);
                                    foreach (DataRow drManager in dsManager.Tables[0].Rows)
                                    {
                                        if (strAssign != "")
                                        {
                                            strAssign += ", ";
                                        }
                                        strAssign += oUser.GetFullName(Int32.Parse(drManager["userid"].ToString()));
                                    }
                                    lblAssign.Text = strAssign;
                                    DataSet   dsReports = oUser.GetManagerReports(intAppManager, intRequest, intService, intNumber);
                                    DataTable dtReports = dsReports.Tables[0].Copy();
                                    dtReports.Clear();
                                    DataSet dsAssignment = oService.GetUser(intService, -100);
                                    foreach (DataRow drAssignment in dsAssignment.Tables[0].Rows)
                                    {
                                        int     intAssignment = Int32.Parse(drAssignment["userid"].ToString());
                                        DataSet dsAssignees   = oUser.GetManagerReports(intAssignment, intRequest, intService, intNumber);
                                        foreach (DataRow drAssignee in dsAssignees.Tables[0].Rows)
                                        {
                                            dtReports.ImportRow(drAssignee);
                                        }
                                    }
                                    if (dtReports.Rows.Count > 0)
                                    {
                                        // Use custom assignment list
                                        // First, remove duplicates
                                        Hashtable hTable        = new Hashtable();
                                        ArrayList duplicateList = new ArrayList();
                                        foreach (DataRow drow in dtReports.Rows)
                                        {
                                            if (hTable.Contains(drow["userid"]))
                                            {
                                                duplicateList.Add(drow);
                                            }
                                            else
                                            {
                                                hTable.Add(drow["userid"], string.Empty);
                                            }
                                        }
                                        foreach (DataRow dRow in duplicateList)
                                        {
                                            dtReports.Rows.Remove(dRow);
                                        }

                                        // Next, sort by username
                                        dtReports.DefaultView.Sort = "username";

                                        // Now add to dataset
                                        dsReports = new DataSet();
                                        dsReports.Tables.Add(dtReports.DefaultView.ToTable());
                                    }
                                    LoadList(dsReports, intApp);
                                    LoadAvailable(dsReports, intApp);
                                    strSummary = oResourceRequest.GetBodyOverallFix(intResourceParent, 0, intEnvironment, false);
                                }
                                else
                                {
                                    Response.Write("no delegate");
                                    panDenied.Visible = true;
                                }
                                btnSubmit.Attributes.Add("onclick", "return " + strValidate + "ValidateChoice('" + divChoice.ClientID + "','" + radAccept.ClientID + "','" + radReject.ClientID + "','" + radHold.ClientID + "','" + ddlUser.ClientID + "','" + txtHours.ClientID + "') && ProcessButton(this);");
                            }
                        }
                        else
                        {
                            panDenied.Visible = true;
                        }
                    }
                    else
                    {
                        panDenied.Visible = true;
                    }
                }
            }
            btnClose.Attributes.Add("onclick", "return CloseWindow();");
            lnkAvailable.Attributes.Add("onclick", "return ShowHideAvailable('" + divAvailable.ClientID + "');");
            radAccept.Attributes.Add("onclick", "ShowHideDiv('" + divAccept.ClientID + "','inline');ShowHideDiv('" + divReject.ClientID + "','none');ShowHideDiv('" + divHold.ClientID + "','none');");
            radReject.Attributes.Add("onclick", "ShowHideDiv('" + divReject.ClientID + "','inline');ShowHideDiv('" + divAccept.ClientID + "','none');ShowHideDiv('" + divHold.ClientID + "','none');");
            radHold.Attributes.Add("onclick", "ShowHideDiv('" + divHold.ClientID + "','inline');ShowHideDiv('" + divAccept.ClientID + "','none');ShowHideDiv('" + divReject.ClientID + "','none');");
            txtManager.Attributes.Add("onkeyup", "return AJAXTextBoxGet(this,'300','195','" + divManager.ClientID + "','" + lstManager.ClientID + "','" + hdnManager.ClientID + "','" + oVariable.URL() + "/frame/users.aspx',2);");
            lstManager.Attributes.Add("ondblclick", "AJAXClickRow();");
        }
Exemple #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            intProfile       = Int32.Parse(Request.Cookies["profileid"].Value);
            oProjectRequest  = new ProjectRequest(intProfile, dsn);
            oResourceRequest = new ResourceRequest(intProfile, dsn);
            oProjectNumber   = new ProjectNumber(intProfile, dsn);
            oPage            = new Pages(intProfile, dsn);
            oUser            = new Users(intProfile, dsn);
            oRequestItem     = new RequestItems(intProfile, dsn);
            oApplication     = new Applications(intProfile, dsn);
            oRequest         = new Requests(intProfile, dsn);
            oVariable        = new Variables(intEnvironment);
            oService         = new Services(intProfile, dsn);
            oDelegate        = new Delegates(intProfile, dsn);
            oStatusLevel     = new StatusLevels();
            oServiceDetail   = new ServiceDetails(intProfile, dsn);
            oLog             = new Log(intProfile, dsn);
            if (Request.QueryString["pageid"] != null && Request.QueryString["pageid"] != "")
            {
                intPage = Int32.Parse(Request.QueryString["pageid"]);
            }
            if (Request.QueryString["action"] != null && Request.QueryString["action"] != "")
            {
                panFinish.Visible = true;
            }
            else
            {
                if (Request.QueryString["applicationid"] != null && Request.QueryString["applicationid"] != "")
                {
                    intApplication = Int32.Parse(Request.QueryString["applicationid"]);
                }
                if (Request.Cookies["application"] != null && Request.Cookies["application"].Value != "")
                {
                    intApplication = Int32.Parse(Request.Cookies["application"].Value);
                }
                if (!IsPostBack)
                {
                    if (Request.QueryString["rrid"] != null && Request.QueryString["rrid"] != "")
                    {
                        lblResourceParent.Text = Request.QueryString["rrid"];
                        int intResourceParent = Int32.Parse(lblResourceParent.Text);
                        ds = oResourceRequest.Get(intResourceParent);
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            int      intItem     = Int32.Parse(ds.Tables[0].Rows[0]["itemid"].ToString());
                            int      intService  = Int32.Parse(ds.Tables[0].Rows[0]["serviceid"].ToString());
                            int      intRequest  = Int32.Parse(ds.Tables[0].Rows[0]["requestid"].ToString());
                            int      intNumber   = Int32.Parse(ds.Tables[0].Rows[0]["number"].ToString());
                            int      intProject  = Int32.Parse(oRequest.Get(intRequest, "projectid"));
                            int      intApp      = oRequestItem.GetItemApplication(intItem);
                            int      intForecast = 0;
                            Forecast oForecast   = new Forecast(intProfile, dsn);
                            DataSet  dsForecast  = oForecast.GetProject(intProject);
                            if (dsForecast.Tables[0].Rows.Count > 0)
                            {
                                intForecast = Int32.Parse(dsForecast.Tables[0].Rows[0]["id"].ToString());
                            }
                            if (intForecast > 0)
                            {
                                btnView.Attributes.Add("oncontextmenu", "return OpenWindow('NEW_WINDOW','" + oPage.GetFullLink(intDesignBuilder) + "?id=" + intForecast.ToString() + "');");
                            }
                            else
                            {
                                btnView.Attributes.Add("oncontextmenu", "alert('There is no design for this project');return false;");
                            }
                            if (ds.Tables[0].Rows[0]["solo"].ToString() == "0")
                            {
                                btnView.Attributes.Add("onclick", "return OpenWindow('PRINTER_FRIENDLY','?page=" + intViewRequest.ToString() + "&rid=" + intRequest.ToString() + "');");
                                btnView.Text = "Click here to view the project details";
                                lblType.Text = "Project Request";
                            }
                            else
                            {
                                btnView.Attributes.Add("onclick", "return OpenWindow('PRINTER_FRIENDLY','?page=" + intViewResourceRequest.ToString() + "&rrid=" + intResourceParent.ToString() + "');");
                                if (oApplication.Get(intApp, "tpm") == "1")
                                {
                                    btnView.Text = "Click here to view the project details";
                                }
                                else
                                {
                                    btnView.Text = "Click here to view this request";
                                }
                                lblType.Text = "Service Request";
                            }
                            btnAssignments.Attributes.Add("onclick", "return OpenWindow('PRINTER_FRIENDLY','?page=" + intSearchPage.ToString() + "&pid=" + intProject + "&aid=" + intApp.ToString() + "&sort=userid');");
                            lblItem.Text      = intItem.ToString();
                            lblService.Text   = oService.GetName(intService);
                            lblServiceID.Text = intService.ToString();
                            if (oApplication.Get(intApp, "request_items") == "1")
                            {
                                lblGroup.Text = oApplication.GetName(intApp) + " | " + oRequestItem.GetItemName(intItem);
                            }
                            else
                            {
                                lblGroup.Text = oApplication.GetName(intApp);
                            }
                            int intUser       = Int32.Parse(oRequest.Get(intRequest, "userid"));
                            int intAppManager = oApplication.GetManager(intApp);
                            if (ds.Tables[0].Rows[0]["accepted"].ToString() == "-1" && oApplication.Get(intApp, "tpm") == "1")
                            {
                                if (intUser == intProfile || oDelegate.Get(intUser, intProfile) > 0)
                                {
                                    panRequest.Visible         = true;
                                    panAssignSingle.Visible    = true;
                                    txtHours.Text              = double.Parse(ds.Tables[0].Rows[0]["allocated"].ToString()).ToString("F");
                                    lblHoursOverall.Text       = double.Parse(ds.Tables[0].Rows[0]["allocated"].ToString()).ToString("F");
                                    txtQuantityOverall.Text    = ds.Tables[0].Rows[0]["devices"].ToString();
                                    txtQuantityOverall.Enabled = false;
                                    txtQuantity.Text           = txtQuantityOverall.Text;
                                    txtQuantity.Enabled        = false;
                                    lblHours.Visible           = true;
                                    lblHours.Text              = txtHours.Text;
                                    lblStatus.Text             = oStatusLevel.HTML(Int32.Parse(ds.Tables[0].Rows[0]["status"].ToString()));
                                    txtQuantity.Text           = ds.Tables[0].Rows[0]["devices"].ToString();
                                    btnAssign.Enabled          = (txtQuantity.Text != "0");
                                    lblAssignBy.Text           = oUser.GetFullName(intProfile);
                                    strSummary = oResourceRequest.GetBodyOverallFix(intResourceParent, 0, intEnvironment, false);
                                }
                                else
                                {
                                    Response.Write("no rights");
                                    panDenied.Visible = true;
                                }
                                btnSubmit.Attributes.Add("onclick", "return ValidateNumber0('" + txtHours.ClientID + "','Please enter a valid number for the hours allocated') && ValidateHidden('" + hdnManager.ClientID + "','" + txtManager.ClientID + "','Please enter a valid LAN ID') && ProcessButton(this);");
                            }
                            else
                            {
                                if (oUser.IsAdmin(intProfile) || oService.IsManager(intService, intProfile) || (oApplication.IsManager(intApp, intProfile) && oApplication.Get(intApp, "disable_manager") != "1"))
                                {
                                    panRequest.Visible        = true;
                                    panAssignMultiple.Visible = true;
                                    btnSubmit.Enabled         = (ds.Tables[0].Rows[0]["assigned"].ToString() == "");
                                    if (ds.Tables[0].Rows[0]["status"].ToString() == "5")
                                    {
                                        radHold.Checked            = true;
                                        divChoice.Style["display"] = "inline";
                                        divHold.Style["display"]   = "inline";
                                        txtHold.Text = ds.Tables[0].Rows[0]["reason"].ToString();
                                    }
                                    else
                                    {
                                        divChoice.Style["display"] = (ds.Tables[0].Rows[0]["accepted"].ToString() == "0" ? "inline" : "none");
                                        if (Request.QueryString["assign"] != null)
                                        {
                                            divAccept.Style["display"] = "inline";
                                            radAccept.Checked          = true;
                                        }
                                        else
                                        {
                                            divAccept.Style["display"] = (ds.Tables[0].Rows[0]["accepted"].ToString() == "1" ? "inline" : "none");
                                        }
                                    }
                                    panDelete.Visible = (intItem == intImplementorDistributed || intItem == intImplementorMidrange);
                                    btnDelete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this request');");
                                    txtHours.Text           = double.Parse(ds.Tables[0].Rows[0]["allocated"].ToString()).ToString("F");
                                    lblHoursOverall.Text    = double.Parse(ds.Tables[0].Rows[0]["allocated"].ToString()).ToString("F");
                                    txtQuantityOverall.Text = ds.Tables[0].Rows[0]["devices"].ToString();
                                    if (oApplication.Get(intApp, "tpm") == "1")
                                    {
                                        lblHours.Visible           = true;
                                        lblHours.Text              = txtHours.Text;
                                        txtQuantityOverall.Enabled = false;
                                        txtQuantity.Enabled        = false;
                                        btnAssign.Attributes.Add("onclick", "return ValidateDropDown('" + ddlUser.ClientID + "','Please select a technician')" +
                                                                 " && ProcessButton(this)" +
                                                                 ";");
                                    }
                                    else if (oServiceDetail.Gets(intService, 1).Tables[0].Rows.Count > 0)
                                    {
                                        lblHours.Visible = true;
                                        lblHours.Text    = "TBD ";
                                        btnWhy.Visible   = true;
                                        btnAssign.Attributes.Add("onclick", "return ValidateDropDown('" + ddlUser.ClientID + "','Please select a technician')" +
                                                                 " && ValidateNumber0('" + txtQuantity.ClientID + "','Please enter the quantity')" +
                                                                 " && ProcessButton(this)" +
                                                                 ";");
                                    }
                                    else if (oService.Get(intService, "disable_hours") == "1")
                                    {
                                        lblHours.Visible = true;
                                        lblHours.Text    = txtHours.Text;
                                        btnAssign.Attributes.Add("onclick", "return ValidateDropDown('" + ddlUser.ClientID + "','Please select a technician')" +
                                                                 " && ValidateNumber0('" + txtQuantity.ClientID + "','Please enter the quantity')" +
                                                                 " && ProcessButton(this)" +
                                                                 ";");
                                    }
                                    else
                                    {
                                        txtHours.Visible = true;
                                        btnAssign.Attributes.Add("onclick", "return ValidateDropDown('" + ddlUser.ClientID + "','Please select a technician')" +
                                                                 " && ValidateNumber0('" + txtQuantity.ClientID + "','Please enter the quantity')" +
                                                                 " && ValidateNumber0('" + txtHours.ClientID + "','Please enter the hours')" +
                                                                 " && ProcessButton(this)" +
                                                                 ";");
                                    }
                                    btnUpdate.Attributes.Add("onclick", "return ValidateNumber0('" + txtQuantityOverall.ClientID + "') && ProcessButton(this);");
                                    DataSet dsAssigned  = oResourceRequest.GetWorkflowsAssign(intResourceParent);
                                    int     intQuantity = Int32.Parse(ds.Tables[0].Rows[0]["devices"].ToString());
                                    foreach (DataRow drAssigned in dsAssigned.Tables[0].Rows)
                                    {
                                        intQuantity = intQuantity - Int32.Parse(drAssigned["devices"].ToString());
                                    }
                                    txtQuantity.Text    = intQuantity.ToString();
                                    btnAssign.Enabled   = (txtQuantity.Text != "0");
                                    lblStatus.Text      = oStatusLevel.HTML(Int32.Parse(ds.Tables[0].Rows[0]["status"].ToString()));
                                    lblAssigned.Visible = !(btnSubmit.Enabled);
                                    string  strAssign = "";
                                    DataSet dsManager = oService.GetUser(intService, 1);
                                    foreach (DataRow drManager in dsManager.Tables[0].Rows)
                                    {
                                        if (strAssign != "")
                                        {
                                            strAssign += ", ";
                                        }
                                        strAssign += oUser.GetFullName(Int32.Parse(drManager["userid"].ToString()));
                                    }
                                    lblAssignBy.Text = strAssign;
                                    DataSet   dsReports = oUser.GetManagerReports(intAppManager, intRequest, intService, intNumber);
                                    DataTable dtReports = dsReports.Tables[0].Copy();
                                    dtReports.Clear();
                                    DataSet dsAssignment = oService.GetUser(intService, -100);
                                    foreach (DataRow drAssignment in dsAssignment.Tables[0].Rows)
                                    {
                                        int     intAssignment = Int32.Parse(drAssignment["userid"].ToString());
                                        DataSet dsAssignees   = oUser.GetManagerReports(intAssignment, intRequest, intService, intNumber);
                                        foreach (DataRow drAssignee in dsAssignees.Tables[0].Rows)
                                        {
                                            dtReports.ImportRow(drAssignee);
                                        }
                                    }
                                    if (dtReports.Rows.Count > 0)
                                    {
                                        // Use custom assignment list
                                        // First, remove duplicates
                                        Hashtable hTable        = new Hashtable();
                                        ArrayList duplicateList = new ArrayList();
                                        foreach (DataRow drow in dtReports.Rows)
                                        {
                                            if (hTable.Contains(drow["userid"]))
                                            {
                                                duplicateList.Add(drow);
                                            }
                                            else
                                            {
                                                hTable.Add(drow["userid"], string.Empty);
                                            }
                                        }
                                        foreach (DataRow dRow in duplicateList)
                                        {
                                            dtReports.Rows.Remove(dRow);
                                        }

                                        // Next, sort by username
                                        dtReports.DefaultView.Sort = "username";

                                        // Now add to dataset
                                        dsReports = new DataSet();
                                        dsReports.Tables.Add(dtReports.DefaultView.ToTable());
                                    }
                                    LoadList(dsReports, intApp);
                                    LoadAvailable(dsReports, intApp);
                                    rptAssign.DataSource = dsAssigned;
                                    rptAssign.DataBind();
                                    foreach (RepeaterItem ri in rptAssign.Items)
                                    {
                                        ((LinkButton)ri.FindControl("btnDeleteAssign")).Attributes.Add("onclick", "return confirm('Are you sure you want to delete this assignment?');");
                                    }
                                    lblAssign.Visible = (rptAssign.Items.Count == 0);
                                    strSummary        = oResourceRequest.GetBodyOverallFix(intResourceParent, 0, intEnvironment, false);
                                    btnSubmit.Attributes.Add("onclick", "return ValidateChoice('" + divChoice.ClientID + "','" + radAccept.ClientID + "','" + radReject.ClientID + "','" + radHold.ClientID + "'," + dsAssigned.Tables[0].Rows.Count.ToString() + ") && ProcessButton(this);");
                                }
                                else
                                {
                                    Response.Write("no delegate");
                                    panDenied.Visible = true;
                                }
                            }
                        }
                        else
                        {
                            panDenied.Visible = true;
                        }
                    }
                    else
                    {
                        panDenied.Visible = true;
                    }
                }
            }
            btnClose.Attributes.Add("onclick", "return CloseWindow();");
            lnkAvailable.Attributes.Add("onclick", "return ShowHideAvailable('" + divAvailable.ClientID + "');");
            radAccept.Attributes.Add("onclick", "ShowHideDiv('" + divAccept.ClientID + "','inline');ShowHideDiv('" + divReject.ClientID + "','none');ShowHideDiv('" + divHold.ClientID + "','none');");
            radReject.Attributes.Add("onclick", "ShowHideDiv('" + divReject.ClientID + "','inline');ShowHideDiv('" + divAccept.ClientID + "','none');ShowHideDiv('" + divHold.ClientID + "','none');");
            radHold.Attributes.Add("onclick", "ShowHideDiv('" + divHold.ClientID + "','inline');ShowHideDiv('" + divAccept.ClientID + "','none');ShowHideDiv('" + divReject.ClientID + "','none');");
            txtManager.Attributes.Add("onkeyup", "return AJAXTextBoxGet(this,'300','195','" + divManager.ClientID + "','" + lstManager.ClientID + "','" + hdnManager.ClientID + "','" + oVariable.URL() + "/frame/users.aspx',2);");
            lstManager.Attributes.Add("ondblclick", "AJAXClickRow();");
            btnWhy.Attributes.Add("onclick", "return ShowHideAvailable('" + divWhy.ClientID + "');");
        }
Exemple #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            intProfile       = Int32.Parse(Request.Cookies["profileid"].Value);
            oPage            = new Pages(intProfile, dsn);
            oOrganization    = new Organizations(intProfile, dsn);
            oSegment         = new Segment(intProfile, dsn);
            oApplication     = new Applications(intProfile, dsn);
            oRequestItem     = new RequestItems(intProfile, dsn);
            oService         = new Services(intProfile, dsn);
            oSearch          = new Search(intProfile, dsn);
            oUser            = new Users(intProfile, dsn);
            oServiceRequest  = new ServiceRequests(intProfile, dsn);
            oResourceRequest = new ResourceRequest(intProfile, dsn);
            oProject         = new Projects(intProfile, dsn);
            oStatusLevel     = new StatusLevels();
            oProjectRequest  = new ProjectRequest(intProfile, dsn);
            oDocument        = new Documents(intProfile, dsn);
            oStatus          = new StatusLevels();
            oApprove         = new ProjectRequest_Approval(intProfile, dsn, intEnvironment);
            oCustomized      = new Customized(intProfile, dsn);
            oVariable        = new Variables(intEnvironment);
            oFunction        = new Functions(intProfile, dsn, intEnvironment);
            if (Request.QueryString["applicationid"] != null && Request.QueryString["applicationid"] != "")
            {
                intApplication = Int32.Parse(Request.QueryString["applicationid"]);
            }
            if (Request.QueryString["pageid"] != null && Request.QueryString["pageid"] != "")
            {
                intPage = Int32.Parse(Request.QueryString["pageid"]);
            }
            if (Request.Cookies["application"] != null && Request.Cookies["application"].Value != "")
            {
                intApplication = Int32.Parse(Request.Cookies["application"].Value);
            }
            bool boolUserSearch = false;

            if (Request.QueryString["pid"] != null && Request.QueryString["pid"] != "")
            {
                int intProject = Int32.Parse(Request.QueryString["pid"]);
                strProjectName      = oProject.GetName(intProject);
                lblProjectName.Text = """ + strProjectName + """;
                // INVOLVEMENT
                DataSet dsInvolvement = oResourceRequest.GetWorkflowProject(intProject);
                int     intOldUser    = 0;
                foreach (DataRow dr in dsInvolvement.Tables[0].Rows)
                {
                    if (intOldUser == Int32.Parse(dr["userid"].ToString()))
                    {
                        dr.Delete();
                    }
                    else
                    {
                        intOldUser = Int32.Parse(dr["userid"].ToString());
                    }
                }
                dsInvolvement = oResourceRequest.GetWorkflowProject(intProject);
                int intOldItem = 0;
                intOldUser = 0;
                foreach (DataRow dr in dsInvolvement.Tables[0].Rows)
                {
                    if (intOldItem == Int32.Parse(dr["itemid"].ToString()) && intOldUser == Int32.Parse(dr["userid"].ToString()))
                    {
                        dr.Delete();
                    }
                    else
                    {
                        intOldItem = Int32.Parse(dr["itemid"].ToString());
                        intOldUser = Int32.Parse(dr["userid"].ToString());
                    }
                }
                rptInvolvement.DataSource = dsInvolvement;
                rptInvolvement.DataBind();
                lblNoInvolvement.Visible = (rptInvolvement.Items.Count == 0);
                foreach (RepeaterItem ri in rptInvolvement.Items)
                {
                    Label _id       = (Label)ri.FindControl("lblId");
                    Label _user     = (Label)ri.FindControl("lblUser");
                    Label _status   = (Label)ri.FindControl("lblStatus");
                    Label _image    = (Label)ri.FindControl("lblImage");
                    int   intStatus = Int32.Parse(_status.Text);
                    int   intUser   = Int32.Parse(_user.Text);
                    _user.Text = oUser.GetFullName(intUser);
                    Label  _item        = (Label)ri.FindControl("lblItem");
                    int    intItem2     = Int32.Parse(_item.Text);
                    Label  _allocated   = (Label)ri.FindControl("lblAllocated");
                    Label  _used        = (Label)ri.FindControl("lblUsed");
                    double dblAllocated = oResourceRequest.GetAllocated(intProject, intUser, intItem2);
                    double dblUsed      = oResourceRequest.GetUsed(intProject, intUser, intItem2);
                    Label  _percent     = (Label)ri.FindControl("lblPercent");
                    _allocated.Text = dblAllocated.ToString();
                    _used.Text      = dblUsed.ToString();
                    if (dblAllocated > 0)
                    {
                        dblUsed       = dblUsed / dblAllocated;
                        _percent.Text = dblUsed.ToString("P");
                    }
                    else
                    {
                        _percent.Text = dblAllocated.ToString("P");
                    }
                    bool boolTPMDone = false;
                    if (intItem2 == 0)
                    {
                        _item.Text = "Project Coordinator";
                    }
                    else if (intItem2 == -1)
                    {
                        _item.Text = "Design Implementation (Pending Execution)";
                    }
                    else
                    {
                        int intApp = oRequestItem.GetItemApplication(intItem2);
                        _item.Text = oApplication.GetName(intApp);
                    }
                    _status.Text = oStatus.Name(intStatus);
                    if (boolTPMDone == true)
                    {
                        _status.Text = "Closed";
                    }
                }
            }
        }
        protected void LoadSearch(int _search)
        {
            Search          oSearch          = new Search(intProfile, dsn);
            RequestItems    oRequestItem     = new RequestItems(intProfile, dsn);
            Services        oService         = new Services(intProfile, dsn);
            Applications    oApplication     = new Applications(intProfile, dsn);
            StatusLevels    oStatusLevel     = new StatusLevels();
            Users           oUser            = new Users(intProfile, dsn);
            Projects        oProject         = new Projects(intProfile, dsn);
            ResourceRequest oResourceRequest = new ResourceRequest(intProfile, dsn);
            ServiceRequests oServiceRequest  = new ServiceRequests(intProfile, dsn);
            DataSet         ds             = oSearch.GetProject(_search);
            int             intApplication = 0;

            if (Request.QueryString["applicationid"] != null && Request.QueryString["applicationid"] != "")
            {
                intApplication = Int32.Parse(Request.QueryString["applicationid"]);
            }
            if (Request.Cookies["application"] != null && Request.Cookies["application"].Value != "")
            {
                intApplication = Int32.Parse(Request.Cookies["application"].Value);
            }
            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["userid"].ToString() == intProfile.ToString())
                {
                    string strType        = ds.Tables[0].Rows[0]["type"].ToString();
                    string strClause      = "cv_projects.deleted = 0 AND cv_projects.number NOT LIKE 'CV%' AND cv_projects.number NOT LIKE 'EPS%'";
                    string strOr1         = "";
                    string strOr2         = "";
                    string strSQL         = "SELECT DISTINCT '?pid=' + CAST(cv_projects.projectid AS varchar(10)) + '&sid=" + _search.ToString() + "' AS query, cv_projects.name, cv_projects.number, cv_projects.status, cv_projects.modified FROM cv_projects INNER JOIN cv_requests LEFT OUTER JOIN cv_service_requests ON cv_service_requests.requestid = cv_requests.requestid AND cv_service_requests.deleted = 0 LEFT OUTER JOIN cv_project_requests ON cv_project_requests.requestid = cv_requests.requestid AND cv_project_requests.deleted = 0 INNER JOIN cv_resource_requests INNER JOIN cv_request_items INNER JOIN cv_applications ON cv_request_items.applicationid = cv_applications.applicationid AND cv_applications.deleted = 0 ON cv_request_items.itemid = cv_resource_requests.itemid AND cv_request_items.deleted = 0 INNER JOIN cv_users ON cv_resource_requests.userid = cv_users.userid AND cv_users.deleted = 0 AND cv_users.enabled = 1 ON cv_requests.requestid = cv_resource_requests.requestid AND cv_resource_requests.deleted = 0 ON cv_requests.projectid = cv_projects.projectid AND cv_requests.deleted = 0 WHERE ";
                    string strApplication = " AND cv_request_items.applicationid = " + intApplication.ToString();
                    switch (strType)
                    {
                    case "O":
                        strApplication = "";
                        string strOName   = ds.Tables[0].Rows[0]["oname"].ToString().Trim();
                        string strONumber = ds.Tables[0].Rows[0]["onumber"].ToString().Trim();
                        if (strONumber != "")
                        {
                            strClause      += " AND cv_projects.number LIKE '%" + strONumber + "%'";
                            lblResults.Text = "Project Number LIKE "" + strONumber + """;
                        }
                        else
                        {
                            strClause      += " AND cv_projects.name LIKE '%" + strOName + "%'";
                            lblResults.Text = "Project Name LIKE "" + strOName + """;
                        }
                        string strOStatus = ds.Tables[0].Rows[0]["ostatus"].ToString();
                        if (strOStatus != "0")
                        {
                            strClause += " AND cv_projects.status = " + strOStatus;
                            if (lblResults.Text != "")
                            {
                                lblResults.Text += " AND ";
                            }
                            lblResults.Text += "Status = "" + oStatusLevel.Name(Int32.Parse(strOStatus)) + """;
                        }
                        string strOStart = ds.Tables[0].Rows[0]["ostart"].ToString();
                        if (strOStart != "")
                        {
                            strOStart  = DateTime.Parse(strOStart).ToShortDateString();
                            strClause += " AND cv_projects.modified > " + strOStart;
                            if (lblResults.Text != "")
                            {
                                lblResults.Text += " AND ";
                            }
                            lblResults.Text += "Project Date > "" + strOStart + """;
                        }
                        string strOEnd = ds.Tables[0].Rows[0]["oend"].ToString();
                        if (strOEnd != "")
                        {
                            strOEnd    = DateTime.Parse(strOEnd).ToShortDateString();
                            strClause += " AND cv_projects.modified < " + strOEnd;
                            if (lblResults.Text != "")
                            {
                                lblResults.Text += " AND ";
                            }
                            lblResults.Text += "Project Date < &quot;" + strOEnd + "&quot;";
                        }
                        break;

                    case "P":
                        string strDepartment = ds.Tables[0].Rows[0]["department"].ToString();
                        if (strDepartment == "0")
                        {
                            strApplication   = "";
                            lblResults.Text += "Department = &quot;ALL&quot;";
                        }
                        else
                        {
                            strApplication   = " AND cv_request_items.applicationid = " + strDepartment;
                            lblResults.Text += "Department = &quot;" + oApplication.GetName(Int32.Parse(strDepartment)) + "&quot;";
                        }
                        string strDStatus = ds.Tables[0].Rows[0]["dstatus"].ToString();
                        if (strDStatus != "0")
                        {
                            strClause += " AND cv_resource_requests.status = " + strDStatus;
                            if (lblResults.Text != "")
                            {
                                lblResults.Text += " AND ";
                            }
                            lblResults.Text += "Status = &quot;" + oStatusLevel.Name(Int32.Parse(strDStatus)) + "&quot;";
                        }
                        string strDStart = ds.Tables[0].Rows[0]["dstart"].ToString();
                        if (strDStart != "")
                        {
                            strDStart  = DateTime.Parse(strDStart).ToShortDateString();
                            strClause += " AND cv_requests.modified > " + strDStart;
                            if (lblResults.Text != "")
                            {
                                lblResults.Text += " AND ";
                            }
                            lblResults.Text += "Request Date > &quot;" + strDStart + "&quot;";
                        }
                        string strDEnd = ds.Tables[0].Rows[0]["dend"].ToString();
                        if (strDEnd != "")
                        {
                            strDEnd    = DateTime.Parse(strDEnd).ToShortDateString();
                            strClause += " AND cv_requests.modified < " + strDEnd;
                            if (lblResults.Text != "")
                            {
                                lblResults.Text += " AND ";
                            }
                            lblResults.Text += "Request Date < &quot;" + strDEnd + "&quot;";
                        }
                        break;

                    case "T":
                        string strTechnician = ds.Tables[0].Rows[0]["technician"].ToString();
                        if (strTechnician != "0")
                        {
                            strClause       += " AND cv_resource_requests.userid = " + strTechnician;
                            lblResults.Text += "Technician = &quot;" + oUser.GetFullName(Int32.Parse(strTechnician)) + "&quot;";
                        }
                        string strTStatus = ds.Tables[0].Rows[0]["tstatus"].ToString();
                        if (strTStatus != "0")
                        {
                            strClause += " AND cv_resource_requests.status = " + strTStatus;
                            if (lblResults.Text != "")
                            {
                                lblResults.Text += " AND ";
                            }
                            lblResults.Text += "Status = &quot;" + oStatusLevel.Name(Int32.Parse(strTStatus)) + "&quot;";
                        }
                        string strTStart = ds.Tables[0].Rows[0]["tstart"].ToString();
                        if (strTStart != "")
                        {
                            strTStart  = DateTime.Parse(strTStart).ToShortDateString();
                            strClause += " AND cv_requests.modified > " + strTStart;
                            if (lblResults.Text != "")
                            {
                                lblResults.Text += " AND ";
                            }
                            lblResults.Text += "Request Date > &quot;" + strTStart + "&quot;";
                        }
                        string strTEnd = ds.Tables[0].Rows[0]["tend"].ToString();
                        if (strTEnd != "")
                        {
                            strTEnd    = DateTime.Parse(strTEnd).ToShortDateString();
                            strClause += " AND cv_requests.modified < " + strTEnd;
                            if (lblResults.Text != "")
                            {
                                lblResults.Text += " AND ";
                            }
                            lblResults.Text += "Request Date < &quot;" + strTEnd + "&quot;";
                        }
                        break;

                    case "L":
                        string strLead = ds.Tables[0].Rows[0]["lead"].ToString();
                        if (strLead != "0")
                        {
                            int intLead = Int32.Parse(strLead);
                            strClause       += " AND cv_users.manager = " + intLead.ToString();
                            lblResults.Text += "Team Lead = &quot;" + oUser.GetFullName(intLead) + "&quot;";
                        }
                        string strLStatus = ds.Tables[0].Rows[0]["lstatus"].ToString();
                        if (strLStatus != "0")
                        {
                            strClause += " AND cv_resource_requests.status = " + strLStatus;
                            if (lblResults.Text != "")
                            {
                                lblResults.Text += " AND ";
                            }
                            lblResults.Text += "Status = &quot;" + oStatusLevel.Name(Int32.Parse(strLStatus)) + "&quot;";
                        }
                        string strLStart = ds.Tables[0].Rows[0]["lstart"].ToString();
                        if (strLStart != "")
                        {
                            strLStart  = DateTime.Parse(strLStart).ToShortDateString();
                            strClause += " AND cv_requests.modified > " + strLStart;
                            if (lblResults.Text != "")
                            {
                                lblResults.Text += " AND ";
                            }
                            lblResults.Text += "Request Date < &quot;" + strLStart + "&quot;";
                        }
                        string strLEnd = ds.Tables[0].Rows[0]["lend"].ToString();
                        if (strLEnd != "")
                        {
                            strLEnd    = DateTime.Parse(strLEnd).ToShortDateString();
                            strClause += " AND cv_requests.modified < " + strLEnd;
                            if (lblResults.Text != "")
                            {
                                lblResults.Text += " AND ";
                            }
                            lblResults.Text += "Request Date > &quot;" + strLEnd + "&quot;";
                        }
                        break;

                    case "G":
                        string strItem = ds.Tables[0].Rows[0]["itemid"].ToString();
                        if (strItem != "0")
                        {
                            strClause       += " AND cv_resource_requests.itemid = " + strItem;
                            lblResults.Text += "Activity Type = &quot;" + oRequestItem.GetItemName(Int32.Parse(strItem)) + "&quot;";
                        }
                        string strGStatus = ds.Tables[0].Rows[0]["gstatus"].ToString();
                        if (strGStatus != "0")
                        {
                            strClause += " AND cv_resource_requests.status = " + strGStatus;
                            if (lblResults.Text != "")
                            {
                                lblResults.Text += " AND ";
                            }
                            lblResults.Text += "Status = &quot;" + oStatusLevel.Name(Int32.Parse(strGStatus)) + "&quot;";
                        }
                        string strGStart = ds.Tables[0].Rows[0]["gstart"].ToString();
                        if (strGStart != "")
                        {
                            strGStart  = DateTime.Parse(strGStart).ToShortDateString();
                            strClause += " AND cv_requests.modified > " + strGStart;
                            if (lblResults.Text != "")
                            {
                                lblResults.Text += " AND ";
                            }
                            lblResults.Text += "Request Date < &quot;" + strGStart + "&quot;";
                        }
                        string strGEnd = ds.Tables[0].Rows[0]["gend"].ToString();
                        if (strGEnd != "")
                        {
                            strGEnd    = DateTime.Parse(strGEnd).ToShortDateString();
                            strClause += " AND cv_requests.modified < " + strGEnd;
                            if (lblResults.Text != "")
                            {
                                lblResults.Text += " AND ";
                            }
                            lblResults.Text += "Request Date > &quot;" + strGEnd + "&quot;";
                        }
                        break;

                    case "S":
                        break;
                    }
                    strClause = strClause + strApplication;
                    if (strOr1 != "" && strOr2 != "")
                    {
                        strClause = strClause + " AND " + strOr1 + " AND cv_project_requests.id IS NOT NULL OR " + strClause + " AND " + strOr1 + " AND cv_service_requests.id IS NOT NULL OR " + strClause + " AND " + strOr2 + " AND cv_project_requests.id IS NOT NULL OR " + strClause + " AND " + strOr2 + " AND cv_service_requests.id IS NOT NULL";
                    }
                    else
                    {
                        strClause = strClause + " AND cv_project_requests.id IS NOT NULL OR " + strClause + " AND cv_service_requests.id IS NOT NULL";
                    }
                    ds = SqlHelper.ExecuteDataset(dsn, CommandType.Text, strSQL + strClause);
                    DataView dv = ds.Tables[0].DefaultView;
                    if (Request.QueryString["sort"] != null)
                    {
                        dv.Sort = Request.QueryString["sort"];
                    }
                    rptView.DataSource = dv;
                    rptView.DataBind();
                    foreach (RepeaterItem ri in rptView.Items)
                    {
                        Label _progress = (Label)ri.FindControl("lblProgress");
                        Label _status   = (Label)ri.FindControl("lblStatus");
                        _status.Text = oStatusLevel.HTML(Int32.Parse(_status.Text));
                        Label _updated = (Label)ri.FindControl("lblUpdated");
                        Label _number  = (Label)ri.FindControl("lblNumber");
                        if (_number.Text == "")
                        {
                            _number.Text = "<i>TBD...</i>";
                        }
                        double dblUsed      = 0.00;
                        double dblAllocated = 0.00;
                        if (_progress.Text.Contains("?pid=") == true)
                        {
                            int intProject = 0;
                            if (Request.QueryString["sid"] != null && Request.QueryString["sid"] != "")
                            {
                                string strProgress = _progress.Text.Substring(0, _progress.Text.IndexOf("&"));
                                intProject = Int32.Parse(strProgress.Substring(5));
                            }
                            else
                            {
                                intProject = Int32.Parse(_progress.Text.Substring(5));
                            }
                            _updated.Text = oProject.GetLastUpdated(intProject);
                            DataSet dsAll = oResourceRequest.GetWorkflowProject(intProject);
                            foreach (DataRow drAll in dsAll.Tables[0].Rows)
                            {
                                int intResourceWorkflow = Int32.Parse(drAll["id"].ToString());
                                dblAllocated += double.Parse(oResourceRequest.GetWorkflow(intResourceWorkflow, "allocated"));
                                dblUsed      += oResourceRequest.GetWorkflowUsed(intResourceWorkflow);
                            }
                        }
                        else if (_progress.Text.Contains("?rid=") == true)
                        {
                            int     intRequest = Int32.Parse(_progress.Text.Substring(5));
                            DataSet dsAll      = oResourceRequest.GetWorkflowRequestAll(intRequest);
                            foreach (DataRow drAll in dsAll.Tables[0].Rows)
                            {
                                int intResourceWorkflow = Int32.Parse(drAll["id"].ToString());
                                dblAllocated += double.Parse(oResourceRequest.GetWorkflow(intResourceWorkflow, "allocated"));
                                dblUsed      += oResourceRequest.GetWorkflowUsed(intResourceWorkflow);
                            }
                        }
                        double dblProgress = 0.00;
                        if (dblAllocated > 0.00)
                        {
                            dblProgress = (dblUsed / dblAllocated) * 100.00;
                        }
                        _progress.Text = oServiceRequest.GetStatusBar(dblProgress, "100", "6", true);
                    }
                    lblNone.Visible = (rptView.Items.Count == 0);
                }
            }
        }
        private void LoadApplications(int _parent)
        {
            DataSet ds = oApplication.Gets(_parent, 1);

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                TreeNode oNode = new TreeNode();
                oNode.Text         = dr["name"].ToString();
                oNode.ToolTip      = dr["name"].ToString();
                oNode.ImageUrl     = "/images/folder.gif";
                oNode.SelectAction = TreeNodeSelectAction.Expand;
                oTreeview.Nodes.Add(oNode);
                LoadApplications(Int32.Parse(dr["applicationid"].ToString()));
                LoadItems(Int32.Parse(dr["applicationid"].ToString()), oNode);
                TreeNode oNew = new TreeNode();
                oNew.Text        = "&nbsp;Add Item";
                oNew.ToolTip     = "Add Item";
                oNew.ImageUrl    = "/images/green_right.gif";
                oNew.NavigateUrl = "javascript:Add('" + dr["applicationid"].ToString() + "','" + oApplication.GetName(Int32.Parse(dr["applicationid"].ToString())) + "');";
                oNode.ChildNodes.Add(oNew);
            }
            oTreeview.ExpandDepth = 1;
            oTreeview.Attributes.Add("oncontextmenu", "return false;");
        }
        private string GetSummary(int _requestid, int _serviceid, int _number)
        {
            Users           oUser           = new Users(intProfile, dsn);
            ServiceRequests oServiceRequest = new ServiceRequests(intProfile, dsn);
            RequestItems    oRequestItem    = new RequestItems(intProfile, dsn);
            Applications    oApplication    = new Applications(intProfile, dsn);
            StringBuilder   sbSummary       = new StringBuilder();
            DataSet         ds       = oResourceRequest.GetRequestService(_requestid, _serviceid, _number);
            int             intCount = 0;

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                intCount++;
                int           intResource  = Int32.Parse(dr["id"].ToString());
                double        dblAllocated = double.Parse(dr["allocated"].ToString());
                double        dblUsed      = oResourceRequest.GetWorkflowUsed(intResource);
                DataSet       dsStatus     = oResourceRequest.GetStatuss(intResource);
                string        strStatus    = "";
                StringBuilder sbStatuses   = new StringBuilder();
                bool          boolChange   = false;
                foreach (DataRow drStatus in dsStatus.Tables[0].Rows)
                {
                    double dblStatus = double.Parse(drStatus["status"].ToString());
                    strStatus = oResourceRequest.GetStatus(dblStatus, 30, 15);
                    if (boolChange == true)
                    {
                        sbStatuses.Append("<tr>");
                    }
                    else
                    {
                        sbStatuses.Append("<tr bgcolor=\"#F6F6F6\">");
                    }
                    sbStatuses.Append("<td nowrap valign=\"top\" align=\"center\">");
                    sbStatuses.Append(oResourceRequest.GetStatus(dblStatus, 30, 10));
                    sbStatuses.Append("</td>");
                    sbStatuses.Append("<td nowrap valign=\"top\" align=\"center\">");
                    sbStatuses.Append(DateTime.Parse(drStatus["modified"].ToString()).ToShortDateString());
                    sbStatuses.Append("</td>");
                    sbStatuses.Append("<td width=\"100%\" valign=\"top\">");
                    sbStatuses.Append(drStatus["comments"].ToString());
                    sbStatuses.Append("</td>");
                    sbStatuses.Append("</tr>");
                    boolChange = !boolChange;
                }
                if (sbStatuses.ToString() != "")
                {
                    sbStatuses.Insert(0, "<table width=\"100%\" cellpadding=\"3\" cellspacing=\"0\" border=\"0\" style=\"border:solid 1px #CCCCCC\"><tr bgcolor=\"#EEEEEE\"><td>&nbsp;</td><td><b><u>Date:</u></b></td><td><b><u>Comments:</u></b></td></tr>");
                    sbStatuses.Append("</table>");
                }
                double dblProgress = 0.00;
                if (dblAllocated > 0.00)
                {
                    dblProgress = (dblUsed / dblAllocated) * 100.00;
                }
                sbSummary.Append("<tr>");
                sbSummary.Append("<td><img src=\"/images/resource_people.gif\" border=\"0\" align=\"absmiddle\"></td>");
                int intUser = Int32.Parse(dr["userid"].ToString());
                sbSummary.Append("<td>");
                sbSummary.Append(intUser > 0 ? oUser.GetFullName(intUser) : "Pending Assignment");
                sbSummary.Append("</td>");
                sbSummary.Append("<td>");
                sbSummary.Append(oApplication.GetName(oRequestItem.GetItemApplication(Int32.Parse(dr["itemid"].ToString()))));
                sbSummary.Append("</td>");
                sbSummary.Append("<td nowrap align=\"center\">");
                sbSummary.Append(intUser > 0 ? strStatus : "---");
                sbSummary.Append("</td>");
                sbSummary.Append("<td nowrap width=\"100\">");
                sbSummary.Append(intUser > 0 ? oServiceRequest.GetStatusBar(dblProgress, "100", "14", true) : "---");
                sbSummary.Append("</td>");
                sbSummary.Append("<td width=\"1\" nowrap><a href=\"javascript:void(0);\" onclick=\"ShowHide('div");
                sbSummary.Append(intCount.ToString());
                sbSummary.Append("');\">[Details]</a></td>");
                sbSummary.Append("</tr>");
                sbSummary.Append("<tr>");
                sbSummary.Append("<td colspan=\"6\">");
                sbSummary.Append("<div id=\"div");
                sbSummary.Append(intCount.ToString());
                sbSummary.Append("\" style=\"display:none\">");
                sbSummary.Append(sbStatuses.ToString());
                sbSummary.Append("</div>");
                sbSummary.Append("</td>");
                sbSummary.Append("</tr>");
            }

            sbSummary.Insert(0, "<table width=\"100%\" cellpadding=\"3\" cellspacing=\"2\" border=\"0\"><tr><td></td><td><b><u>Technician:</u></b></td><td><b><u>Department:</u></b></td><td align=\"center\"><b><u>Status:</u></b></td><td><b><u>Progress:</u></b></td><td></td></tr>");
            sbSummary.Append("</table>");

            return(sbSummary.ToString());
        }
Exemple #12
0
        private string GetSummary(int _requestid, int _serviceid, int _number)
        {
            Users           oUser           = new Users(intProfile, dsn);
            ServiceRequests oServiceRequest = new ServiceRequests(intProfile, dsn);
            RequestItems    oRequestItem    = new RequestItems(intProfile, dsn);
            Applications    oApplication    = new Applications(intProfile, dsn);
            StatusLevels    oStatus         = new StatusLevels();
            StringBuilder   sbSummary       = new StringBuilder();
            DataSet         ds       = oResourceRequest.GetRequestService(_requestid, _serviceid, _number);
            int             intCount = 0;

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                intCount++;
                int    intResource  = Int32.Parse(dr["id"].ToString());
                int    intItem      = Int32.Parse(dr["itemid"].ToString());
                int    intNumber    = Int32.Parse(dr["number"].ToString());
                int    intStatus    = Int32.Parse(dr["status"].ToString());
                double dblAllocated = double.Parse(dr["allocated"].ToString());
                double dblProgress  = 0.00;
                if (intStatus == 3)
                {
                    dblProgress = 100.00;
                }
                else
                {
                    double dblUsed = oResourceRequest.GetWorkflowUsed(intResource);
                    if (dblAllocated > 0.00)
                    {
                        dblProgress = (dblUsed / dblAllocated) * 100.00;
                    }
                }
                string  strReason   = "Unavailable";
                int     intApproval = 0;
                DataSet dsReason    = oResourceRequest.GetApproval(_requestid, intItem, intNumber);
                if (dsReason.Tables[0].Rows.Count > 0)
                {
                    strReason = dsReason.Tables[0].Rows[0]["reason"].ToString().Trim();
                    if (strReason == "")
                    {
                        strReason = "<i>No additional information...</i>";
                    }
                    intApproval = Int32.Parse(dsReason.Tables[0].Rows[0]["approval"].ToString());
                }
                string strStatus  = oStatus.Name(intApproval);
                bool   boolResult = (intApproval == 1);
                sbSummary.Append("<tr>");
                sbSummary.Append("<td width=\"1\"><img src=\"/images/resource_people.gif\" border=\"0\" align=\"absmiddle\"></td>");
                int intUser = Int32.Parse(dr["userid"].ToString());
                sbSummary.Append("<td>");
                sbSummary.Append(intUser > 0 ? oUser.GetFullName(intUser) : "Pending Assignment");
                sbSummary.Append("</td>");
                sbSummary.Append("<td>");
                sbSummary.Append(oApplication.GetName(oRequestItem.GetItemApplication(Int32.Parse(dr["itemid"].ToString()))));
                sbSummary.Append("</td>");
                sbSummary.Append("<td nowrap align=\"center\">");
                sbSummary.Append(intUser > 0 ? strStatus : "---");
                sbSummary.Append("</td>");
                sbSummary.Append("<td nowrap width=\"100\">");
                sbSummary.Append(intUser > 0 ? oServiceRequest.GetStatusBar(dblProgress, "100", "14", true) : "---");
                sbSummary.Append("</td>");
                sbSummary.Append("<td width=\"1\" nowrap><a href=\"javascript:void(0);\" onclick=\"ShowHide('div");
                sbSummary.Append(intCount.ToString());
                sbSummary.Append("_1');\">[Details]</a>");
                sbSummary.Append(boolResult ? "&nbsp;<a href=\"javascript:void(0);\" onclick=\"ShowHide('div" + intCount.ToString() + "_2');\">[Result]</a>" : "");
                sbSummary.Append("</td>");
                sbSummary.Append("</tr>");
                sbSummary.Append("<tr>");
                sbSummary.Append("<td colspan=\"6\">");
                sbSummary.Append("<div id=\"div");
                sbSummary.Append(intCount.ToString());
                sbSummary.Append("_1\" style=\"display:none\">");
                sbSummary.Append(strReason);
                sbSummary.Append("</div>");

                if (boolResult == true)
                {
                    string  strResult = "";
                    DataSet dsResult  = oRequest.GetResult(_requestid, intItem, intNumber);
                    foreach (DataRow drResult in dsResult.Tables[0].Rows)
                    {
                        strResult += drResult["result"].ToString();
                    }
                    sbSummary.Append("<div id=\"div");
                    sbSummary.Append(intCount.ToString());
                    sbSummary.Append("_2\" style=\"display:none\">");
                    sbSummary.Append(strResult);
                    sbSummary.Append("</div>");
                }
                sbSummary.Append("</td>");
                sbSummary.Append("</tr>");
            }

            sbSummary.Insert(0, "<table width=\"100%\" cellpadding=\"3\" cellspacing=\"2\" border=\"0\"><tr><td></td><td><b><u>Technician:</u></b></td><td><b><u>Department:</u></b></td><td align=\"center\"><b><u>Status:</u></b></td><td><b><u>Progress:</u></b></td><td></td></tr>");
            sbSummary.Append("</table>");

            return(sbSummary.ToString());
        }
Exemple #13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            intProfile       = Int32.Parse(Request.Cookies["profileid"].Value);
            oProjectRequest  = new ProjectRequest(intProfile, dsn);
            oResourceRequest = new ResourceRequest(intProfile, dsn);
            oRequestItem     = new RequestItems(intProfile, dsn);
            oProject         = new Projects(intProfile, dsn);
            oPage            = new Pages(intProfile, dsn);
            oVariable        = new Variables(intEnvironment);
            oApplication     = new Applications(intProfile, dsn);
            oProjectNumber   = new ProjectNumber(intProfile, dsn);
            oRequest         = new Requests(intProfile, dsn);
            oRequestField    = new RequestFields(intProfile, dsn);
            oDocument        = new Documents(intProfile, dsn);
            oUser            = new Users(intProfile, dsn);
            oStatus          = new StatusLevels();
            oService         = new Services(intProfile, dsn);
            oDelegate        = new Delegates(intProfile, dsn);
            if (Request.QueryString["applicationid"] != null && Request.QueryString["applicationid"] != "")
            {
                intApplication = Int32.Parse(Request.QueryString["applicationid"]);
            }
            if (Request.QueryString["pageid"] != null && Request.QueryString["pageid"] != "")
            {
                intPage = Int32.Parse(Request.QueryString["pageid"]);
            }
            if (Request.Cookies["application"] != null && Request.Cookies["application"].Value != "")
            {
                intApplication = Int32.Parse(Request.Cookies["application"].Value);
            }
            if (Request.QueryString["pid"] != null && Request.QueryString["pid"] != "")
            {
                int intProject = Int32.Parse(Request.QueryString["pid"]);
                lblProject.Text = intProject.ToString();
                ds = oProject.GetCoordinator(intProject, 0);
                int  intCoordinator  = 0;
                int  intRequest      = 0;
                int  intResource     = 0;
                bool boolCoordinator = false;
                bool boolTPM         = false;
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    if ((Int32.Parse(dr["userid"].ToString()) == intProfile || oDelegate.Get(Int32.Parse(dr["userid"].ToString()), intProfile) > 0) && (Request.QueryString["search"] == null))
                    {
                        if (dr["tpm"].ToString() == "1")
                        {
                            boolTPM = true;
                        }
                        else
                        {
                            boolCoordinator = true;
                        }
                    }
                }
                if (ds.Tables[0].Rows.Count > 0)
                {
                    //panProject.Visible = true;
                    intRequest          = Int32.Parse(ds.Tables[0].Rows[0]["requestid"].ToString());
                    intResource         = Int32.Parse(ds.Tables[0].Rows[0]["id"].ToString());
                    intCoordinator      = Int32.Parse(ds.Tables[0].Rows[0]["userid"].ToString());
                    lblCoordinator.Text = oUser.GetFullName(intCoordinator);
                    lblPhone.Text       = (oUser.Get(intCoordinator, "phone") == "" ? "N / A" : oUser.Get(intCoordinator, "phone"));
                    string strEmail = oUser.GetEmail(oUser.GetName(intCoordinator), intEnvironment);
                    lblEmail.Text = (strEmail == "" ? "N / A" : "<a href=\"mailto:" + strEmail + "\" target=\"_blank\">" + strEmail + "</a>");
                    string strPager = oUser.Get(intCoordinator, "pager");
                    lblMobileDevice.Text = (strPager == "" || strPager == "0" ? "N / A" : strPager);
                    string strAt = oUser.Get(intCoordinator, "atid");
                    if (strAt != "0" && strAt != "")
                    {
                        Users_At oUserAt = new Users_At(intProfile, dsn);
                        strPager           += "@" + oUserAt.GetName(Int32.Parse(strAt));
                        lblMobileEmail.Text = "<a href=\"mailto:" + strPager + "\" target=\"_blank\">" + strPager + "</a>";
                    }
                    else
                    {
                        lblMobileEmail.Text = "N / A";
                    }
                }
                lblRequest.Text = intRequest.ToString();
                if (Request.QueryString["comm"] != null && Request.QueryString["comm"] != "")
                {
                    trCommunication.Visible = true;
                }
                if (boolTPM == true)
                {
                    //                if (CheckConfigured(intProject, intRequest, intResource) == true)
                    //                {
                    panControl.Visible = true;
                    Control oControl = (Control)LoadControl(strTPMWM);
                    phControl.Controls.Add(oControl);
                    LoadProject(intProject);
                    //                }
                    //                else
                    //                    panConfigure.Visible = true;
                }
                else if (boolCoordinator == true)
                {
                    panControl.Visible = true;
                    Control oControl = (Control)LoadControl(strPCWM);
                    phControl.Controls.Add(oControl);
                    LoadProject(intProject);
                }
                else if (oApplication.GetName(intApplication).Contains("IDC") == true || oApplication.GetName(intApplication).Contains("Integration Engineer") == true)
                {
                    panControl.Visible = true;
                    Control oControl = (Control)LoadControl("/controls/wm/wm_ie.ascx");
                    phControl.Controls.Add(oControl);
                    LoadProject(intProject);
                }
                else
                {
                    panWorkload.Visible = true;
                    ds = oResourceRequest.GetWorkflowProjectAll(intProject);
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        ds = oProjectRequest.GetProject(intProject);
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            btnViewPR.Text = "View Original Project Request";
                            btnViewPR.Attributes.Add("onclick", "return OpenWindow('PRINTER_FRIENDLY','?page=" + intViewRequest.ToString() + "&rid=" + intRequest.ToString() + "');");
                        }
                        else
                        {
                            //if (intResource > 0)
                            //{
                            //    btnViewPR.Text = "View Original Request Details";
                            //    btnViewPR.Attributes.Add("onclick", "return OpenWindow('PRINTER_FRIENDLY','?page=" + intViewResourceRequest.ToString() + "&rrid=" + intResource.ToString() + "');");
                            //}
                            //else
                            btnViewPR.Visible = false;
                        }
                        // Documents
                        btnDocuments.Attributes.Add("onclick", "return OpenWindow('DOCUMENTS_SECURE','?pid=" + intProject.ToString() + "');");
                        chkMyDescription.Checked = (Request.QueryString["mydoc"] != null);
                        lblMyDocuments.Text      = oDocument.GetDocuments_Mine(intProject, intProfile, oVariable.DocumentsFolder(), -1, (Request.QueryString["mydoc"] != null));
                        // GetDocuments(string _physical, int _projectid, int _requestid, int _userid, int _security, bool _show_description, bool _mine)
                        //lblMyDocuments.Text = oDocument.GetDocuments(Request.PhysicalApplicationPath, intProject, 0, intProfile, -1, (Request.QueryString["mydoc"] != null), true);
                        chkDescription.Checked = (Request.QueryString["doc"] != null);
                        lblDocuments.Text      = oDocument.GetDocuments_Project(intProject, intProfile, oVariable.DocumentsFolder(), 1, (Request.QueryString["doc"] != null));
                        // GetDocuments(string _physical, int _projectid, int _requestid, int _userid, int _security, bool _show_description, bool _mine)
                        //lblDocuments.Text = oDocument.GetDocuments(Request.PhysicalApplicationPath, intProject, 0, intProfile, 1, (Request.QueryString["doc"] != null), false);

                        /*
                         * ds = oResourceRequest.GetWorkflowProject(intProject);
                         * int intOldUser = 0;
                         * foreach (DataRow dr in ds.Tables[0].Rows)
                         * {
                         *  if (intOldUser == Int32.Parse(dr["userid"].ToString()))
                         *      dr.Delete();
                         *  else
                         *      intOldUser = Int32.Parse(dr["userid"].ToString());
                         * }
                         * ddlResource.DataValueField = "userid";
                         * ddlResource.DataTextField = "userid";
                         * ddlResource.DataSource = ds;
                         * ddlResource.DataBind();
                         * foreach (ListItem oItem in ddlResource.Items)
                         *  oItem.Text = oUser.GetFullName(Int32.Parse(oItem.Value));
                         * ddlResource.Items.Insert(0, new ListItem("-- SELECT --", "0"));
                         * // Load Involvement
                         * DataSet dsInvolvement = oResourceRequest.GetWorkflowProject(intProject);
                         * int intOldItem = 0;
                         * intOldUser = 0;
                         * foreach (DataRow dr in dsInvolvement.Tables[0].Rows)
                         * {
                         *  if (intImplementorDistributed == Int32.Parse(dr["itemid"].ToString()))
                         *      dr.Delete();
                         *  else if (intImplementorMidrange == Int32.Parse(dr["itemid"].ToString()))
                         *      dr.Delete();
                         *  else if (intOldItem == Int32.Parse(dr["itemid"].ToString()) && intOldUser == Int32.Parse(dr["userid"].ToString()))
                         *      dr.Delete();
                         *  else
                         *  {
                         *      intOldItem = Int32.Parse(dr["itemid"].ToString());
                         *      intOldUser = Int32.Parse(dr["userid"].ToString());
                         *  }
                         * }
                         * rptInvolvement.DataSource = dsInvolvement;
                         * rptInvolvement.DataBind();
                         * lblNoInvolvement.Visible = (rptInvolvement.Items.Count == 0);
                         * foreach (RepeaterItem ri in rptInvolvement.Items)
                         * {
                         *  Label _id = (Label)ri.FindControl("lblId");
                         *  Label _user = (Label)ri.FindControl("lblUser");
                         *  Label _status = (Label)ri.FindControl("lblStatus");
                         *  int intStatus = Int32.Parse(_status.Text);
                         *  int intUser = Int32.Parse(_user.Text);
                         *  _user.Text = oUser.GetFullName(intUser);
                         *  Label _item = (Label)ri.FindControl("lblItem");
                         *  int intItem = Int32.Parse(_item.Text);
                         *  Label _allocated = (Label)ri.FindControl("lblAllocated");
                         *  Label _used = (Label)ri.FindControl("lblUsed");
                         *  double dblAllocated = oResourceRequest.GetAllocated(intProject, intUser, intItem);
                         *  double dblUsed = oResourceRequest.GetUsed(intProject, intUser, intItem);
                         *  Label _percent = (Label)ri.FindControl("lblPercent");
                         *  _allocated.Text = dblAllocated.ToString();
                         *  _used.Text = dblUsed.ToString();
                         *  if (dblAllocated > 0)
                         *  {
                         *      dblUsed = dblUsed / dblAllocated;
                         *      _percent.Text = dblUsed.ToString("P");
                         *  }
                         *  else
                         *      _percent.Text = dblAllocated.ToString("P");
                         *  if (intItem == 0)
                         *      _item.Text = "Project Coordinator";
                         *  else
                         *  {
                         *      if (intItem == -1)
                         *          _item.Text = "Design Implementor";
                         *      else
                         *      {
                         *          int intApp = oRequestItem.GetItemApplication(intItem);
                         *          _item.Text = oApplication.GetName(intApp);
                         *      }
                         *  }
                         *  _status.Text = oStatus.Name(intStatus);
                         * }
                         */
                        // MY Involvement
                        DataSet dsMine = oResourceRequest.GetWorkflowProject(intProject);
                        //Check if new request
                        DataColumn oColumn;
                        oColumn            = new DataColumn();
                        oColumn.DataType   = System.Type.GetType("System.String");
                        oColumn.ColumnName = "new";
                        dsMine.Tables[0].Columns.Add(oColumn);
                        foreach (DataRow dr in dsMine.Tables[0].Rows)
                        {
                            if (intImplementorDistributed == Int32.Parse(dr["itemid"].ToString()))
                            {
                                dr.Delete();
                            }
                            else if (intImplementorMidrange == Int32.Parse(dr["itemid"].ToString()))
                            {
                                dr.Delete();
                            }
                            else if (DateTime.Parse(dr["created"].ToString()) <= DateTime.Parse(dr["modified"].ToString()))
                            {
                                dr["new"] = "1";
                            }
                            //else if (intProfile != Int32.Parse(dr["userid"].ToString()) && oDelegate.Get(Int32.Parse(dr["userid"].ToString()), intProfile) <= 0)
                            //    dr.Delete();
                        }
                        Functions oFunction = new Functions(0, dsn, intEnvironment);
                        rptMine.DataSource = dsMine;
                        rptMine.DataBind();
                        lblNoMine.Visible = (rptMine.Items.Count == 0);
                        foreach (RepeaterItem ri in rptMine.Items)
                        {
                            Label _id         = (Label)ri.FindControl("lblId");
                            Label _user       = (Label)ri.FindControl("lblUser");
                            Label _status     = (Label)ri.FindControl("lblStatus");
                            Label _color      = (Label)ri.FindControl("lblColor");
                            Label _service    = (Label)ri.FindControl("lblServiceId");
                            int   _serviceid  = Int32.Parse(_service.Text);
                            Label _name       = (Label)ri.FindControl("lblName");
                            Image imgDelegate = (Image)ri.FindControl("imgDelegate");
                            int   intStatus   = Int32.Parse(_status.Text);
                            int   intUser     = Int32.Parse(_user.Text);
                            if ((intStatus < 1 || intStatus > 2) && intStatus != 5)
                            {
                                ri.Visible = false;
                            }
                            else if (intUser != intProfile)
                            {
                                if (oDelegate.Get(intUser, intProfile) <= 0)
                                {
                                    ri.Visible = false;
                                }
                                else
                                {
                                    imgDelegate.Visible = true;
                                }
                            }
                            if (ri.Visible == true)
                            {
                                string strColor = _color.Text;
                                int    intGreen = 0;
                                Int32.TryParse(strColor.Substring(0, strColor.IndexOf("_")), out intGreen);
                                strColor = strColor.Substring(strColor.IndexOf("_") + 1);
                                int intYellow = 0;
                                Int32.TryParse(strColor.Substring(0, strColor.IndexOf("_")), out intYellow);
                                strColor = strColor.Substring(strColor.IndexOf("_") + 1);
                                int intRed = 0;
                                Int32.TryParse(strColor, out intRed);
                                strColor = "<table cellpadding=\"0\" cellspacing=\"2\" border=\"0\">";
                                if (intRed > 0)
                                {
                                    strColor += "<tr><td>" + oFunction.GetBox("FF0000", 15, 8) + "</td>" + (intRed > 1 ? "<td> (" + intRed.ToString() + ")</td>" : "") + "</tr>";
                                }
                                if (intYellow > 0)
                                {
                                    strColor += "<tr><td>" + oFunction.GetBox("FFFF00", 15, 8) + "</td>" + (intYellow > 1 ? "<td> (" + intYellow.ToString() + ")</td>" : "") + "</tr>";
                                }
                                if (intGreen > 0)
                                {
                                    strColor += "<tr><td>" + oFunction.GetBox("00FF00", 15, 8) + "</td>" + (intGreen > 1 ? "<td> (" + intGreen.ToString() + ")</td>" : "") + "</tr>";
                                }
                                strColor   += "</table>";
                                _color.Text = strColor;

                                if (_name.Text == "")
                                {
                                    _name.Text = oService.GetName(_serviceid);
                                }
                                Label  _item        = (Label)ri.FindControl("lblItem");
                                Label  _allocated   = (Label)ri.FindControl("lblAllocated");
                                double dblAllocated = double.Parse(_allocated.Text);
                                Label  _used        = (Label)ri.FindControl("lblUsed");
                                double dblUsed      = oResourceRequest.GetWorkflowUsed(Int32.Parse(_id.Text));
                                Label  _percent     = (Label)ri.FindControl("lblPercent");
                                int    intItem2     = Int32.Parse(_item.Text);
                                if (intItem2 == 0)
                                {
                                    _item.Text = "Project Coordinator";
                                }
                                else
                                {
                                    if (intItem2 == -1)
                                    {
                                        _item.Text = "Pending Execution";
                                    }
                                    else
                                    {
                                        int intApp = oRequestItem.GetItemApplication(intItem2);
                                        _item.Text = oApplication.GetName(intApp);
                                    }
                                }
                                _allocated.Text = dblAllocated.ToString();
                                _used.Text      = dblUsed.ToString();
                                if (dblAllocated > 0)
                                {
                                    dblUsed       = dblUsed / dblAllocated;
                                    _percent.Text = dblUsed.ToString("P");
                                }
                                else
                                {
                                    _percent.Text = dblAllocated.ToString("P");
                                }
                                _status.Text = oStatus.Name(intStatus);
                            }
                        }
                    }
                    else
                    {
                        panDenied.Visible = true;
                        lblTitle.Text     = "Zero Dataset ";
                    }
                    LoadProject(intProject);
                }
            }
            else
            {
                panDenied.Visible = true;
                lblTitle.Text     = "Invalid Querystring ";
            }
            btnDenied.Attributes.Add("onclick", "return CloseWindow();");
            btnConfigure.Attributes.Add("onclick", "return ValidateText('" + txtNumber.ClientID + "','Please enter the project number');");
        }
Exemple #14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            intProfile   = Int32.Parse(Request.Cookies["profileid"].Value);
            oPage        = new Pages(intProfile, dsn);
            oUser        = new Users(intProfile, dsn);
            oCustomized  = new Customized(intProfile, dsn);
            oVariable    = new Variables(intEnvironment);
            oApplication = new Applications(intProfile, dsn);
            oFunction    = new Functions(0, dsn, intEnvironment);
            string strNavigation = "";

            if (Request.QueryString["applicationid"] != null && Request.QueryString["applicationid"] != "")
            {
                intApplication = Int32.Parse(Request.QueryString["applicationid"]);
            }
            if (Request.QueryString["pageid"] != null && Request.QueryString["pageid"] != "")
            {
                intPage = Int32.Parse(Request.QueryString["pageid"]);
            }
            if (Request.Cookies["application"] != null && Request.Cookies["application"].Value != "")
            {
                intApplication = Int32.Parse(Request.Cookies["application"].Value);
            }

            //Menus
            int intMenuTab = 0;

            if (Request.QueryString["menu_tab"] != null && Request.QueryString["menu_tab"] != "")
            {
                intMenuTab = Int32.Parse(Request.QueryString["menu_tab"]);
            }
            //Tab oTab = new Tab("", intMenuTab, "divMenu1", true, false);
            Tab oTab = new Tab(hdnType.ClientID, intMenuTab, "divMenu1", true, false);

            oTab.AddTab("&quot;" + oApplication.GetName(intApplication) + "&quot; Documents", "");
            oTab.AddTab("Documents Shared by Other Departments", "");
            strMenuTab1 = oTab.GetTabs();
            //End Menus

            lblTitle.Text = oPage.Get(intPage, "title");
            strRedirect   = oPage.GetFullLink(intPage);

            if (lblCurrent.Text == "")
            {
                lblCurrent.Text = oVariable.DocumentsFolder() + "department\\" + intApplication.ToString();
                if (!Directory.Exists(lblCurrent.Text))
                {
                    DirectoryInfo drinfo = new DirectoryInfo(lblCurrent.Text);
                    drinfo.Create();
                    drinfo.LastAccessTime = DateTime.Now;
                    drinfo.LastWriteTime  = DateTime.Now;
                }
            }
            strHome      = lblCurrent.Text;
            strDirectory = strHome;

            if (strFolder == string.Empty)
            {
                strFolder = "\\";
            }

            if (!Page.IsPostBack)
            {
                if (Request.QueryString["folder"] != null && Request.QueryString["folder"] != "")
                {
                    string strFolderTemp = Request.QueryString["folder"];

                    if (!strFolderTemp.StartsWith("\\"))
                    {
                        strFolderTemp = "\\" + strFolderTemp;
                    }

                    if (Directory.Exists(strHome + strFolderTemp) == true)
                    {
                        strFolder    = strFolderTemp;
                        strDirectory = strHome + strFolderTemp;
                    }
                }

                dir_info = new DirectoryInfo(strDirectory);

                if (dir_info.Parent.Parent.Name != "documents")
                {
                    string strNav = strFolder;
                    while (strNav != "")
                    {
                        strNavigation = " / <a class=\"breadcrumb\" href=\"" + strRedirect + "?folder=" + Server.UrlEncode(strNav) + "\">" + strNav.Substring(strNav.LastIndexOf("\\") + 1) + "</a>" + strNavigation;
                        strNav        = strNav.Substring(0, strNav.LastIndexOf("\\"));
                    }
                    strRedirect = oPage.GetFullLink(intPage) + "?folder=" + strFolder.Substring(0, strFolder.LastIndexOf("\\"));
                    strFolder   = "<a href=\"" + strRedirect + "\">" + strFolder.Substring(0, strFolder.LastIndexOf("\\")) + "</a>" + strFolder.Substring(strFolder.LastIndexOf("\\"));
                }
                DataSet  ds = oCustomized.GetDocumentRepositoryApplication(intApplication, strDirectory);
                DataView dv = ds.Tables[0].DefaultView;
                if (Request.QueryString["sort"] != null && Request.QueryString["sort"] != "")
                {
                    if (Request.QueryString["sort"].ToLower().Contains("desc"))
                    {
                        dv.Sort = "type desc," + Request.QueryString["sort"];
                    }
                    else
                    {
                        dv.Sort = "type," + Request.QueryString["sort"];
                    }
                }
                else
                {
                    dv.Sort = "type desc";
                }

                rptDocs.DataSource = dv;
                rptDocs.DataBind();
                lblNoDocs.Visible = rptDocs.Items.Count == 0;

                DataSet dsOthers = oCustomized.GetDocumentRepositorySharesByApplication(intApplication);
                dsOthers.Relations.Add("relationship", dsOthers.Tables[0].Columns["applicationid"], dsOthers.Tables[1].Columns["applicationid"], false);
                DataView dvOthers = dsOthers.Tables[0].DefaultView;
                rptOthers.DataSource = dvOthers;
                rptOthers.DataBind();
                lblNoShares.Visible = rptOthers.Items.Count == 0;

                foreach (RepeaterItem ri in rptDocs.Items)
                {
                    LinkButton btnName    = (LinkButton)ri.FindControl("btnName");
                    Label      lblType    = (Label)ri.FindControl("lblType");
                    Label      lblDeleted = (Label)ri.FindControl("lblDeleted");
                    Label      lblId      = (Label)ri.FindControl("lblId");
                    Label      lblSize    = (Label)ri.FindControl("lblSize");

                    ImageButton imgDelete = (ImageButton)ri.FindControl("imgDelete");
                    ImageButton imgRename = (ImageButton)ri.FindControl("imgRename");
                    ImageButton imgShare  = (ImageButton)ri.FindControl("imgShare");
                    imgRename.Attributes.Add("onclick", "return OpenWindow('DOCUMENT_REPOSITORY_RENAME','?id=" + lblId.Text + "');");
                    imgShare.Attributes.Add("onclick", "return OpenWindow('DOCUMENT_REPOSITORY_SHARE','?id=" + imgShare.CommandArgument + "');");
                    imgDelete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this " + (lblType.Text.ToLower() != "folder" ? "File" : lblType.Text) + " ?');");

                    if (!FileExists(btnName.CommandArgument, lblType.Text))
                    {
                        btnName.Text      = btnName.Text + " (Not Found)";
                        btnName.Enabled   = false;
                        imgRename.Visible = false;
                        imgShare.Visible  = false;
                    }
                    else
                    {
                        if (lblType.Text.ToLower() != "folder")
                        {
                            btnName.Text = "<a href=\"" + oVariable.URL() + "/frame/document_repository_permissions.aspx?docid=" + oFunction.encryptQueryString(lblId.Text) + "\" target=\"_blank\">" + btnName.Text + "</a>";
                            //btnName.Text = "<a href=\"" + btnName.CommandArgument + "\" target=\"_blank\">" + btnName.Text + "</a>";
                            int     intSize = Int32.Parse(lblSize.Text);
                            decimal decSize = intSize / 1024;
                            if (decSize > 1024)
                            {
                                lblSize.Text = (Decimal.Round((decSize / 1024), 1)).ToString() + " MB";
                            }
                            else
                            {
                                lblSize.Text = (Decimal.Round(decSize, 0)).ToString() + " KB";
                            }
                        }
                        else
                        {
                            imgShare.Visible = false;
                        }
                    }
                }

                foreach (RepeaterItem riOther in rptOthers.Items)
                {
                    Repeater rptShared = (Repeater)riOther.FindControl("rptShared");
                    foreach (RepeaterItem ri in rptShared.Items)
                    {
                        LinkButton btnName    = (LinkButton)ri.FindControl("btnName");
                        Label      lblType    = (Label)ri.FindControl("lblType");
                        Label      lblId      = (Label)ri.FindControl("lblId");
                        Label      lblOwnerId = (Label)ri.FindControl("lblOwnerId");
                        Label      lblDeleted = (Label)ri.FindControl("lblDeleted");
                        Label      lblSize    = (Label)ri.FindControl("lblSize");

                        if (!FileExists(btnName.CommandArgument, lblType.Text))
                        {
                            btnName.Text    = btnName.Text + " (Not Found)";
                            btnName.Enabled = false;
                        }
                        else
                        {
                            if (lblType.Text.ToLower() != "folder")
                            {
                                btnName.Text = "<a href=\"" + oVariable.URL() + "/frame/document_repository_permissions.aspx?docid=" + oFunction.encryptQueryString(lblId.Text) + "\" target=\"_blank\">" + btnName.Text + "</a>";
                                int     intSize = Int32.Parse(lblSize.Text);
                                decimal decSize = intSize / 1024;
                                if (decSize > 1024)
                                {
                                    lblSize.Text = (Decimal.Round((decSize / 1024), 1)).ToString() + " MB";
                                }
                                else
                                {
                                    lblSize.Text = (Decimal.Round(decSize, 0)).ToString() + " KB";
                                }
                            }
                        }
                    }
                }

                lblTitle.Text  = oPage.Get(intPage, "title");
                lblFolder.Text = strFolder != "" ? "<a class=\"breadcrumb\" href=\"" + oPage.GetFullLink(intPage) + "\">Home</a>" + strNavigation : "<a class=\"breadcrumb\" href=\"" + oPage.GetFullLink(intPage) + "\">Home</a>";
                hdnDir.Value   = dir_info.FullName;
                btnCreate.Attributes.Add("onclick", "return ValidateText('" + txtDirectory.ClientID + "','Please enter a name for the new directory') && ValidateDirName('" + txtDirectory.ClientID + "') && ProcessButton(this);");
                btnUpload.Attributes.Add("onclick", "return ProcessButton(this);");
                txtDirectory.Attributes.Add("onkeydown", "if(event.which || event.keyCode){if ((event.which == 13) || (event.keyCode == 13)) {document.getElementById('" + btnCreate.ClientID + "').click();return false;}} else {return true}; ");
            }
        }