Exemplo n.º 1
0
        private void dgCostPlanList_ItemDataBound(object sender, DataGridItemEventArgs e)
        {
            switch (e.Item.ItemType)
            {
            case ListItemType.Item:
            case ListItemType.AlternatingItem:
                UserControls.InputCostBudgetDtl ud_ucCostBudgetDtl = (UserControls.InputCostBudgetDtl)e.Item.FindControl("ucCostBudgetDtl");
                Label ud_lblPBSName  = (Label)e.Item.FindControl("lblPBSName");
                Label ud_lblCostName = (Label)e.Item.FindControl("lblCostName");

                DataRowView ud_drvItem = (DataRowView)e.Item.DataItem;

                ud_ucCostBudgetDtl.CostBudgetSetCode = ud_drvItem["CostBudgetSetCode"].ToString();
                ud_ucCostBudgetDtl.CostCode          = ud_drvItem["CostCode"].ToString();

                ud_lblCostName.Text = ud_ucCostBudgetDtl.CostName;
                ud_lblPBSName.Text  = ud_ucCostBudgetDtl.PBSName;
                break;

            case ListItemType.Footer:
                Label ud_lblSumMoney = (Label)e.Item.FindControl("lblSumMoney");

                decimal ud_deSumMoney = ViewState["_SumMoney"] == null ? Decimal.Zero : (decimal)ViewState["_SumMoney"];

                ud_lblSumMoney.Text = ud_deSumMoney.ToString("N");
                break;
            }
        }
Exemplo n.º 2
0
        private void dgCostList_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
        {
            switch (e.Item.ItemType)
            {
            case ListItemType.Header:
                break;

            case ListItemType.Item:
            case ListItemType.AlternatingItem:
                string ud_sProjectCode = Request["ProjectCode"] + "";

                UserControls.ExchangeRateControl ud_ucExchangeRate  = (UserControls.ExchangeRateControl)e.Item.FindControl("ucExchangeRate");
                UserControls.InputCostBudgetDtl  ud_ucCostBudgetDtl = (UserControls.InputCostBudgetDtl)e.Item.FindControl("ucCostBudgetDtl");

                WebNumericEdit ud_txtCostTotalChangeCash = (WebNumericEdit)e.Item.FindControl("txtCostTotalChangeCash");

                DataRowView ud_drvItem = (DataRowView)e.Item.DataItem;


                ud_ucCostBudgetDtl.ProjectCode    = ud_sProjectCode;
                ud_txtCostTotalChangeCash.Enabled = false;

                ud_ucExchangeRate.IsShowTitle       = false;
                ud_ucExchangeRate.IsAllowCashChange = false;
                ud_ucExchangeRate.Cash = BLL.ConvertRule.ToDecimal(ud_drvItem["Cash"]);

                if (ud_drvItem["MoneyType"].ToString() != "")
                {
                    ud_ucExchangeRate.ExchangeRate = BLL.ConvertRule.ToDecimal(ud_drvItem["ExchangeRate"]);
                    ud_ucExchangeRate.MoneyType    = ud_drvItem["MoneyType"].ToString();
                }

                if (HttpUtility.HtmlDecode(e.Item.Cells[1].Text).Trim() != "")
                {
                    ((UserControls.InputCostBudgetDtl)e.Item.FindControl("ucCostBudgetDtl")).Enable = false;
                    ud_ucExchangeRate.EditMode = false;
                }
                else
                {
                    ((UserControls.InputCostBudgetDtl)e.Item.FindControl("ucCostBudgetDtl")).Enable = true;
                    ud_ucExchangeRate.EditMode = true;
                }

                ud_ucExchangeRate.BindControl();

                break;

            case ListItemType.Footer:
                //显示合计金额
                ((Label)e.Item.FindControl("lblSumCostOriginalMoney")).Text    = BLL.MathRule.GetDecimalShowString(ViewState["SumCostOriginalMoney"]);
                ((Label)e.Item.FindControl("lblSumCostTotalChangeMoney")).Text = BLL.MathRule.GetDecimalShowString(ViewState["SumCostTotalChangeMoney"]);
                ((Label)e.Item.FindControl("lblSumCostChangeMoney")).Text      = BLL.MathRule.GetDecimalShowString(ViewState["SumCostChangeMoney"]);
                ((Label)e.Item.FindControl("lblSumCostNewMoney")).Text         = BLL.MathRule.GetDecimalShowString(ViewState["SumCostNewMoney"]);
                break;

            default:
                break;
            }
        }
Exemplo n.º 3
0
        private string SaveToSession()
        {
            string alertMsg = "";

            try
            {
                string contractCode = this.txtContractCode.Value;
                string projectCode  = Request["ProjectCode"] + "";

                EntityData entity = ReadEntitySession();

                string contractLabel = txtContractChangeCode.Value;


                //合同变更基本信息
                entity.SetCurrentTable("ContractChange");
                foreach (DataRow dr in entity.CurrentTable.Select(String.Format("ContractChangeCode='{0}'", contractLabel), "", DataViewRowState.CurrentRows))
                {
                    dr["Voucher"]          = txtVoucher.Value;
                    dr["ContractChangeId"] = txtChangeId.Value;
                    dr["ChangeReason"]     = txtChangeReason.Value;

                    dr["SupplierChangeMoney"]  = txtSupplierChangeMoney.ValueDecimal;
                    dr["ConsultantAuditMoney"] = txtConsultantAuditMoney.ValueDecimal;
                    dr["ProjectAuditMoney"]    = txtProjectAuditMoney.ValueDecimal;

                    dr["ChangeType"] = this.ddlChangeType.SelectedItem.Value;
                }

                //款项明细
                entity.SetCurrentTable("ContractCostChange");

                foreach (DataGridItem li in this.dgCostList.Items)
                {
                    string contractCostChangeCode = li.Cells[0].Text;
                    string contractCostCode       = HttpUtility.HtmlDecode(li.Cells[1].Text).Trim();

                    UserControls.InputCostBudgetDtl  ucCostBudgetDtl   = (UserControls.InputCostBudgetDtl)li.FindControl("ucCostBudgetDtl");
                    UserControls.ExchangeRateControl ud_ucExchangeRate = (UserControls.ExchangeRateControl)li.FindControl("ucExchangeRate");

                    WebNumericEdit txtCostChangeCash = (WebNumericEdit)li.FindControl("txtCostChangeCash");
                    HtmlInputText  txtDescription    = (HtmlInputText)li.FindControl("txtDescription");

                    foreach (DataRow dr in entity.CurrentTable.Select(String.Format("ContractCostChangeCode='{0}'", contractCostChangeCode), "", DataViewRowState.CurrentRows))
                    {
                        decimal ud_deCostCash, ud_deCostOriginalCash, ud_deCostTotalChangeCash, ud_deCostChangeCash, ud_deCostNewCash, ud_deExchangeRate;
                        decimal ud_deCostMoney, ud_deCostOriginalMoney, ud_deCostTotalChangeMoney, ud_deCostChangeMoney, ud_deCostNewMoney;

                        ud_deCostCash            = (decimal)dr["Cash"];
                        ud_deCostOriginalCash    = (decimal)dr["OriginalCash"];
                        ud_deCostTotalChangeCash = (decimal)dr["TotalChangeCash"];


                        ud_deCostMoney            = (decimal)dr["Money"];
                        ud_deCostOriginalMoney    = (decimal)dr["OriginalMoney"];
                        ud_deCostTotalChangeMoney = (decimal)dr["TotalChangeMoney"];


                        ud_deCostChangeCash = txtCostChangeCash.ValueDecimal;
                        ud_deExchangeRate   = ud_ucExchangeRate.ExchangeRate;

                        ud_deCostNewCash = ud_deCostOriginalCash + ud_deCostTotalChangeCash + ud_deCostChangeCash;

                        ud_deCostNewMoney    = ud_deCostNewCash * ud_deExchangeRate;
                        ud_deCostChangeMoney = ud_deCostChangeCash * ud_deExchangeRate;

                        dr["ChangeCash"] = ud_deCostChangeCash;
                        dr["NewCash"]    = ud_deCostNewCash;

                        dr["ChangeMoney"] = ud_deCostChangeMoney;
                        dr["NewMoney"]    = ud_deCostNewMoney;
                        dr["Description"] = txtDescription.Value;

                        if (contractCostCode == "")
                        {
                            dr["CostCode"]          = ucCostBudgetDtl.CostCode;
                            dr["CostBudgetSetCode"] = ucCostBudgetDtl.CostBudgetSetCode;
                            dr["PBSType"]           = ucCostBudgetDtl.PBSType;
                            dr["PBSCode"]           = ucCostBudgetDtl.PBSCode;

                            dr["MoneyType"]    = ud_ucExchangeRate.MoneyType;
                            dr["ExchangeRate"] = ud_ucExchangeRate.ExchangeRate;
                        }
                    }
                }

                WriteEntitySession(entity);
                entity.Dispose();
            }
            catch (Exception ex)
            {
                ApplicationLog.WriteLog(this.ToString(), ex, "");
                Response.Write(Rms.Web.JavaScript.Alert(true, "保存Session出错:" + ex.Message));
            }
            return(alertMsg);
        }