Ejemplo n.º 1
0
    public void SumTotal()
    {
        DataTable contrast = CostApply.GetContrast(base.Request["ic"]);

        if (contrast.Rows.Count > 0)
        {
            System.Collections.Generic.Dictionary <string, decimal> dictionary = new System.Collections.Generic.Dictionary <string, decimal>();
            string  text  = "ThisAmount";
            decimal value = decimal.Parse(contrast.Compute("sum(" + text + ")", "1=1").ToString());
            dictionary.Add(text, value);
            DataTable dataTable = contrast.Clone();
            int       num       = -1;
            foreach (DataRow dataRow in contrast.Rows)
            {
                num++;
                if (num <= 0 || !(dataRow["CBSCode"].ToString() == contrast.Rows[num - 1]["CBSCode"].ToString()))
                {
                    DataRow dataRow2 = dataTable.NewRow();
                    dataRow2.ItemArray = dataRow.ItemArray;
                    dataTable.Rows.Add(dataRow2);
                }
            }
            decimal value2 = decimal.Parse((dataTable.Compute("SUM(MonthAmount)", "1=1") == null) ? 0m.ToString() : dataTable.Compute("SUM(MonthAmount)", "1=1").ToString());
            dictionary.Add("MonthAmount", value2);
            decimal value3 = decimal.Parse(dataTable.Compute("SUM(PrjAmount)", "1=1").ToString());
            dictionary.Add("PrjAmount", value3);
            decimal value4 = decimal.Parse(dataTable.Compute("SUM(PrjAlreadyAmount)", "1=1").ToString());
            dictionary.Add("PrjAlreadyAmount", value4);
            this.ViewState["sum"] = dictionary;
        }
    }
Ejemplo n.º 2
0
        public void DBTestMethod()
        {
            int costId = TimeTools.Timestamp();
            List <cost_detail> details = new List <cost_detail>
            {
                new cost_detail {
                    cost_id = costId, cost_type = "出差", money = 1213
                },
                new cost_detail {
                    cost_id = costId, cost_type = "住宿", money = 2324
                }
            };

            cost_main costMain = new cost_main
            {
                applicant      = "test",
                apply_money    = 1213.12M,
                apply_time     = DateTime.Now,
                approver       = "test",
                id             = costId,
                cost_detail    = details,
                status         = 1,
                approval_time  = DateTime.Now,
                approval_money = 131
            };
            CostApply costApply = new CostApply();
            int       a         = costApply.InsertBill(costMain);



            Console.WriteLine(a);
        }
Ejemplo n.º 3
0
    protected void BindRptContrast()
    {
        DataTable contrast = CostApply.GetContrast(base.Request["ic"]);

        this.rptContrast.DataSource = contrast;
        this.rptContrast.DataBind();
        if (contrast.Rows.Count == 0)
        {
            base.RegisterScript("$('#rptContrast tr:last-child').remove();");
        }
    }