コード例 #1
0
        public RevenueAddTDS.ProjectRevenueDataTable GetRevenueDetail()
        {
            projectRevenue = (RevenueAddTDS.ProjectRevenueDataTable)Session["projectRevenueDummy"];
            if (projectRevenue == null)
            {
                projectRevenue = ((RevenueAddTDS.ProjectRevenueDataTable)Session["projectRevenue"]);
            }

            return projectRevenue;
        }
コード例 #2
0
        protected void AddRevenueNewEmptyFix(GridView grdRevenue)
        {
            if (grdRevenue.Rows.Count == 0)
            {
                RevenueAddTDS.ProjectRevenueDataTable dt = new RevenueAddTDS.ProjectRevenueDataTable();
                dt.AddProjectRevenueRow(-1, -1,DateTime.Now, -1, "", false, -1, false, "", "", 1);
                Session["projectRevenueDummy"] = dt;

                grdRevenue.DataBind();
            }

            // normally executes at all postbacks
            if (grdRevenue.Rows.Count == 1)
            {
                RevenueAddTDS.ProjectRevenueDataTable dt = (RevenueAddTDS.ProjectRevenueDataTable)Session["projectRevenueDummy"];
                if (dt != null)
                {
                    grdRevenue.Rows[0].Visible = false;
                    grdRevenue.Rows[0].Controls.Clear();
                }
            }
        }
コード例 #3
0
        private void GrdRevenueDetailAdd()
        {
            if (FooterValidate())
            {
                Page.Validate("DataNew");
                if (Page.IsValid)
                {
                    int companyId = Int32.Parse(hdfCompanyId.Value);
                    DateTime date = (DateTime)((RadDatePicker)grdRevenue.FooterRow.FindControl("tkrdpDateFooter")).SelectedDate;

                    int clientId = Int32.Parse(((DropDownList)grdRevenue.FooterRow.FindControl("ddlClientFooter")).SelectedValue);
                    string client = ((DropDownList)grdRevenue.FooterRow.FindControl("ddlClientFooter")).SelectedItem.Text;

                    int projectId = Int32.Parse(((DropDownList)grdRevenue.FooterRow.FindControl("ddlProjectFooter")).SelectedValue);
                    string project = ((DropDownList)grdRevenue.FooterRow.FindControl("ddlProjectFooter")).SelectedItem.Text;

                    decimal revenue = decimal.Round(decimal.Parse(((TextBox)grdRevenue.FooterRow.FindControl("tbxRevenueFooter")).Text), 2);
                    string comment = ((TextBox)grdRevenue.FooterRow.FindControl("tbxCommentFooter")).Text;
                    bool deleted = false;
                    bool inDatabase = false;

                    // Insert Data
                    RevenueAddProjectRevenue revenueAddProjectRevenue = new RevenueAddProjectRevenue(revenueAddTDS);
                    revenueAddProjectRevenue.Insert(projectId, date, revenue, comment, deleted, companyId, inDatabase, client, project, clientId);

                    // Store dataset
                    Session["revenueAddTDS"] = revenueAddTDS;
                    Session.Remove("projectRevenueDummy");
                    projectRevenue = revenueAddTDS.ProjectRevenue;
                    Session["projectRevenue"] = revenueAddTDS.ProjectRevenue;

                    grdRevenue.DataBind();
                    grdRevenue.PageIndex = grdRevenue.PageCount - 1;
                }
            }
        }
コード例 #4
0
        // ////////////////////////////////////////////////////////////////////////
        // INITIAL EVENTS
        //
        protected void Page_Load(object sender, EventArgs e)
        {
            // Register client scripts
            this.RegisterClientScripts();

            if (!IsPostBack)
            {
                // Security check
                if (!(Convert.ToBoolean(Session["sgLFS_PROJECTS_REVENUE_ADD"])))
                {
                    Response.Redirect("./../../error_page.aspx?error=" + "You are not authorized to view this page. Contact your system administrator.");
                }

                // Validate query string
                if ((string)Request.QueryString["source_page"] == null)
                {
                    Response.Redirect("./../../error_page.aspx?error=" + "Invalid query string in revenue_add.aspx");
                }

                // Tag Page
                hdfCompanyId.Value = Convert.ToInt32(Session["companyID"]).ToString();
                Session.Remove("projectRevenueDummy");

                // If coming from
                // ... employee_navigator.aspx
                if (Request.QueryString["source_page"] == "lm")
                {
                    // ... Initialize tables
                    revenueAddTDS = new RevenueAddTDS();

                    // ... Store tables
                    Session["revenueAddTDS"] = revenueAddTDS;
                    Session["projectRevenue"] = revenueAddTDS.ProjectRevenue;
                }

                // StepSection1In
                wzRevenue.ActiveStepIndex = 0;
                StepDataIn();
            }
            else
            {
                // Restore tables
                revenueAddTDS = (RevenueAddTDS)Session["revenueAddTDS"];
                projectRevenue = revenueAddTDS.ProjectRevenue;
                Session["projectRevenue"] = revenueAddTDS.ProjectRevenue;
            }
        }
コード例 #5
0
        protected void grdRevenue_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            Page.Validate("DataEdit");
            if (Page.IsValid)
            {
                int companyId = Int32.Parse(hdfCompanyId.Value);
                int projectId = Int32.Parse(((Label)grdRevenue.Rows[e.RowIndex].Cells[0].FindControl("lblProjectIdEdit")).Text);

                int refId = Int32.Parse(((Label)grdRevenue.Rows[e.RowIndex].Cells[1].FindControl("lblRefIdEdit")).Text);
                DateTime date = (DateTime)((RadDatePicker)grdRevenue.Rows[e.RowIndex].Cells[4].FindControl("tkrdpDateEdit")).SelectedDate;

                decimal revenue = decimal.Round(decimal.Parse(((TextBox)grdRevenue.Rows[e.RowIndex].Cells[5].FindControl("tbxRevenueEdit")).Text), 2);

                string comment = ((TextBox)grdRevenue.Rows[e.RowIndex].Cells[6].FindControl("tbxCommentEdit")).Text;
                bool deleted = false;

                // Update Data
                RevenueAddProjectRevenue subcontractorAddProjectRevenueCosts = new RevenueAddProjectRevenue(revenueAddTDS);
                subcontractorAddProjectRevenueCosts.Update(projectId, refId, date, revenue, comment, deleted, companyId);

                // Store dataset
                Session["revenueAddTDS"] = revenueAddTDS;
                Session.Remove("projectRevenueDummy");
                projectRevenue = revenueAddTDS.ProjectRevenue;
                Session["projectRevenue"] = revenueAddTDS.ProjectRevenue;
            }
            else
            {
                e.Cancel = true;
            }
        }
コード例 #6
0
        // /////////////////////////////////////////////////////////////////////////////////////////////////////
        //
        // STEP1 - DATA
        //
        // ////////////////////////////////////////////////////////////////////////
        // STEP1 - DATA - EVENTS
        //
        protected void grdRevenue_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            // Revenue Gridview, if the gridview is edition mode
            if (grdRevenue.EditIndex >= 0)
            {
                grdRevenue.UpdateRow(grdRevenue.EditIndex, true);
            }

            // Delete Revenue
            int projectId = (int)e.Keys["ProjectID"];
            int refId = (int)e.Keys["RefID"];

            // Delete Revenue
            RevenueAddProjectRevenue revenueAddProjectRevenue = new RevenueAddProjectRevenue(revenueAddTDS);
            revenueAddProjectRevenue.Delete(projectId, refId);

            // Store dataset
            Session["revenueAddTDS"] = revenueAddTDS;
            Session.Remove("projectRevenueDummy");
            projectRevenue = revenueAddTDS.ProjectRevenue;
            Session["projectRevenue"] = revenueAddTDS.ProjectRevenue;
        }