Ejemplo n.º 1
0
        public int UpdateStayRate(StayRateModel mStayRate)
        {
            string sql = "UPDATE STAY_RATE SET STAY_RATE=" + mStayRate.StayRate;
            sql += " WHERE ID=" + mStayRate.Id;

            return ExcuteNonQuery(sql);
        }
Ejemplo n.º 2
0
 public int InsertStayRate(StayRateModel mStayRate)
 {
     STAY_RATE sr = new STAY_RATE()
     {
         DAYS = mStayRate.Days,
         STAY_RATE1 = mStayRate.StayRate
     };
     dc.STAY_RATE.InsertOnSubmit(sr);
     dc.SubmitChanges();
     return sr.ID;
 }
Ejemplo n.º 3
0
        private void pbtnSearch_Click(object sender, EventArgs e)
        {
            try
            {
                StayRateModel mStayRate = new StayRateModel();
                mStayRate.CommonInfo = new CommonModel();
                mStayRate.CommonInfo.StartDate = GetDateTimePickValue(dtpStart, null);
                mStayRate.CommonInfo.EndDate = GetDateTimePickValue(dtpEnd, null);
                dgvStayRate.AutoGenerateColumns = false;

                List<StayRateModel> listStayRate = bStayInfo.GetStayRate(mStayRate, new ObjectControls(MCtrl.ByStartDateBetween));

                dgvStayRate.Rows.Clear();

                if (cmn.CheckEOF(listStayRate))
                {
                    int i = 0;
                    double dTotal = 0.0;
                    foreach (StayRateModel msr in listStayRate)
                    {
                        dgvStayRate.Rows.Add();
                        dgvStayRate.Rows[i].Cells["ID"].Value = msr.Id;
                        dgvStayRate.Rows[i].Cells["StayRate"].Value = msr.StayRate + "%";
                        dgvStayRate.Rows[i].Cells["Days"].Value = msr.Days.ToString("yyyy-MM-dd");
                        dTotal += msr.StayRate;
                        i++;
                    }
                    dTotal = Math.Round(dTotal / listStayRate.Count, 2);

                    dgvStayRate.Rows.Add();
                    dgvStayRate.Rows[i].Cells["Days"].Value = "平均入住率";
                    dgvStayRate.Rows[i].Cells["StayRate"].Value = dTotal + "%";
                }
            }
            catch (Exception err)
            {
                cmn.Show(err.Message);
            }
        }
Ejemplo n.º 4
0
        public List<StayRateModel> GetStayRate(StayRateModel mStayRate, ObjectControls oCtrl)
        {
            string sql = "SELECT A.ID,A.STAY_RATE,A.DAYS FROM STAY_RATE A WHERE 1=1 ";

            oCtrl.Helper(oCtrl.Exsit(MCtrl.ById) && oCtrl.Append(ref sql, " AND A.ID=" + SQL(mStayRate.Id)));
            oCtrl.Helper(oCtrl.Exsit(MCtrl.ByCreateDate) && oCtrl.Append(ref sql, " AND A.DAYS=" + SQL(mStayRate.Days)));
            oCtrl.Helper(oCtrl.Exsit(MCtrl.ByStartDateBetween) && oCtrl.Append(ref sql, " AND A.DAYS BETWEEN " + SQL(mStayRate.CommonInfo.StartDate) + " AND " + SQL(mStayRate.CommonInfo.EndDate)));
            sql += " ORDER BY A.DAYS";
            sdr=ExecuteReader(sql);
            using (sdr)
            {
                List<StayRateModel> listStayRate = new List<StayRateModel>();
                while (sdr.Read())
                {
                    StayRateModel mStayRateNew = new StayRateModel();
                    mStayRateNew.Id = ToInt32(sdr["ID"]);
                    mStayRateNew.StayRate = ToDouble(sdr["STAY_RATE"]);
                    mStayRateNew.Days = ToDateTime(sdr["DAYS"]);
                    listStayRate.Add(mStayRateNew);
                }
                return listStayRate;
            }
        }
Ejemplo n.º 5
0
 private void tmAutoSetStayRate_Tick(object sender, EventArgs e)
 {
     StayRateModel mStayRate = new StayRateModel();
     mStayRate.StayRate = double.Parse(lblUseRate.Text.Replace("%", ""));
     mStayRate.Days = cmn.DateBaseDate.Date;
     hml.DoStayRate(mStayRate);
 }
Ejemplo n.º 6
0
 public void DoStayRate(StayRateModel mStayRate)
 {
     List<StayRateModel> listStayRate = bStayRate.GetStayRate(mStayRate, new ObjectControls(MCtrl.ByCreateDate));
     if (Cmn.CheckEOF(listStayRate))
     {
         listStayRate[0].StayRate = mStayRate.StayRate;
         bStayRate.UpdateStayRate(listStayRate[0]);
     }
     else
     {
         bStayRate.InsertStayRate(mStayRate);
     }
 }
Ejemplo n.º 7
0
 public int UpdateStayRate(StayRateModel mStayRate)
 {
     return dStayRate.UpdateStayRate(mStayRate);
 }
Ejemplo n.º 8
0
 public int InsertStayRate(StayRateModel mStayRate)
 {
     return dStayRate.InsertStayRate(mStayRate);
 }
Ejemplo n.º 9
0
 public List<StayRateModel> GetStayRate(StayRateModel mStayRate, ObjectControls oCtrl)
 {
     return dStayRate.GetStayRate(mStayRate, oCtrl);
 }