Пример #1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            //Get and Insert Data
            PaymentData data = new PaymentData();
            ITransaction tran = factory.GetInsertObject(data);
            data.ModifiedBy = Page.User.Identity.Name;
            data.CreatedBy = Page.User.Identity.Name;
            data.Created = DateTime.Now.ToString("yyyyMMddHHmmss");
            data.Modified = DateTime.Now.ToString("yyyyMMddHHmmss");
            data.DelFlag = "0";

            data.BuildingId = Func.ParseString(Session["__BUILDINGID__"]);
            data.CustomerId = txtCustomerId.Text.Trim();
            data.YearMonth = hidYearMonth.Value;
            data.PaymentDate = Func.FormatYYYYmmdd(txtPaymentDate.Text.Trim().Substring(0,10));
            data.PaymentType = hidPaymentType.Value;
            data.PaidType = "1";
            data.Paymenter = txtPaymenter.Text.Trim();
            data.Receiver = txtReceiver.Text.Trim();
            data.MoneyUSD = (hidExchangeType.Value == "0") ? txtMoney.Text.Replace(",",".") : "0";
            data.MoneyVND = (hidExchangeType.Value == "1") ? txtMoney.Text.Replace(".", "") : "0";
            data.Comment = txtComment.Text.Trim();
            data.BookingId = hidBookingId.Value;

            Execute(tran);

            if (!HasError)
            {
                OperationLogger.WriteInfo(Constants.LogOperationAlbumId, Constants.LogActionInsertId, addSuccess, Page.User.Identity.Name);
                mvMessage.SetCompleteMessage(addSuccess);
                ScriptManager.RegisterClientScriptBlock(this.btnSave, this.GetType(), key, postback, true);
            }
            else
            {
                OperationLogger.WriteError(Constants.LogOperationAlbumId, Constants.LogActionInsertId, addUnSuccess, Page.User.Identity.Name);
                mvMessage.AddError(addUnSuccess);
            }
        }
        protected void btnPaid_Click(object sender, EventArgs e)
        {
            //string exchangetype = (rdoUSD.Checked == true) ? "0" : "1";
            //string money = (rdoUSD.Checked == true) ? txtPaidUSD.Text : txtPaidVND.Text;
            //ScriptManager.RegisterStartupScript(Page, this.GetType(), "", "PopUp('../../Customer/PaymentBooking.aspx?paymenttype=8&id=" + lnbCustomerId.Text + "&yearmonth=" + Func.FormatYYYYmmdd(lblBookingDate.Text).Substring(0, 6) + "&exchangetype=" + exchangetype + "&money=" + money + "&bookingid=" + hidId.Value + "',600,600,'PaymentBooking', true);", true);
            try
            {
                BD_RoomBookingData data = new BD_RoomBookingData();
                ITransaction tran = factory.GetLoadObject(data, hidId.Value);
                Execute(tran);
                if (!HasError)
                {
                    //Get Data
                    data = (BD_RoomBookingData)tran.Result;

                    data.ContractNo = txtContractNo.Text.Trim();
                    data.Rate = txtRate.Text.Trim();
                    data.RateDate = Func.Formatymdhms(txtRateDate.Text);
                    data.PaidMoneyType = rdoUSD.Checked == true ? "0" : "1";

                    data.ModifiedBy = Page.User.Identity.Name;
                    data.Modified = DateTime.Now.ToString("yyyyMMddHHmmss");

                    tran = factory.GetUpdateObject(data);
                    Execute(tran);

                    if (!HasError)
                    {
                        OperationLogger.WriteInfo(Constants.LogOperationAlbumId, Constants.LogActionInsertId, addSuccess, Page.User.Identity.Name);
                        mvMessage.SetCompleteMessage(addSuccess);
                    }
                    else
                    {
                        OperationLogger.WriteError(Constants.LogOperationAlbumId, Constants.LogActionInsertId, addUnSuccess, Page.User.Identity.Name);
                        mvMessage.AddError(addUnSuccess);
                    }
                }
            }
            catch (Exception ex)
            {
            }
            try
            {
                PaymentData data = new PaymentData();
                ITransaction tran = factory.GetInsertObject(data);
                data.ModifiedBy = Page.User.Identity.Name;
                data.CreatedBy = Page.User.Identity.Name;
                data.Created = DateTime.Now.ToString("yyyyMMddHHmmss");
                data.Modified = DateTime.Now.ToString("yyyyMMddHHmmss");
                data.DelFlag = "0";

                data.BuildingId = Func.ParseString(Session["__BUILDINGID__"]);
                data.CustomerId = lnbCustomerId.Text;
                data.PaymentDate = Func.FormatYYYYmmdd(txtContractDate.Text.Trim().Substring(0, 10));
                data.YearMonth = data.PaymentDate.Substring(0, 6);
                data.PaymentType = "8";
                data.PaidType = rdoUSD.Checked == true ? "0" : "1";
                data.Paymenter = txtPaymenter.Text.Trim();
                data.Receiver = txtReceiver.Text.Trim();
                data.MoneyUSD = (rdoUSD.Checked == true) ? txtPriceUSD.Text.Replace(",", ".") : "0";
                data.MoneyVND = (rdoVND.Checked == true) ? txtPriceVND.Text.Replace(",", ".") : "0";
                data.Comment = txtComment.Text.Trim();
                data.BookingId = hidId.Value;

                Execute(tran);

                if (!HasError)
                {
                    OperationLogger.WriteInfo(Constants.LogOperationAlbumId, Constants.LogActionInsertId, addSuccess, Page.User.Identity.Name);
                    mvMessage.SetCompleteMessage(addSuccess);
                }
                else
                {
                    OperationLogger.WriteError(Constants.LogOperationAlbumId, Constants.LogActionInsertId, addUnSuccess, Page.User.Identity.Name);
                    mvMessage.AddError(addUnSuccess);
                }
            }
            catch (Exception ex)
            { }
        }