コード例 #1
0
        public void SetCurrentSimpleExpense()
        {
            if (Session["CurrentRecommendExpense"] != null)
            {
                if (InitialFlag.Equals(FlagEnum.NewFlag) && IsRepOffice)
                {
                    IList <RecommendExpenseData> RecommendList = (IList <RecommendExpenseData>)Session["CurrentRecommendExpense"];

                    if (RecommendList.Count == ctlSimpleExpenseGridView.Rows.Count)
                    {
                        for (int i = 0; i < RecommendList.Count; i++)
                        {
                            GridViewRow row = ctlSimpleExpenseGridView.Rows[i];
                            UserControls.LOV.SCG.DB.CostCenterField      cost    = row.FindControl("ctlCostCenterLabelLookup") as UserControls.LOV.SCG.DB.CostCenterField;
                            UserControls.LOV.SCG.DB.AccountField         account = row.FindControl("ctlAccountLabelLookup") as UserControls.LOV.SCG.DB.AccountField;
                            UserControls.LOV.SCG.DB.IOAutoCompleteLookup io      = row.FindControl("ctlIOLabelLookup") as UserControls.LOV.SCG.DB.IOAutoCompleteLookup;
                            TextBox des       = row.FindControl("ctlTxtDescription") as TextBox;
                            TextBox amount    = row.FindControl("ctlTxtCurrencyAmount") as TextBox;
                            TextBox reference = row.FindControl("ctlTxtRefNo") as TextBox;

                            cost.BindCostCenterControl(UIHelper.ParseLong(RecommendList[i].CostCenterID));
                            account.BindAccountControl(UIHelper.ParseLong(RecommendList[i].ExpenseID));
                            io.BindIOControl(UIHelper.ParseLong(RecommendList[i].InternalID));
                            des.Text       = RecommendList[i].Description;
                            amount.Text    = RecommendList[i].Amount;
                            reference.Text = RecommendList[i].RefNo;
                        }
                    }
                }
            }
        }
コード例 #2
0
        protected void ctlSimpleExpenseGridView_RowDatabound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                UserControls.Dropdownlist.SS.DB.CurrencyDropdown currencyDropdown = e.Row.FindControl("ctlCurrencyDropdown") as UserControls.Dropdownlist.SS.DB.CurrencyDropdown;
                currencyDropdown.GridViewRowIndex = e.Row.RowIndex;
                currencyDropdown.BindCurrency(ParameterServices.USDCurrencyID);
                UserControls.LOV.SCG.DB.CostCenterField      cost    = e.Row.FindControl("ctlCostCenterLabelLookup") as UserControls.LOV.SCG.DB.CostCenterField;
                UserControls.LOV.SCG.DB.AccountField         account = e.Row.FindControl("ctlAccountLabelLookup") as UserControls.LOV.SCG.DB.AccountField;
                UserControls.LOV.SCG.DB.IOAutoCompleteLookup io      = e.Row.FindControl("ctlIOLabelLookup") as UserControls.LOV.SCG.DB.IOAutoCompleteLookup;
                HiddenField costId    = e.Row.FindControl("ctlCostCenter") as HiddenField;
                HiddenField accountId = e.Row.FindControl("ctlAccountID") as HiddenField;

                if (CompanyIDRequester == CompanyID)
                {
                    cost.BindCostCenterControl(UIHelper.ParseLong(costId.Value));
                }
                cost.CompanyId             = CompanyID;
                io.CompanyId               = CompanyID;
                cost.AccountFieldControlID = account.ID;
                cost.IOFieldControlID      = io.ID;

                account.WithoutExpenseCode = ParameterServices.AccountMileageExtra + "," + ParameterServices.AccountPerdiem;
                account.BindAccountControl(UIHelper.ParseLong(accountId.Value));
                if (cost.CostCenterId != "")
                {
                    io.CostCenterId = UIHelper.ParseLong(cost.CostCenterId);
                }

                account.CompanyIDofDocument = CompanyID;

                TextBox amount         = e.Row.FindControl("ctlTxtAmountTHB") as TextBox;
                TextBox currencyAmount = e.Row.FindControl("ctlTxtCurrencyAmount") as TextBox;
                TextBox exchangeRate   = e.Row.FindControl("ctlTxtExchangeRate") as TextBox;

                if (this.DocumentType.Equals(ZoneType.Foreign))
                {
                    currencyAmount.Attributes.Remove("onblur");
                    exchangeRate.Attributes.Remove("onblur");
                    currencyAmount.Attributes.Add("onblur", string.Format("calAmountTHB({0}, {1}, {2});", currencyAmount.ClientID, exchangeRate.ClientID, amount.ClientID));
                    exchangeRate.Attributes.Add("onblur", string.Format("calAmountTHB({0}, {1}, {2});", currencyAmount.ClientID, exchangeRate.ClientID, amount.ClientID));
                }
                else
                {
                    amount.ReadOnly = false;
                }

                if (InitialFlag.Equals(FlagEnum.NewFlag))
                {
                    TextBox des       = e.Row.FindControl("ctlTxtDescription") as TextBox;
                    TextBox reference = e.Row.FindControl("ctlTxtRefNo") as TextBox;

                    des.Text            = string.Empty;
                    amount.Text         = string.Empty;
                    reference.Text      = string.Empty;
                    currencyAmount.Text = string.Empty;
                    exchangeRate.Text   = string.Empty;
                    if (IsRepOffice)
                    {
                        if (this.DocumentType.Equals(ZoneType.Foreign))
                        {
                            if (this.FinalCurrencyID == UIHelper.ParseShort(currencyDropdown.SelectedValue))
                            {
                                exchangeRate.Text = UIHelper.BindExchangeRate("1");
                            }
                        }
                    }
                }
            }
        }