/// <summary>
        /// Load data
        /// </summary>
        private void LoadData()
        {
            BD_RoomData data = new BD_RoomData();
            ITransaction tran = factory.GetLoadObject(data, id);
            Execute(tran);
            if (!HasError)
            {
                //Get Data
                data = (BD_RoomData)tran.Result;
                lblRoomId.Text = data.id;
                lblName.Text = data.Name;
                lblArea.Text = data.Area;
                lblFloor.Text = data.Floor;
            }
            DbHelper.FillListSearch(drpCustomerId, "SELECT CustomerId,CustomerId + '-' + Name as Name  FROM Customer Where BuildingId = '" + Func.ParseString(Session["__BUILDINGID__"]) + "'", "Name", "CustomerId");

            ShowData();
        }
Esempio n. 2
0
        /// <summary>
        /// Insert data
        /// </summary>
        private void InsertData()
        {
            BD_RoomData dataR = new BD_RoomData();
            ITransaction tranR = factory.GetLoadObject(dataR, lblRoomId.Text);
            Execute(tranR);
            if (!HasError)
            {
                //Get Data
                dataR = (BD_RoomData)tranR.Result;

                //Get and Insert Data
                BD_RoomExtraTimeData data = new BD_RoomExtraTimeData();
                ITransaction tran = factory.GetInsertObject(data);
                data.CustomerId = drpCustomerId.SelectedValue;

                data.WorkingDate = Func.FormatYYYYmmdd(txtWorkingDate.Text.Trim());
                //data.EndWD = Func.FormatYYYYmmdd(txtEndWD.Text.Trim());
                data.YearMonth = drpYear.SelectedValue + drpMonth.SelectedValue;

                data.ExtraHour = txtExtraHour.Text.Replace(",", ".");
                data.Comment = txtComment.Text.Trim();

                data.Vat = dataR.Vat.Replace(",", ".");
                data.PriceUSD = dataR.MonthExtraTimePriceUsd.Replace(",", ".");
                data.PriceVND = dataR.MonthExtraTimePriceVND.Replace(",", ".");

                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.RoomId = lblRoomId.Text;
                data.BuildingId = Func.ParseString(Session["__BUILDINGID__"]);

                Execute(tran);

                if (!HasError)
                {
                    OperationLogger.WriteInfo(Constants.LogOperationAlbumId, Constants.LogActionInsertId, addSuccess, Page.User.Identity.Name);
                    mvMessage.SetCompleteMessage(addSuccess);
                    ScriptManager.RegisterClientScriptBlock(this.btnRegister, this.GetType(), key, postback, true);

                    ShowData();
                }
                else
                {
                    OperationLogger.WriteError(Constants.LogOperationAlbumId, Constants.LogActionInsertId, addUnSuccess, Page.User.Identity.Name);
                    mvMessage.AddError(addUnSuccess);
                }
            }
        }
        /// <summary>
        /// Init values
        /// </summary>
        protected override void DoInit()
        {
            try
            {
                Hashtable tmp = new Hashtable();
                for (int i = 0; i < 24; i++)
                {
                    drpHourFrom.Items.Add(new ListItem(Func.ParseString(i).PadLeft(2, '0'), Func.ParseString(i).PadLeft(2, '0')));
                    drpHourTo.Items.Add(new ListItem(Func.ParseString(i).PadLeft(2, '0'), Func.ParseString(i).PadLeft(2, '0')));
                }
                drpHourFrom.Items.FindByValue(DateTime.Now.AddHours(-1).ToString("hh")).Selected = true;
                drpHourTo.Items.FindByValue(DateTime.Now.AddHours(1).ToString("hh")).Selected = true;

                BD_RoomBookingData data = new BD_RoomBookingData();
                ITransaction tran = factory.GetLoadObject(data, hidId.Value);
                Execute(tran);
                if (!HasError)
                {
                    //Get Data
                    data = (BD_RoomBookingData)tran.Result;
                    lnbCustomerId.Text = data.CustomerId;

                    lblBookingDate.Text = Func.FormatDMY(data.BookingDate);
                    drpHourFrom.SelectedValue = data.BookingHourFrom.PadLeft(2, '0');
                    drpHourTo.SelectedValue = data.BookingHourTo.PadLeft(2, '0');
                    drpMinuteFrom.Value = data.BookingMinuteFrom.PadLeft(2, '0');
                    drpMinuteTo.Value = data.BookingMinuteTo.PadLeft(2, '0');

                    txtPriceVND.Text = Func.ParseString(Func.ParseDouble(data.PriceVND));
                    txtPriceUSD.Text = data.PriceUSD;
                    txtVat.Text = data.VAT;
                    chkBookingType.Checked = (data.BookingType == "1" ? true : false);

                    txtContractNo.Text = data.ContractNo;
                    txtRate.Text = Func.ParseString(Func.ParseDouble(data.Rate));
                    txtRateDate.Text = data.RateDate;

                    float hour = Func.ParseInt(data.BookingHourTo) - Func.ParseInt(data.BookingHourFrom);
                    int hourOdd = Func.ParseInt(data.BookingMinuteTo) - Func.ParseInt(data.BookingMinuteFrom);
                    if (hourOdd < 0)
                    {
                        hour--;
                    }
                    else
                    {
                        hour += Func.ParseFloat(hourOdd) / 60;
                    }

                    //lblSumVND.Text = Func.ParseString((long)(Func.ParseFloat(data.PriceVND) * hour) + (long)(Func.ParseFloat(data.PriceVND) * hour * Func.ParseFloat(data.VAT) / 100));
                    //lblSumUSD.Text = Func.ParseString(Func.ParseFloat(data.PriceUSD) * hour) + Func.ParseString(Func.ParseFloat(data.PriceUSD) * hour * Func.ParseFloat(data.VAT) / 100);
                    txtComment.Text = data.Comment;

                    if ("1".Equals(data.Status))
                    {
                        btnConfirm.Visible = false;
                        divPaid.Visible = true;
                    }
                    else
                    {
                        divPaid.Visible = false;
                    }
                }

                BD_RoomData dataR = new BD_RoomData();
                ITransaction tranR = factory.GetLoadObject(dataR, data.RoomId);
                Execute(tranR);
                if (!HasError)
                {
                    //Get Data
                    dataR = (BD_RoomData)tranR.Result;
                    lblName.Text = dataR.Name;
                    lblComment.Text = dataR.Comment;

                    lblRegional.Text = dataR.Regional;
                    lblFloor.Text = dataR.Floor;
                    lblArea.Text = dataR.Area;

                    lblHourManagerPriceVND.Text = dataR.HourRentPriceVND;
                    lblHourManagerPriceUSD.Text = dataR.HourRentPriceUSD;
                    lblVat.Text = data.VAT;

                }

                //string sql = " SELECT sum(PriceVND*Mount+PriceVND*Mount*VAT/100) VND,sum(PriceUSD*Mount+PriceUSD*Mount*VAT/100) USD";
                //sql += " FROM [BD_RoomBookingService]";
                //sql += " WHERE (ID IS NOT NULL) and DelFlag <> 1 and BookingId = '" + hidId.Value + "'";

                //DataTable dt = DbHelper.GetDataTable(sql);
                //for (int i = 0; i < dt.Rows.Count; i++)
                //{
                //    lblSumServiceVND.Text = Func.ParseString(dt.Rows[i]["VND"]);
                //    lblSumServiceUSD.Text = Func.ParseString(dt.Rows[i]["USD"]);
                //}
                //lblSumPriceUSD.Text = "" + (Func.ParseFloat(lblSumUSD.Text) + Func.ParseFloat(lblSumServiceUSD.Text));
                //lblSumPriceVND.Text = "" + (Func.ParseDouble(lblSumVND.Text) + Func.ParseDouble(lblSumServiceVND.Text));

                //sql = " SELECT sum(MoneyUSD) USD,sum(MoneyVND) VND ";
                //sql += " FROM [Payment]";
                //sql += " WHERE (ID IS NOT NULL) and DelFlag <> 1 and BookingId = '" + hidId.Value + "'";

                //dt = DbHelper.GetDataTable(sql);
                //for (int i = 0; i < dt.Rows.Count; i++)
                //{
                //    lblPaidUSD.Text = Func.ParseString(dt.Rows[i]["VND"]);
                //    lblPaidVND.Text = Func.ParseString(dt.Rows[i]["USD"]);
                //}
                //txtPaidUSD.Text = "" + (Func.ParseFloat(lblSumPriceUSD.Text) - Func.ParseFloat(lblPaidUSD.Text));
                //txtPaidVND.Text = "" + (Func.ParseDouble(lblSumPriceVND.Text) - Func.ParseDouble(lblPaidVND.Text));

                string sql = " SELECT LastPriceVND VND,LastPriceUSD USD";
                sql += " FROM [PaymentBooking]";
                sql += " WHERE BookingId = '" + hidId.Value + "'";

                DataTable dt = DbHelper.GetDataTable(sql);
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    lblSumVND.Text = Func.ParseString(Func.ParseDouble(dt.Rows[i]["VND"]));
                    lblSumUSD.Text = Func.ParseString(dt.Rows[i]["USD"]);
                }

                //lblSumVND.Text = Func.ParseString((long)(Func.ParseFloat(data.PriceVND) * hour) + (long)(Func.ParseFloat(data.PriceVND) * hour * Func.ParseFloat(data.VAT) / 100));
                //lblSumUSD.Text = Func.ParseString(Func.ParseFloat(data.PriceUSD) * hour) + Func.ParseString(Func.ParseFloat(data.PriceUSD) * hour * Func.ParseFloat(data.VAT) / 100);
                sql = " SELECT sum(LastPriceVND) VND,sum(LastPriceUSD) USD";
                sql += " FROM [PaymentBookingService]";
                sql += " WHERE BookingId = '" + hidId.Value + "'";

                dt = DbHelper.GetDataTable(sql);
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    lblSumServiceVND.Text = Func.ParseString(Func.ParseFloat(dt.Rows[i]["VND"]));
                    lblSumServiceUSD.Text = Func.ParseString(dt.Rows[i]["USD"]);
                }

                lblSumPriceUSD.Text = "" + (Func.ParseFloat(lblSumUSD.Text) + Func.ParseFloat(lblSumServiceUSD.Text));
                lblSumPriceVND.Text = "" + (Func.ParseDouble(lblSumVND.Text) + Func.ParseDouble(lblSumServiceVND.Text));

                sql = " SELECT sum(MoneyUSD) USD,sum(MoneyVND) VND ";
                sql += " FROM [Payment]";
                sql += " WHERE (ID IS NOT NULL) and DelFlag <> 1 and BookingId = '" + hidId.Value + "'";

                dt = DbHelper.GetDataTable(sql);
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    lblPaidUSD.Text = Func.ParseString(Func.ParseFloat(dt.Rows[i]["USD"]));
                    lblPaidVND.Text = Func.ParseString(Func.ParseDouble(dt.Rows[i]["VND"]));
                }
                txtPaidUSD.Text = "" + (Func.ParseFloat(lblSumPriceUSD.Text) - Func.ParseFloat(lblPaidUSD.Text));
                txtPaidVND.Text = "" + (Func.ParseDouble(lblSumPriceVND.Text) - Func.ParseDouble(lblPaidVND.Text));
                ShowData();

                string tmpPaid = DbHelper.GetScalar("Select count(*) from Payment Where BookingId = '" + hidId.Value + "' and DelFlag = '0' and PaymentType = '8'");
                if ("1".Equals(tmpPaid))
                {
                    btnPaid.Visible = false;
                }
            }
            catch (Exception ex)
            {
                Console.Write(ex);
            }
            //return tmp;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                hidId.Value = Func.ParseString(Request["id"]);

                PopupWidth = 600;
                PopupHeight = 450;
                ShowData();
                DbHelper.FillListSearch(drpCustomerId, "SELECT CustomerId,CustomerId + '-' + Name as Name  FROM Customer Where BuildingId = '" + Func.ParseString(Session["__BUILDINGID__"]) + "'", "Name", "CustomerId");

                BD_RoomData data = new BD_RoomData();
                ITransaction tran = factory.GetLoadObject(data, hidId.Value);
                Execute(tran);
                if (!HasError)
                {
                    //Get Data
                    data = (BD_RoomData)tran.Result;
                    lblName.Text = data.Name;
                    lblComment.Text = data.Comment;

                    lblRegional.Text = data.Regional;
                    lblFloor.Text = data.Floor;
                    lblArea.Text = data.Area;

                    //lblHourExtraTimePriceVND.Text = data.HourExtraTimePriceVND;
                    //lblHourExtraTimePriceUSD.Text = data.HourExtraTimePriceUsd;
                    //lblMonthRentPriceVND.Text = data.MonthRentPriceVND;
                    //lblMonthRentPriceUSD.Text = data.MonthRentPriceUSD;
                    lblHourManagerPriceVND.Text = data.HourRentPriceVND;
                    lblHourManagerPriceUSD.Text = data.HourRentPriceUSD;
                    //lblMonthExtraTimePriceVND.Text = data.MonthExtraTimePriceVND;
                    //lblMonthExtraTimePriceUSD.Text = data.MonthExtraTimePriceUsd;

                    txtPriceVND.Text = data.HourRentPriceVND;
                    txtPriceUSD.Text = data.HourRentPriceUSD;
                    txtVAT.Text = data.Vat;
                }
            }
        }
Esempio n. 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                hidId.Value = Func.ParseString(Request["id"]);
                txtBookingDate.Text = DateTime.Now.ToString("dd/MM/yyyy");

                DbHelper.FillListSearch(drpCustomerId, "SELECT CustomerId,CustomerId + '-' + Name as Name  FROM Customer Where BuildingId = '" + Func.ParseString(Session["__BUILDINGID__"]) + "'", "Name", "CustomerId");
                drpCustomerId.SelectedValue = hidId.Value;

                DbHelper.FillList(drpMeetingRoom, "SELECT Id,Name FROM BD_Room Where BuildingId = '" + Func.ParseString(Session["__BUILDINGID__"]) + "' and IsMeetingRoom = '1'", "Name", "Id");

                ViewBookingTime();
                ShowData();

                BD_RoomData data = new BD_RoomData();
                ITransaction tran = factory.GetLoadObject(data, drpMeetingRoom.SelectedValue);
                Execute(tran);
                if (!HasError)
                {
                    //Get Data
                    data = (BD_RoomData)tran.Result;
                    //lblName.Text = data.Name;
                    lblComment.Text = data.Comment;

                    lblRegional.Text = data.Regional;
                    lblFloor.Text = data.Floor;
                    lblArea.Text = data.Area;

                    lblHourRentPriceVND.Text = data.HourRentPriceVND;
                    lblHourRentPriceUSD.Text = data.HourRentPriceUSD;

                    txtPriceVND.Text = data.HourRentPriceVND;
                    txtPriceUSD.Text = data.HourRentPriceUSD;
                    txtVAT.Text = data.Vat;
                }
            }
        }
Esempio n. 6
0
        protected void drpMeetingRoom_OnSelectedIndexChanged(object sender, EventArgs e)
        {
            ViewBookingTime();
            BD_RoomData data = new BD_RoomData();
            ITransaction tran = factory.GetLoadObject(data, drpMeetingRoom.SelectedValue);
            Execute(tran);
            if (!HasError)
            {
                //Get Data
                data = (BD_RoomData)tran.Result;
                //lblName.Text = data.Name;
                lblComment.Text = data.Comment;

                lblRegional.Text = data.Regional;
                lblFloor.Text = data.Floor;
                lblArea.Text = data.Area;

                lblHourRentPriceVND.Text = data.HourRentPriceVND;
                lblHourRentPriceUSD.Text = data.HourRentPriceUSD;

                txtPriceVND.Text = data.HourRentPriceVND;
                txtPriceUSD.Text = data.HourRentPriceUSD;
                txtVAT.Text = data.Vat;
            }
            ShowData();
        }
Esempio n. 7
0
        /// <summary>
        /// Update
        /// </summary>
        private void UpdateData()
        {
            if (!checkData()) return;

            BD_RoomData data = new BD_RoomData();
            ITransaction tran = factory.GetLoadObject(data, hidId.Value);
            Execute(tran);
            if (!HasError)
            {
                //Get Data
                data = (BD_RoomData)tran.Result;
                data.Name = txtName.Text.Trim();
                data.Comment = txtComment.Text.Trim();

                data.ModifiedBy = Page.User.Identity.Name;
                data.Modified = DateTime.Now.ToString("yyyyMMddHHmmss");
                data.DelFlag = true.Equals(chkDelFlag.Checked) ? "0" : "1";

                data.IsMeetingRoom = (chkMeetinRoom.Checked == true ? "1" : "0");
                data.Regional = txtRegional.Text;
                data.Floor = txtFloor.Text;
                data.Description = txtDescription.Text;

                data.Area = txtArea.Text.Replace(',', '.');

                data.HourRentPriceVND = txtHourRentPriceVND.Text.Trim().Replace(',', '.');
                data.HourRentPriceUSD = txtHourRentPriceUSD.Text.Trim().Replace(',', '.');

                data.HourManagerPriceVND = "0";
                data.HourManagerPriceUSD = "0";

                data.HourExtraTimePriceVND = txtHourExtraTimePriceVND.Text.Trim().Replace(',', '.');
                data.HourExtraTimePriceUsd = txtHourExtraTimePriceUSD.Text.Trim().Replace(',', '.');

                data.MonthRentPriceVND = txtMonthRentPriceVND.Text.Trim().Replace(',', '.');
                data.MonthRentPriceUSD = txtMonthRentPriceUSD.Text.Trim().Replace(',', '.');
                data.MonthManagerPriceVND = txtMonthManagerPriceVND.Text.Trim().Replace(',', '.');
                data.MonthManagerPriceUSD = txtMonthManagerPriceUSD.Text.Trim().Replace(',', '.');
                data.MonthExtraTimePriceVND = txtMonthExtraTimePriceVND.Text.Trim().Replace(',', '.');
                data.MonthExtraTimePriceUsd = txtMonthExtraTimePriceUSD.Text.Trim().Replace(',', '.');

                data.Vat = txtVat.Text.Trim().Replace(',', '.');
                data.OtherFee01 = "0";
                data.OtherFee02 = "0";

                data.ExtraTimeMinPriceVND = txtMonthExtraTimePriceVND.Text.Trim().Replace(',', '.');
                data.ExtraTimeMinPriceUSD = txtMonthExtraTimePriceUSD.Text.Trim().Replace(',', '.');

                tran = factory.GetUpdateObject(data);

                Execute(tran);

                if (!HasError)
                {
                    OperationLogger.WriteInfo(Constants.LogOperationAlbumId, Constants.LogActionUpdateId, updateSuccess, Page.User.Identity.Name);
                    mvMessage.SetCompleteMessage(updateSuccess);
                    ScriptManager.RegisterClientScriptBlock(this.btnRegister, this.GetType(), key, postback, true);

                    lblCreated.Text = !"".Equals(data.Created) ? data.CreatedBy + "(" + Func.Formatdmyhms(data.Created) + ")" : "";
                    lblModified.Text = !"".Equals(data.Modified) ? data.ModifiedBy + "(" + Func.Formatdmyhms(data.Modified) + ")" : "";
                }
                else
                {
                    OperationLogger.WriteError(Constants.LogOperationAlbumId, Constants.LogActionUpdateId, updateUnSuccess, Page.User.Identity.Name);
                    mvMessage.AddError(updateUnSuccess);
                }
            }
        }
Esempio n. 8
0
        /// <summary>
        /// Load data
        /// </summary>
        private void LoadData()
        {
            BD_RoomData data = new BD_RoomData();
            ITransaction tran = factory.GetLoadObject(data, id);
            Execute(tran);
            if (!HasError)
            {
                //Get Data
                data = (BD_RoomData)tran.Result;
                txtId.Text = data.id;
                txtName.Text = data.Name;
                txtComment.Text = data.Comment;

                chkMeetinRoom.Checked = (data.IsMeetingRoom == "1" ? true : false);
                txtRegional.Text = data.Regional;
                txtFloor.Text = data.Floor;
                txtArea.Text = data.Area;

                txtHourRentPriceVND.Text = data.HourRentPriceVND;
                txtHourRentPriceUSD.Text = data.HourRentPriceUSD;
                txtMonthRentPriceVND.Text = data.MonthRentPriceVND;
                txtMonthRentPriceUSD.Text = data.MonthRentPriceUSD;
                txtMonthManagerPriceVND.Text = data.MonthManagerPriceVND;
                txtMonthManagerPriceUSD.Text = data.MonthManagerPriceUSD;

                txtHourExtraTimePriceVND.Text = data.HourExtraTimePriceVND;
                txtHourExtraTimePriceUSD.Text = data.HourExtraTimePriceUsd;

                txtMonthExtraTimePriceVND.Text = data.MonthExtraTimePriceVND;
                txtMonthExtraTimePriceUSD.Text = data.MonthExtraTimePriceUsd;

                txtVat.Text = data.Vat;
                chkDelFlag.Checked = "1".Equals(data.DelFlag) ? false : true;

                lblCreated.Text = !"".Equals(data.Created) ? data.CreatedBy + "(" + Func.Formatdmyhms(data.Created) + ")" : "";
                lblModified.Text = !"".Equals(data.Modified) ? data.ModifiedBy + "(" + Func.Formatdmyhms(data.Modified) + ")" : "";
                txtDescription.Text = data.Description;

                hidId.Value = id;
            }
        }
Esempio n. 9
0
        /// <summary>
        /// Load data
        /// </summary>
        private void LoadData()
        {
            BD_RoomData data = new BD_RoomData();
            ITransaction tran = factory.GetLoadObject(data, id);
            Execute(tran);
            if (!HasError)
            {
                //Get Data
                data = (BD_RoomData)tran.Result;
                lblRoomId.Text = data.id;
                lblName.Text = data.Name;
                lblArea.Text = data.Area;
                lblFloor.Text = data.Floor;
            }
            DbHelper.FillListSearch(drpCustomerId, "SELECT CustomerId,CustomerId + '-' + Name as Name  FROM Customer Where BuildingId = '" + Func.ParseString(Session["__BUILDINGID__"]) + "'  and delflag = 0", "Name", "CustomerId");

            string CustomerId = DbHelper.GetScalar("SELECT CustomerId FROM BD_RoomUsedElecWater where id = (select MAX(id) from BD_RoomUsedElecWater where RoomId = '" + id + "' and DelFlag = 0 and TarrifsType = 1)");
            drpCustomerId.SelectedValue = CustomerId;

            DbHelper.FillListSearch(drpTariffsOfElec, "Select Id,Name from BD_FeeGroup where BuildingId = '" + Func.ParseString(Session["__BUILDINGID__"]) + "'  and delflag = 0 and feeGroup = 1", "Name", "ID");
            ShowData();
        }
Esempio n. 10
0
        protected void drpRoom_SelectedIndexChanged(object sender, EventArgs e)
        {
            BD_RoomData data = new BD_RoomData();
            ITransaction tran = factory.GetLoadObject(data, drpRoom.SelectedValue);
            Execute(tran);
            if (!HasError)
            {
                //Get Data
                data = (BD_RoomData)tran.Result;

                txtRentPriceVND.Text = data.MonthRentPriceVND;
                txtRentPriceUSD.Text = data.MonthRentPriceUSD;
                txtManagerPriceVND.Text = data.MonthManagerPriceVND;
                txtManagerPriceUSD.Text = data.MonthManagerPriceUSD;

                txtHourExtraTimePriceUsd.Text = data.HourExtraTimePriceUsd;
                txtHourExtraTimePriceVND.Text = data.HourExtraTimePriceVND;

                txtMonthExtraTimePriceUSD.Text = data.MonthExtraTimePriceUsd;
                txtMonthExtraTimePriceVND.Text = data.MonthExtraTimePriceVND;

                txtVAT.Text = data.Vat;
                txtRentArea.Text = data.Area;
            }
        }