コード例 #1
0
        public async Task <IActionResult> PostRent([FromBody] RentInfo rentInfo)
        {
            if (ModelState.IsValid)
            {
                var from  = Convert.ToDateTime(rentInfo.DateFrom);
                var to    = Convert.ToDateTime(rentInfo.DateTo);
                var carid = Int32.Parse(rentInfo.carID);
                if (checkIfCarAvailable(carid, from, to))
                {
                    Rent rent = new Rent();
                    rent.Car      = _context.Cars.Find(carid);
                    rent.DateFrom = from;
                    rent.DateTo   = to;
                    rent.User     = _userManager.FindByNameAsync(User.Identity.Name).Result;
                    _context.Rents.Add(rent);
                    await _context.SaveChangesAsync();

                    return(Ok(rent));
                }
                else
                {
                    return(BadRequest("The car is already rented"));
                }
            }
            return(BadRequest(ModelState));
        }
コード例 #2
0
        private void btnPay_Click(object sender, RoutedEventArgs e)
        {
            List <Room> rooms = new List <Room>();

            rooms.AddRange(Room.GetRoomsByCustomerID(((Customer)cbCustomerName.SelectedItem).IdCardNumber));

            int flag = 0;

            foreach (var item in rooms)
            {
                if (RentInfo.UpdateChechoutDate(item.Name) && RoomRentalDetail.DeleteRoomRentalDetail(item.Name) &&
                    Room.UpdateRoomStatus(item.Name) && RevenueReport.InsertRevenueReport(item.Name, item.Type, RentInfo.GetDateCheckin(item.Name), DateTime.Now, totalMoney) &&
                    PaymentDetail.DeletePaymentDetailByRoomName(item.Name))
                {
                    flag += 1;
                }
            }

            if (flag == rooms.Count)
            {
                MessageBox.Show("Thanh toán thành công!");
            }
            else
            {
                MessageBox.Show("Thanh toán không thành công! Vui lòng thực hiện lại thao tác!");
            }
            this.Close();
        }
コード例 #3
0
        public PaymentWindow(Room roomToPay)
        {
            InitializeComponent();

            _roomToPay = roomToPay;

            DateTime dateRent = new DateTime();

            dateRent = RentInfo.GetDateCheckin(_roomToPay.Name);
            DateTime datePay = new DateTime();

            datePay = DateTime.Now;

            daysRent = datePay.Subtract(dateRent);

            double roomPrice = (float)_roomToPay.Price * (daysRent.Days + 1); // Tiền phòng gốc theo ngày thuê (chưa tính phụ thu).
            int    quantum   = 0;

            if (RoomRentalDetail.GetQuantumCustomerInRoom(_roomToPay.Name) > RoomType.GetMaxCustomerInRoom(_roomToPay.Type))
            {
                quantum = RoomRentalDetail.GetQuantumCustomerInRoom(_roomToPay.Name) - RoomType.GetMaxCustomerInRoom(_roomToPay.Type); // Số lượng khách vượt quá số khách tối đa theo quy định của loại phòng đó.
            }
            double surchargeCustomerType    = RoomRentalDetail.GetSurchargeCustomerInRoom(_roomToPay.Name) / 100;                      // Phụ thu theo loại khách trong phòng.
            double surchargeQuantumCustomer = CustomerSurcharge.GetSurchargeByQuantum(quantum) / 100;                                  // Phụ thu theo số khách vượt quá số khách tối đa theo quy định của loại phòng đó.

            totalMoney = roomPrice + roomPrice * surchargeCustomerType + roomPrice * surchargeQuantumCustomer;

            txbRoomName.Text     = roomToPay.Name;
            txbRoomType.Text     = roomToPay.Type;
            txbDateRented.Text   = dateRent.ToString("dd/MM/yyyy");
            txbDaysRented.Text   = (daysRent.Days + 1).ToString();
            txbNumberGuests.Text = "" + RoomRentalDetail.GetQuantumCustomerInRoom(_roomToPay.Name);
            txbIsForeigns.Text   = "" + RoomRentalDetail.GetQuantumForeignCustomerInRoom(_roomToPay.Name);
            txbTotalMoney.Text   = "" + string.Format("{0:N0}", totalMoney);
        }
コード例 #4
0
        private void btnHoanThanh_Click(object sender, RoutedEventArgs e)
        {
            // TODO: Update Danh sách khách hàng thuê phòng cho _roomToRent

            Customer customer = dataGridCustomer.Items.GetItemAt(0) as Customer;

            if (String.IsNullOrEmpty(customer.Name) || String.IsNullOrEmpty(customer.Type) || customer.IdCardNumber == 0 || String.IsNullOrEmpty(customer.Address))
            {
                MessageBox.Show("Khách hàng đầu tiên là người đại diện thuê phòng! Vui lòng nhập đầy đủ thông tin! Không để trống dòng này!");
                return;
            }
            if (RentInfo.InsertCheckinInfo(_roomToRent.Name, App.Instance._Session.CurrentStaff.Username, customer.IdCardNumber, (DateTime)dprCheckinDate.SelectedDate) &&
                Customer.InsertCustomer(customer.Name, customer.Address, customer.IdCardNumber, customer.Type) && Room.UpdateRoomStatus(_roomToRent.Name))
            {
                foreach (Customer item in ListGuestsRenting)
                {
                    if (item.Name == null)
                    {
                        continue;
                    }
                    RoomRentalDetail.InsertRoomRentalDetail(_roomToRent.Name, item.Name, item.IdCardNumber, item.Address, item.Type);
                }
                PaymentDetail.InsertPaymentDetail(_roomToRent.Name, (DateTime)dprCheckinDate.SelectedDate, RoomRentalDetail.GetQuantumCustomerInRoom(_roomToRent.Name), RoomRentalDetail.GetQuantumForeignCustomerInRoom(_roomToRent.Name));
                MessageBox.Show("Thuê phòng thành công");
                this.Close();
            }
            else
            {
                MessageBox.Show("Có lỗi xảy ra! Vui lòng thực hiện lại thao tác!");
                this.Close();
            }
        }
コード例 #5
0
ファイル: LockDetail.aspx.cs プロジェクト: Tony9866/anxinsu
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            ddlDeviceType.Items.Add(new ListItem("智能旧锁", "0"));
            ddlDeviceType.Items.Add(new ListItem("智能新锁", "1"));

            ddlStatus.Items.Add(new ListItem("在线", "0"));
            ddlStatus.Items.Add(new ListItem("离线", "1"));
            ddlStatus.Items.Add(new ListItem("低电", "2"));
            ddlStatus.Items.Add(new ListItem("冻结", "3"));

            if (Request["DeviceID"] != null)
            {
                LockManager manager = new LockManager();
                DataTable   dt      = manager.GetDeviceDetailInfo(string.IsNullOrEmpty(Request["DeviceID"].ToString())?"0":Request["DeviceID"].ToString());
                if (dt != null && dt.Rows.Count > 0)
                {
                    txtDeviceID.Text            = dt.Rows[0]["DeviceID"].ToString();
                    ddlDeviceType.SelectedIndex = ddlDeviceType.Items.IndexOf(ddlDeviceType.Items.FindByValue(dt.Rows[0]["DeviceType"].ToString()));

                    RentInfo info = new RentInfo(dt.Rows[0]["RentNo"].ToString());
                    hdRentNO.Value = dt.Rows[0]["RentNo"].ToString();

                    txtRentNO.Text = info.RAddress;

                    txtVersion.Text         = dt.Rows[0]["VersionID"].ToString();
                    txtBatch.Text           = dt.Rows[0]["BatchNO"].ToString();
                    txtDate.Text            = dt.Rows[0]["ProductDate"].ToString();
                    ddlStatus.SelectedIndex = ddlStatus.Items.IndexOf(ddlStatus.Items.FindByValue(dt.Rows[0]["Status"].ToString()));
                    txtMemo.Text            = dt.Rows[0]["Memo"].ToString();

                    string ret = manager.GetDeviceStatus(dt.Rows[0]["DeviceID"].ToString());

                    if (string.IsNullOrEmpty(ret))
                    {
                        lblStatus.Text = "未知";
                    }
                    else
                    {
                        if (ret.Substring(0, 1).Equals("0"))
                        {
                            lblStatus.Text = "在线";
                        }
                        if (ret.Substring(0, 1).Equals("1"))
                        {
                            lblStatus.Text = "离线";
                        }
                        if (ret.Substring(0, 1).Equals("2"))
                        {
                            lblStatus.Text = "低电";
                        }
                    }
                }
            }
        }
    }
コード例 #6
0
        public ActionResult InsertCMND(InsertCMND ir)
        {
            try
            {
                if (ModelState.IsValid && TempData != null)
                {
                    BookRoom date = SessionHelper.GetDateSession();
                    TempData["datein"]  = date.dateRent;
                    TempData["dateout"] = date.datePay;
                    List <Room> lstroom = SessionHelper.getBookrooms();
                    int         giatien = 0;
                    foreach (Room temp in lstroom)
                    {
                        giatien += temp.giatien * temp.soluong;
                    }
                    TempData["giatien"] = giatien;
                    String sql = "select * from KHACHHANG where CMND_PASSPORT='" + ir.idCard + "'";
                    if (DataUtil.ExecQueryString(sql))
                    {
                        BookRoom br = new BookRoom();
                        br = SessionHelper.GetDateSession();
                        var dt = DataUtil.ExecSqlDataTable(sql, DataUtil.connstr);

                        if (dt.Rows.Count > 0)
                        {
                            DataRow  kh = dt.Rows[0];
                            RentInfo ri = new RentInfo();
                            ri.deposit    = (int)(giatien * 20 / 100);
                            ri.dateRent   = br.dateRent;
                            ri.datePay    = br.datePay;
                            ri.idCard     = kh[0].ToString();
                            ri.phone      = kh[3].ToString();
                            ri.email      = kh[6].ToString();
                            ri.nameClient = kh[1].ToString() + kh[2].ToString();
                            ri.birth      = kh[5].ToString();
                            return(View("CheckInfor", ri));
                        }
                        else
                        {
                            return(View("CheckInfor"));
                        }
                    }
                    else
                    {
                        return(View("CheckInfor"));
                    }
                }
                else
                {
                    return(View("InsertCMND"));
                }
            }
            catch
            {
                return(RedirectToAction("Index", "Home"));
            }
        }
コード例 #7
0
        public RoomRentalDetailWindow(Room roomToShowDetail)
        {
            InitializeComponent();

            _roomToShowDetail = roomToShowDetail;
            LoadFromDB(_roomToShowDetail.Name);

            txbRoomName.Text     = "Phòng " + _roomToShowDetail.Name;
            txblDateCheckin.Text = RentInfo.GetDateCheckin(_roomToShowDetail.Name).ToString("dd/MM/yyyy");
        }
コード例 #8
0
 private void btnPay_Click(object sender, RoutedEventArgs e)
 {
     if (RentInfo.UpdateChechoutDate(_roomToPay.Name) && RoomRentalDetail.DeleteRoomRentalDetail(_roomToPay.Name) &&
         Room.UpdateRoomStatus(_roomToPay.Name) && RevenueReport.InsertRevenueReport(_roomToPay.Name, _roomToPay.Type, RentInfo.GetDateCheckin(_roomToPay.Name), DateTime.Now, totalMoney) &&
         PaymentDetail.UpdatePaymentDetail(_roomToPay.Name, daysRent.Days + 1, totalMoney))
     {
         MessageBox.Show("Thanh toán thành công!");
     }
     else
     {
         MessageBox.Show("Thanh toán không thành công! Vui lòng thực hiện lại thao tác!");
     }
     this.Close();
 }
コード例 #9
0
        internal static RentData ToRentData(this RentInfo info)
        {
            if (info == null)
            {
                throw new NullReferenceException(nameof(info));
            }

            return(new RentData()
            {
                VehicleDailyCost = info.DailyCost,
                VehiclePlate = info.Plate,
                StartRent = info.StartRent,
                EndRent = info.EndRent
            });
        }
コード例 #10
0
ファイル: RentIconAdd.aspx.cs プロジェクト: Tony9866/anxinsu
    protected void InitialControls()
    {
        RentAttributeHelper rentAttributeHelper = new RentAttributeHelper();

        lblRentNo.Text = RentNo;
        RentInfo rentInfo = new RentInfo(RentNo);

        if (!string.IsNullOrEmpty(RRAID))
        {
            RentAttribute rra = new RentAttribute(int.Parse(RRAID));
            lblAddress.Text     = rentInfo.RAddress;
            lblCreatedBy.Text   = rra.RRACreatedBy;
            lblCreatedDate.Text = rra.RRACreatedDate.ToString();
            txtRentPrice.Text   = rra.RRentPrice.ToString();
            txtStartDate.Text   = rra.RRAStartDate.ToString("yyyy-MM-dd");
            txtEndDate.Text     = rra.RRAEndDate.ToString("yyyy-MM-dd");
            txtContactName.Text = rra.RRAContactName;
            txtContactTel.Text  = rra.RRAContactTel;
            txtIDCard.Text      = rra.RRAIDCard;
            txtPassword.Text    = rra.RRANationName;

            dlRenties.DataSource = rentAttributeHelper.GetRetinues(RRAID);
            dlRenties.DataBind();

            btnDelete.Visible = true;
            btnSave.Visible   = false;
            imgAdd.Visible    = false;
            imgCard.Visible   = false;
            btnStart.Visible  = false;
            btnEnd.Visible    = false;
        }
        else
        {
            lblCreatedBy.Text     = SysContext.CurrentUserName;
            lblCreatedByName.Text = SysContext.CurrentRealName;
            lblCreatedDate.Text   = System.DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");
            lblAddress.Text       = rentInfo.RAddress;
            txtRentPrice.Text     = rentInfo.RLocationDescription;
            txtStartDate.Text     = Request["startDate"];
            txtEndDate.Text       = DateTime.Parse(txtStartDate.Text).AddDays(4).ToString("yyyy-MM-dd");
            txtEndDate.Text       = Request["endDate"];
            if (dtRenties.Columns.Count <= 0)
            {
                dtRenties.Columns.Add("Name");
                dtRenties.Columns.Add("IDCard");
            }
        }
    }
コード例 #11
0
 public IActionResult CreateRentInfo(RentInfo value)
 {
     try
     {
         if (value != null)
         {
             WebDb.AddRentInfo(value);
             WebDb.SaveChanges();
             return(Created("rentinfo/" + value.RentId, value));
         }
     }
     catch (Exception ex)
     {
         return(NotFound("Couldn't post  rent info  - error: " + ex.Message));
     }
     return(NotFound());
 }
コード例 #12
0
        public ActionResult Confirm(RentInfo ren)
        {
            try
            {
                if (ModelState.IsValid && TempData != null)
                {
                    List <Room> lstroom = SessionHelper.getBookrooms();
                    if (DataUtil.addPhieuDat(ren, lstroom))
                    {
                        TempData["HomeIndexError"] = HomeIndexError.BookingRoomIsOk;
                        return(RedirectToAction("Index", "Home"));
                        // TempData["message"] = "Đặt phòng thành công.\nHãy liên hệ với khách sạn để xác nhận phiếu đặt và đóng phí đặt phòng!\n Thành thật cảm ơn";
                    }
                    else
                    {
                        TempData["HomeIndexError"] = HomeIndexError.BookingRoomIsFail;
                        return(RedirectToAction("Index", "Home"));
                        //TempData["message"] = "Đặt phòng thất bại , xin thử lại sau";
                    }

                    //return RedirectToAction("Index", "Home");
                }
                else
                {
                    //TempData["message"] = "Thông tin nhập vào không hợp lệ!";
                    //return RedirectToAction("Index", "Home");
                    BookRoom date = SessionHelper.GetDateSession();
                    TempData["datein"]  = date.dateRent;
                    TempData["dateout"] = date.datePay;
                    List <Room> lstroom = SessionHelper.getBookrooms();
                    int         giatien = 0;
                    foreach (Room temp in lstroom)
                    {
                        giatien += temp.giatien * temp.soluong;
                    }
                    TempData["giatien"] = giatien;
                    ModelState.AddModelError("", "Bạn chưa nhập đủ thông tin!");
                    return(View("CheckInfor"));
                }
            }
            catch
            {
                return(RedirectToAction("Index", "Home"));
            }
        }
コード例 #13
0
        public void LoadPaymentDetailFromDB()
        {
            List <PaymentDetail> paymentDetail = new List <PaymentDetail>();

            paymentDetail.Clear();
            List <string> rooms = new List <string>();

            rooms.Clear();
            rooms.AddRange(RentInfo.GetRoomNameByCustomerID(((Customer)cbCustomerName.SelectedItem).IdCardNumber));
            foreach (var item in rooms)
            {
                paymentDetail.AddRange(PaymentDetail.GetPaymentDetailByRoomName(item));
            }

            paymentDetails.Clear();
            foreach (var item in paymentDetail)
            {
                paymentDetails.Add(item);
            }
        }
コード例 #14
0
        public async Task <UserActorError> RentVehicleAsync(RentInfo rentInfo, CancellationToken cancellationToken)
        {
            if (rentInfo == null)
            {
                throw new ArgumentNullException(nameof(rentInfo));
            }

            if (!await IsValidInternalAsync(cancellationToken))
            {
                return(UserActorError.UserNotValid);
            }

            UserActorError result = UserActorError.Ok;

            var currentInvoice = await this.GetInvoiceDataFromStateAsync(cancellationToken);

            if (currentInvoice == null)
            {
                var currentRentVehicle = await GetRentDataFromStateAsync(cancellationToken);

                if (currentRentVehicle == null)
                {
                    currentRentVehicle = rentInfo.ToRentData();
                    await SetRentDataIntoStateAsync(currentRentVehicle, cancellationToken);
                    await SetMailSendedIntoStateAsync(false, cancellationToken);

                    var minutesForReminder = rentInfo.EndRent - DateTime.Now;
                    await this.RegisterReminderAsync(EndTimeExpiredReminderName, null, minutesForReminder, TimeSpan.FromMinutes(1));
                }
                else
                {
                    result = UserActorError.VehicleAlreadyRented;
                }
            }
            else
            {
                result = UserActorError.InvoiceNotPaid;
            }

            return(result);
        }
コード例 #15
0
        private void CbCustomerName_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            txbAddress.Text    = ((Customer)cbCustomerName.SelectedItem).Address;
            txbCustomerID.Text = ((Customer)cbCustomerName.SelectedItem).IdCardNumber.ToString();
            //Update payment detail
            List <Room> rooms = new List <Room>();

            rooms.Clear();
            rooms.AddRange(Room.GetRoomsByCustomerID(((Customer)cbCustomerName.SelectedItem).IdCardNumber));

            DateTime dateRent = new DateTime();
            DateTime datePay  = new DateTime();

            foreach (var item in rooms)
            {
                dateRent = RentInfo.GetDateCheckin(item.Name);
                datePay  = DateTime.Now;
                TimeSpan daysRent = datePay.Subtract(dateRent);

                double roomPrice = (float)item.Price * (daysRent.Days + 1); // Tiền phòng gốc theo ngày thuê (chưa tính phụ thu).
                int    quantum   = 0;
                if (RoomRentalDetail.GetQuantumCustomerInRoom(item.Name) > RoomType.GetMaxCustomerInRoom(item.Type))
                {
                    quantum = RoomRentalDetail.GetQuantumCustomerInRoom(item.Name) - RoomType.GetMaxCustomerInRoom(item.Type); // Số lượng khách vượt quá số khách tối đa theo quy định của loại phòng đó.
                }
                double surchargeCustomerType    = RoomRentalDetail.GetSurchargeCustomerInRoom(item.Name) / 100;                // Phụ thu theo loại khách trong phòng.
                double surchargeQuantumCustomer = CustomerSurcharge.GetSurchargeByQuantum(quantum) / 100;                      // Phụ thu theo số khách vượt quá số khách tối đa theo quy định của loại phòng đó.
                totalMoney = roomPrice + roomPrice * surchargeCustomerType + roomPrice * surchargeQuantumCustomer;

                PaymentDetail.UpdatePaymentDetail(item.Name, daysRent.Days + 1, totalMoney);
            }

            //Calculate total fee
            txbTotalFee.Text = TotalFee;

            LoadPaymentDetailFromDB();
        }
コード例 #16
0
ファイル: RentInfoAdd.aspx.cs プロジェクト: Tony9866/anxinsu
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            string pass = "******";
            if (Session["RentNo"] != null)
            {
                lblRentNo.Text = Session["RentNo"].ToString();
            }

            lblProvince.Text   = Convert.ToString((int)RentPropertyEnumList.Province);
            lblNationName.Text = Convert.ToString((int)RentPropertyEnumList.NationName);

            InitialControls();

            if (EditType == "D")
            {
                RentInfo rentInfo = new RentInfo(RentNo);
                btnSave.Visible = false;
                if (rentInfo == null || rentInfo.IsAvailable == false)
                {
                    lblRentStatus.Text = "此房源未出租,不能退房";
                    btnDelete.Visible  = false;
                }
                else if (rentInfo.IsAvailable == true)
                {
                    btnDelete.Visible = true;
                }
            }
            else if (EditType == "V")
            {
                btnSave.Visible   = false;
                btnDelete.Visible = false;
            }
        }
    }
コード例 #17
0
        private void InitSessionInfo()
        {
            Session = SessionInfo.CreateSessionInfo(AppName, ModuleID, AppType);
            RentInfo rentInfo = new RentInfo();

            rentInfo.ID      = ConstValue.RENT_DEFAULT;
            rentInfo.Token   = ConstValue.RENT_DEFAULT_TOKEN;
            rentInfo.Domain  = "voicecyber.com";
            rentInfo.Name    = "voicecyber";
            Session.RentInfo = rentInfo;
            Session.RentID   = ConstValue.RENT_DEFAULT;

            UserInfo userInfo = new UserInfo();

            userInfo.UserID   = ConstValue.USER_ADMIN;
            userInfo.Account  = "administrator";
            userInfo.UserName = "******";
            Session.UserInfo  = userInfo;
            Session.UserID    = ConstValue.USER_ADMIN;

            RoleInfo roleInfo = new RoleInfo();

            roleInfo.ID      = ConstValue.ROLE_SYSTEMADMIN;
            roleInfo.Name    = "System Admin";
            Session.RoleInfo = roleInfo;
            Session.RoleID   = ConstValue.ROLE_SYSTEMADMIN;


            ThemeInfo themeInfo = new ThemeInfo();

            themeInfo.Name  = "Style01";
            themeInfo.Color = "Green";
            Session.SupportThemes.Add(themeInfo);

            themeInfo       = new ThemeInfo();
            themeInfo.Name  = "Style02";
            themeInfo.Color = "Yellow";
            Session.SupportThemes.Add(themeInfo);

            themeInfo       = new ThemeInfo();
            themeInfo.Name  = "Style03";
            themeInfo.Color = "Brown";
            Session.SupportThemes.Add(themeInfo);

            themeInfo       = new ThemeInfo();
            themeInfo.Name  = "Style04";
            themeInfo.Color = "Blue";
            Session.SupportThemes.Add(themeInfo);


            #region Set Default Theme

            string   themeName = "Style01";
            DateTime now       = DateTime.Now;
            if (now.Month == 3 ||
                now.Month == 4 ||
                now.Month == 5)
            {
                themeName = "Style01";
            }
            if (now.Month == 6 ||
                now.Month == 7 ||
                now.Month == 8)
            {
                themeName = "Style02";
            }
            if (now.Month == 9 ||
                now.Month == 10 ||
                now.Month == 11)
            {
                themeName = "Style03";
            }
            if (now.Month == 12 ||
                now.Month == 1 ||
                now.Month == 2)
            {
                themeName = "Style04";
            }
            var theme = Session.SupportThemes.FirstOrDefault(t => t.Name == themeName);
            if (theme != null)
            {
                Session.ThemeInfo = theme;
                Session.ThemeName = themeName;
            }

            #endregion


            LangTypeInfo langType = new LangTypeInfo();
            langType.LangID   = 1033;
            langType.LangName = "en-us";
            langType.Display  = "English";
            Session.SupportLangTypes.Add(langType);

            langType          = new LangTypeInfo();
            langType.LangID   = 2052;
            langType.LangName = "zh-cn";
            langType.Display  = "简体中文";
            Session.SupportLangTypes.Add(langType);
            Session.LangTypeInfo = langType;
            Session.LangTypeID   = langType.LangID;

            langType          = new LangTypeInfo();
            langType.LangID   = 1028;
            langType.LangName = "zh-cn";
            langType.Display  = "繁体中文";
            Session.SupportLangTypes.Add(langType);

            langType          = new LangTypeInfo();
            langType.LangID   = 1041;
            langType.LangName = "jp";
            langType.Display  = "日本语";
            Session.SupportLangTypes.Add(langType);

            langType          = new LangTypeInfo();
            langType.LangID   = 1025;
            langType.LangName = "ara";
            langType.Display  = "阿拉伯语";
            Session.SupportLangTypes.Add(langType);


            #region Set Default Language

            int langID = GetUserDefaultUILanguage();
            var lang   = Session.SupportLangTypes.FirstOrDefault(l => l.LangID == langID);
            if (lang != null)
            {
                Session.LangTypeInfo = lang;
                Session.LangTypeID   = lang.LangID;
            }

            #endregion


            AppServerInfo appServerInfo = new AppServerInfo();
            appServerInfo.Protocol      = "http";
            appServerInfo.Address       = "192.168.6.78";
            appServerInfo.Port          = 8081;
            appServerInfo.SupportHttps  = false;
            appServerInfo.SupportNetTcp = false;
            Session.AppServerInfo       = appServerInfo;

            DatabaseInfo dbInfo = new DatabaseInfo();
            dbInfo.TypeID    = 2;
            dbInfo.Host      = "192.168.4.182";
            dbInfo.Port      = 1433;
            dbInfo.DBName    = "UMPDataDB11251";
            dbInfo.LoginName = "PFDEV";
            string strPassword = "******";
            dbInfo.RealPassword = strPassword;
            strPassword         = EncryptString(strPassword);
            dbInfo.Password     = strPassword;

            Session.DatabaseInfo = dbInfo;
            Session.DBType       = dbInfo.TypeID;

            Session.AppVersion = "8.03.002";
        }
コード例 #18
0
    public string UpdateRentInfo(string RentNo, string RDName, string RSName, string RRName, string RPSName, string RAddress,
                                 string RDoor, string RTotalDoor, string RRoomType, string RDirection, string RStructure, string RBuildingType, string RFloor, string RTotalFloor, string RHouseAge,
                                 decimal RRentArea, string RProperty, string ROwner, string ROwnerTel, string RIDCard, string RLocationDescription, string RPSParentName, string createdBy, string rentType, string ownType)
    {
        RentInfo rentInfo = new RentInfo(RentNo);

        rentInfo.RentNo = RentNo;
        RentInfoHelper helper = new RentInfoHelper();

        rentInfo.RDName = RDName;
        rentInfo.RSName = RSName;
        rentInfo.RRName = RRName;

        rentInfo.RPSParentName = RPSParentName;
        rentInfo.RPSName       = RPSName;
        rentInfo.RPSID         = RPSName;
        //rentInfo.RPSID = int.Parse(RPSName);

        rentInfo.RAddress   = RAddress;
        rentInfo.RDoor      = RDoor;
        rentInfo.RTotalDoor = int.Parse(RTotalDoor);

        rentInfo.RRoomType     = RRoomType;
        rentInfo.RDirection    = RDirection;
        rentInfo.RStructure    = RStructure;
        rentInfo.RBuildingType = RBuildingType;
        rentInfo.RProperty     = RProperty;

        rentInfo.RFloor      = RFloor;
        rentInfo.RTotalFloor = int.Parse(RTotalFloor);

        rentInfo.RHouseAge            = int.Parse(RHouseAge);
        rentInfo.RRentArea            = RRentArea;
        rentInfo.ROwner               = ROwner;
        rentInfo.ROwnerTel            = ROwnerTel;
        rentInfo.RIDCard              = RIDCard;
        rentInfo.RLocationDescription = RLocationDescription;

        rentInfo.RMapID = 0;

        rentInfo.RCreatedBy    = createdBy;
        rentInfo.RCreatedDate  = DateTime.Now;
        rentInfo.RModifiedBy   = createdBy;
        rentInfo.RModifiedDate = DateTime.Now;

        rentInfo.RentType = rentType;
        rentInfo.OwnType  = ownType;

        string      retStr = GetLocationInfo(RAddress, "天津");
        XmlDocument doc    = new XmlDocument();

        doc.LoadXml(retStr);
        XmlNode status = doc.SelectSingleNode("GeocoderSearchResponse/status");

        if (status.InnerText == "0")
        {
            XmlNode lng = doc.SelectSingleNode("GeocoderSearchResponse/result/location/lng");
            XmlNode lat = doc.SelectSingleNode("GeocoderSearchResponse/result/location/lat");
            rentInfo.Longitude = lng.InnerText;
            rentInfo.Latitude  = lat.InnerText;
        }


        //string retStr = GetLocationInfo(RAddress, "天津");
        //if (retStr.IndexOf("lng") > 0)
        //{
        //    int aa = retStr.IndexOf("\"lng\"");
        //    retStr = retStr.Substring(retStr.IndexOf("\"lng\""));
        //    string lng = retStr.Substring(6, retStr.IndexOf("\n"));
        //    lng = lng.Replace("\n", "").Trim().Replace(",", "");
        //    retStr = retStr.Substring(retStr.IndexOf("\"lat\""));
        //    string lat = retStr.Substring(6, retStr.IndexOf("\n"));
        //    lat = lat.Replace("\n", "").Trim().Replace(",", "");
        //    rentInfo.Longitude = lng;
        //    rentInfo.Latitude = lat;
        //}

        RentInfoHelper rentInfoHelper = new RentInfoHelper();

        try
        {
            rentInfoHelper.UpdateRent(rentInfo);
            return("true");
        }
        catch (Exception ex)
        {
            return("false");
        }
    }
コード例 #19
0
        private void Init()
        {
            Session                = new SessionInfo();
            Session.SessionID      = Guid.NewGuid().ToString();
            Session.AppName        = AppName;
            Session.LastActiveTime = DateTime.Now;

            RentInfo rentInfo = new RentInfo();

            rentInfo.ID      = 1000000000000000001;
            rentInfo.Token   = "00000";
            rentInfo.Domain  = "voicecyber.com";
            rentInfo.Name    = "voicecyber";
            Session.RentInfo = rentInfo;
            Session.RentID   = 1000000000000000001;

            UserInfo userInfo = new UserInfo();

            userInfo.UserID   = 1020000000000000001;
            userInfo.Account  = "administrator";
            userInfo.UserName = "******";
            Session.UserInfo  = userInfo;
            Session.UserID    = 1020000000000000001;

            RoleInfo roleInfo = new RoleInfo();

            roleInfo.ID      = 1060000000000000001;
            roleInfo.Name    = "System Admin";
            Session.RoleInfo = roleInfo;
            Session.RoleID   = 1060000000000000001;

            AppServerInfo serverInfo = new AppServerInfo();

            serverInfo.Protocol   = "http";
            serverInfo.Address    = "192.168.6.75";
            serverInfo.Port       = 8081;
            Session.AppServerInfo = serverInfo;

            ThemeInfo themeInfo = new ThemeInfo();

            themeInfo.Name    = "Default";
            themeInfo.Color   = "Brown";
            Session.ThemeInfo = themeInfo;
            Session.ThemeName = "Default";

            themeInfo       = new ThemeInfo();
            themeInfo.Name  = "Style01";
            themeInfo.Color = "Green";
            Session.SupportThemes.Add(themeInfo);

            themeInfo       = new ThemeInfo();
            themeInfo.Name  = "Style02";
            themeInfo.Color = "Yellow";
            Session.SupportThemes.Add(themeInfo);

            themeInfo       = new ThemeInfo();
            themeInfo.Name  = "Style03";
            themeInfo.Color = "Brown";
            Session.SupportThemes.Add(themeInfo);

            themeInfo       = new ThemeInfo();
            themeInfo.Name  = "Style04";
            themeInfo.Color = "Blue";
            Session.SupportThemes.Add(themeInfo);

            LangTypeInfo langType = new LangTypeInfo();

            langType.LangID      = 1033;
            langType.LangName    = "en-us";
            langType.Display     = "English";
            Session.LangTypeInfo = langType;
            Session.LangTypeID   = 1033;
            Session.SupportLangTypes.Add(langType);

            langType          = new LangTypeInfo();
            langType.LangID   = 2052;
            langType.LangName = "zh-cn";
            langType.Display  = "简体中文";
            Session.SupportLangTypes.Add(langType);

            DatabaseInfo dbInfo = new DatabaseInfo();

            dbInfo.TypeID              = 3;
            dbInfo.TypeName            = "ORCL";
            dbInfo.Host                = "192.168.4.182";
            dbInfo.Port                = 1521;
            dbInfo.DBName              = "PFOrcl";
            dbInfo.LoginName           = "PFDEV";
            dbInfo.Password            = "******";
            Session.DatabaseInfo       = dbInfo;
            Session.DBType             = dbInfo.TypeID;
            Session.DBConnectionString = dbInfo.GetConnectionString();

            //DatabaseInfo dbInfo = new DatabaseInfo();
            //dbInfo.TypeID = 2;
            //dbInfo.TypeName = "MSSQL";
            //dbInfo.Host = "192.168.4.182";
            //dbInfo.Port = 1433;
            //dbInfo.DBName = "UMPDataDB";
            //dbInfo.LoginName = "sa";
            //dbInfo.Password = "******";
            //Session.DBType = dbInfo.TypeID;
            //Session.DBConnectionString = dbInfo.GetConnectionString();
            //Session.DatabaseInfo = dbInfo;

            Session.InstallPath = @"C:\UMPRelease";
        }
コード例 #20
0
ファイル: RentInfoAdd.aspx.cs プロジェクト: Tony9866/anxinsu
    protected void InitialControls()
    {
        RentAttributeHelper rentAttributeHelper = new RentAttributeHelper();

        DataBindProvince();
        DataBindNationName();



        if (EditType == "D")
        {
            RentAttribute rentAttribute = new RentAttribute(int.Parse(RentNo));

            lblRentNo.Text = rentAttribute.RentNo;
            RentInfo rentInfo = new RentInfo(rentAttribute.RentNo);

            txtContactName.Text = rentAttribute.RRAContactName;
            txtIDCard.Text      = rentAttribute.RRAIDCard;
            txtContactTel.Text  = rentAttribute.RRAContactTel;
            txtRentPrice.Text   = rentAttribute.RRentPrice.ToString();

            ddlContactProvince.SelectedIndex = ddlContactProvince.Items.IndexOf(ddlContactProvince.Items.FindByText(rentAttribute.RRAContactProvince));
            ddlNationName.SelectedIndex      = ddlNationName.Items.IndexOf(ddlNationName.Items.FindByText(rentAttribute.RRANationName));
            txtStartDate.Text = rentAttribute.RRAStartDate.ToString("yyyy-MM-dd");
            txtEndDate.Text   = rentAttribute.RRAEndDate.ToString("yyyy-MM-dd");

            txtDescription.Text = rentAttribute.RRADescription;
            lblCreatedBy.Text   = rentAttribute.RRACreatedBy;
            RentInfoHelper helper = new RentInfoHelper();
            DataTable      dtUser = helper.GetDataTable("select * from cf_user where loginName='" + lblCreatedBy.Text + "'");
            foreach (DataRow row in dtUser.Rows)
            {
                lblCreatedByName.Text = row["RealName"].ToString();
            }
            lblCreatedDate.Text = rentAttribute.RRACreatedDate.ToString("yyyy-MM-dd hh:mm:ss");
            btnStart.Visible    = false;
            btnEnd.Visible      = false;
            btnSave.Visible     = false;
        }
        else
        {
            //获取租房者信息
            RentAttribute rentAttribute = new RentAttribute(int.Parse(RentNo));

            lblRentNo.Text = rentAttribute.RentNo;
            RentInfo rentInfo = new RentInfo(rentAttribute.RentNo);

            txtContactName.Text = rentAttribute.RRAContactName;                                                                                         //承租人姓名
            txtIDCard.Text      = rentAttribute.RRAIDCard;                                                                                              //身份证号ID
            txtContactTel.Text  = rentAttribute.RRAContactTel;                                                                                          //承租人联系电话
            txtRentPrice.Text   = rentAttribute.RRentPrice.ToString();                                                                                  //租赁价格

            ddlContactProvince.SelectedIndex = ddlContactProvince.Items.IndexOf(ddlContactProvince.Items.FindByText(rentAttribute.RRAContactProvince)); //获取所属省份
            ddlNationName.SelectedIndex      = ddlNationName.Items.IndexOf(ddlNationName.Items.FindByText(rentAttribute.RRANationName));                //获取所属国籍
            txtStartDate.Text = rentAttribute.RRAStartDate.ToString("yyyy-MM-dd");                                                                      //租赁起始时间
            txtEndDate.Text   = rentAttribute.RRAEndDate.ToString("yyyy-MM-dd");                                                                        //租赁结束时间

            txtDescription.Text = rentAttribute.RRADescription;                                                                                         //备注
            lblCreatedBy.Text   = rentAttribute.RRACreatedBy;
            RentInfoHelper helper = new RentInfoHelper();
            DataTable      dtUser = helper.GetDataTable("select * from cf_user where loginName='" + lblCreatedBy.Text + "'");
            foreach (DataRow row in dtUser.Rows)
            {
                lblCreatedByName.Text = row["RealName"].ToString();                             //创建人
            }
            lblCreatedDate.Text = rentAttribute.RRACreatedDate.ToString("yyyy-MM-dd hh:mm:ss"); //创建时间

            if (EditType == "A")
            {
                lblRentStatus.Text = "此房源已出租";
                btnSave.Visible    = false;
            }
        }
    }
コード例 #21
0
ファイル: RentInfoAdd.aspx.cs プロジェクト: Tony9866/anxinsu
    protected void btnSave_Click(object sender, EventArgs e)
    {
        RentInfo rentInfo = new RentInfo(RentNo);
        //租户身份扫描
        //string url = ConfigurationManager.AppSettings["CertificateUrl"];
        //string data = "{" +
        //                       "\"AppID\":\"0000004\"," +
        //                       "\"FunID\":\"000\"," +
        //                       "\"OrderID\":\""+Guid.NewGuid().ToString().Replace("-","").Substring(0,30)+"\"," +
        //                       "\"HouseID\":\""+RentNo+"\"," +
        //                       "\"LessorID\":\""+rentInfo.RIDCard+"\"," +
        //                       "\"LessorName\":\""+rentInfo.ROwner+"\"," +
        //                       "\"LesseeID\":\""+txtIDCard.Text+"\"," +
        //                       "\"LesseeName\":\""+txtContactName.Text+"\"," +
        //                       "\"Rent\":\""+txtRentPrice.Text+"\"," +
        //                       "\"RentType\":\""+rentInfo.RentType+"\"," +
        //                       "\"StartTime\":\""+txtStartDate.Text+"\"," +
        //                       "\"EndTime\":\""+txtEndDate.Text+"\"," +
        //                       "\"AgentFlag\":\"0\"," +
        //                       "\"AgentID\":\"\"," +
        //                       "\"AgentName\":\"\"" +
        //                       "}";

        //string ret = LigerRM.Common.WebRequestHelper.WebRequestPoster.Post(url, data);
        ////{'ret':'1','desc':'SDT-HOUSE-3836333933303230313730333233313032333235333631'}
        //Dictionary<string,string> result =  JSONHelper.FromJson<Dictionary<string, string>>(ret);
        //if (result["ret"] == "1")
        //{


        RentAttributeHelper rentAttributeHelper = new RentAttributeHelper();

        RentAttribute rentAttribute = new RentAttribute(int.Parse(RentNo));

        rentAttribute.RentNo         = lblRentNo.Text;
        rentAttribute.RRAContactName = txtContactName.Text.Trim();
        rentAttribute.RRAContactTel  = txtContactTel.Text.Trim();
        rentAttribute.RRANationName  = ddlNationName.SelectedItem.Text;
        rentAttribute.RRAIDCard      = txtIDCard.Text.Trim();
        rentAttribute.RRentPrice     = Convert.ToDecimal(txtRentPrice.Text.Trim());

        rentAttribute.RRAContactProvince = ddlContactProvince.SelectedItem.Text;

        rentAttribute.RRAStartDate = Convert.ToDateTime(txtStartDate.Text);
        rentAttribute.RRAEndDate   = Convert.ToDateTime(txtEndDate.Text);

        rentAttribute.RRADescription = txtDescription.Text.Trim();
        rentAttribute.Status         = ((int)RentAttributeHelper.AttributeStatus.Complete).ToString();



        //if (rentInfo.IsAvailable == false)
        //{
        //    rentAttribute.RRACreatedBy = SysContext.CurrentUserName;
        //    rentAttribute.RRACreatedDate = System.DateTime.Now;

        //    //rentAttributeHelper.AddRentAttribute(rentAttribute);
        //}
        //else
        //{
        if (EditType == "E")
        {
            rentAttribute.RRAModifiedBy   = SysContext.CurrentUserName;
            rentAttribute.RRAModifiedDate = System.DateTime.Now;
            rentAttributeHelper.UpdateRentAttribute(rentAttribute);
        }
        //}
        //RentAttributeHelper helper = new RentAttributeHelper();
        //string number = helper.AddRentAttribute(rentAttribute);
        //string imgUrl = CreateQR(number);
        //Session["RentOrder"] = rentAttribute;
        //Response.Redirect("ScanImage.aspx?url=" + imgUrl + "&ran=" + number);

        Session["RentNo"] = null;
        ScriptManager.RegisterStartupScript(btnSave, GetType(), "warning", "javascript:SubmitDialog('" + rentAttribute.RentNo + "');", true);
        //}
    }
コード例 #22
0
ファイル: AjaxRentManage.cs プロジェクト: Tony9866/anxinsu
        public static AjaxResult AddRentRecord(string name, string idcard)
        {
            string sql = "select * from rent_rentattribute where (('" + DateTime.Now + "'>=RRAStartDate and '" + DateTime.Now.ToString() + "'< RRAEndDate)" +
                         " or ('" + DateTime.Now.AddDays(4).ToString() + "'>RRAStartDate and '" + DateTime.Now.AddDays(4).ToString() + "'<=RRAEndDate) or ('" + DateTime.Now.ToString() + "'<RRAStartDate and '" + DateTime.Now.AddDays(4).ToString() + "'>RRAEndDate)) and rrastatus not in ('5','7','8','9') order by RRACreatedDate desc";
            DataTable dt1 = MySQLHelper.ExecuteDataset(MySQLHelper.SqlConnString, MySQLHelper.CreateCommand(sql)).Tables[0];

            Dictionary <string, string> used = new Dictionary <string, string>();
            Dictionary <string, string> all  = new Dictionary <string, string>();
            Dictionary <string, string> left = new Dictionary <string, string>();

            foreach (DataRow r in dt1.Rows)
            {
                used.Add(r["rraId"].ToString(), r["RentNO"].ToString());
            }

            sql = "select * from v_RentDetail_view where RIDCard=(select idcard from CF_User where LoginName='" + LigerRM.Common.SysContext.CurrentUserName + "')";
            DataTable dt = DB.ExecuteDataSet(sql).Tables[0];

            foreach (DataRow r in dt.Rows)
            {
                all.Add(r["rid"].ToString(), r["RentNO"].ToString());
            }

            foreach (KeyValuePair <string, string> p in all)
            {
                if (!used.Values.Contains(p.Value))
                {
                    left.Add(p.Key, p.Value);
                }
            }

            string rentNo = string.Empty;

            if (left.Count == 0)
            {
                Random ran   = new Random(1);
                int    index = ran.Next(0, all.Count);
                rentNo = dt.Rows[index]["RentNO"].ToString();
            }
            else
            {
                Random ran   = new Random(1);
                int    index = ran.Next(0, left.Count);
                rentNo = left.Values.ToList()[index];
            }
            RentInfo rentInfo = new RentInfo(rentNo);
            //租户身份扫描

            RentAttributeHelper rentAttributeHelper = new RentAttributeHelper();

            RentAttribute rentAttribute = new RentAttribute(rentInfo.RentNo);

            rentAttribute.RentNo             = rentInfo.RentNo;
            rentAttribute.RRAContactName     = name;
            rentAttribute.RRAContactTel      = string.Empty;
            rentAttribute.RRANationName      = string.Empty;
            rentAttribute.RRAIDCard          = idcard;
            rentAttribute.RRentPrice         = Convert.ToDecimal(rentInfo.RLocationDescription);
            rentAttribute.RRAContactProvince = string.Empty;
            rentAttribute.RRAStartDate       = DateTime.Now;
            rentAttribute.RRAEndDate         = DateTime.Now.AddDays(4);
            rentAttribute.RRADescription     = string.Empty;
            rentAttribute.Status             = ((int)RentAttributeHelper.AttributeStatus.Complete).ToString();
            rentAttribute.RRACreatedBy       = SysContext.CurrentUserName;
            rentAttribute.RRACreatedDate     = System.DateTime.Now;
            RentAttributeHelper helper = new RentAttributeHelper();
            string number = helper.AddRentAttribute(rentAttribute);

            //写入华泽数据
            helper.UploadDataToHZ(number, rentInfo.RentNo);
            return(AjaxResult.Success());
        }
コード例 #23
0
        /// <summary>
        /// 初始化SessionInfo,如果应用程序单机运行(不在主模块中运行),此处可设置SessionInfo的默认值
        /// </summary>
        protected virtual void InitSessionInfo()
        {
            Session             = SessionInfo.CreateSessionInfo(AppName, ModuleID, AppType);
            Session.InstallPath = @"C:\UMPRelease";

            RentInfo rentInfo = new RentInfo();

            rentInfo.ID      = ConstValue.RENT_DEFAULT;
            rentInfo.Token   = ConstValue.RENT_DEFAULT_TOKEN;
            rentInfo.Domain  = "voicecyber.com";
            rentInfo.Name    = "voicecyber";
            Session.RentInfo = rentInfo;
            Session.RentID   = ConstValue.RENT_DEFAULT;

            UserInfo userInfo = new UserInfo();

            userInfo.UserID   = ConstValue.USER_ADMIN;
            userInfo.Account  = "administrator";
            userInfo.UserName = "******";
            userInfo.Password = "******";
            Session.UserInfo  = userInfo;
            Session.UserID    = ConstValue.USER_ADMIN;

            RoleInfo roleInfo = new RoleInfo();

            roleInfo.ID      = ConstValue.ROLE_SYSTEMADMIN;
            roleInfo.Name    = "System Admin";
            Session.RoleInfo = roleInfo;
            Session.RoleID   = ConstValue.ROLE_SYSTEMADMIN;

            ThemeInfo themeInfo = new ThemeInfo();

            themeInfo.Name    = "Default";
            themeInfo.Color   = "Brown";
            Session.ThemeInfo = themeInfo;
            Session.ThemeName = "Default";

            themeInfo       = new ThemeInfo();
            themeInfo.Name  = "Style01";
            themeInfo.Color = "Green";
            Session.SupportThemes.Add(themeInfo);

            themeInfo       = new ThemeInfo();
            themeInfo.Name  = "Style02";
            themeInfo.Color = "Yellow";
            Session.SupportThemes.Add(themeInfo);

            themeInfo       = new ThemeInfo();
            themeInfo.Name  = "Style03";
            themeInfo.Color = "Brown";
            Session.SupportThemes.Add(themeInfo);

            themeInfo       = new ThemeInfo();
            themeInfo.Name  = "Style04";
            themeInfo.Color = "Blue";
            Session.SupportThemes.Add(themeInfo);

            LangTypeInfo langType = new LangTypeInfo();

            langType.LangID   = 1033;
            langType.LangName = "en-us";
            langType.Display  = "English";
            Session.SupportLangTypes.Add(langType);

            langType          = new LangTypeInfo();
            langType.LangID   = 2052;
            langType.LangName = "zh-cn";
            langType.Display  = "简体中文";
            Session.SupportLangTypes.Add(langType);
            Session.LangTypeInfo = langType;
            Session.LangTypeID   = langType.LangID;

            langType          = new LangTypeInfo();
            langType.LangID   = 1028;
            langType.LangName = "zh-cn";
            langType.Display  = "繁体中文";
            Session.SupportLangTypes.Add(langType);
        }
コード例 #24
0
ファイル: RentDetail.aspx.cs プロジェクト: Tony9866/anxinsu
    protected void btnSave_Click(object sender, EventArgs e)
    {
        RentInfoHelper rentInfoHelper = new RentInfoHelper();
        //if (rentInfoHelper.IsExistsSameAddressRent(ddlDistrict.Text,ddlStreet.Text,ddlRoad.Text,txtDoor.Text.Trim()))
        //{
        //    string detailAddress = ddlDistrict.Text + "-" + ddlStreet.Text + "-" + ddlRoad.Text + "-" + txtDoor.Text.Trim();
        //    ScriptManager.RegisterStartupScript(btnSave, GetType(), "warning", "javascript:$.ligerDialog.warn('相同的房源名称("+ detailAddress + ")已经存在,请重新填写!');", true);
        //}
        //else
        //{

        //if (string.IsNullOrEmpty(lblRentNo.Text))
        //{
        //    lblRentNo.Text = rentInfoHelper.GetRentNo(ddlDistrict.SelectedValue);
        //}

        RentInfo rentInfo = new RentInfo(lblRentNo.Text);

        rentInfo.RentNo               = lblRentNo.Text;
        rentInfo.RDName               = ddlDistrict.SelectedValue;
        rentInfo.RSName               = ddlStreet.SelectedValue;
        rentInfo.RRName               = ddlRoad.SelectedValue;
        rentInfo.RPSParentName        = ddlPoliceStationParent.SelectedValue;
        rentInfo.RPSName              = ddlPoliceStation.SelectedValue;
        rentInfo.RLocationDescription = txtFee.Text;
        //rentInfo.RPSID = Convert.ToInt32(ddlPoliceStation.SelectedValue);
        rentInfo.RPSID = ddlPoliceStation.SelectedValue;

        rentInfo.RAddress = txtAddress.Text.Trim();
        rentInfo.RDoor    = txtDoor.Text.Trim();

        if (!string.IsNullOrEmpty(txtTotalDoor.Text.Trim()))
        {
            rentInfo.RTotalDoor = Convert.ToInt16(txtTotalDoor.Text.Trim());
        }
        else
        {
            rentInfo.RTotalDoor = 0;
        }

        if (ddlRoomType.SelectedValue != "0")
        {
            rentInfo.RRoomType = ddlRoomType.SelectedItem.Value;
        }
        else
        {
            rentInfo.RRoomType = string.Empty;
        }
        if (ddlDirection.SelectedValue != "0")
        {
            rentInfo.RDirection = ddlDirection.SelectedItem.Value;
        }
        else
        {
            rentInfo.RDirection = string.Empty;
        }
        if (ddlStructure.SelectedValue != "0")
        {
            rentInfo.RStructure = ddlStructure.SelectedItem.Value;
        }
        else
        {
            rentInfo.RStructure = string.Empty;
        }
        if (ddlBuildingType.SelectedValue != "0")
        {
            rentInfo.RBuildingType = ddlBuildingType.SelectedItem.Value;
        }
        else
        {
            rentInfo.RBuildingType = string.Empty;
        }
        if (ddlProperty.SelectedValue != "0")
        {
            rentInfo.RProperty = ddlProperty.SelectedItem.Value;
        }
        else
        {
            rentInfo.RProperty = string.Empty;
        }

        rentInfo.RFloor = txtFloor.Text.Trim();
        if (!string.IsNullOrEmpty(txtTotalFloor.Text.Trim()))
        {
            rentInfo.RTotalFloor = Convert.ToInt16(txtTotalFloor.Text.Trim());
        }
        else
        {
            rentInfo.RTotalFloor = 0;
        }
        rentInfo.RentType  = ddlRentType.SelectedValue;
        rentInfo.OwnType   = ddlOwnType.SelectedValue;
        rentInfo.RHouseAge = Convert.ToInt16(txtHouseAge.Text.Trim());
        rentInfo.RRentArea = Convert.ToDecimal(txtBuildRentArea.Text.Trim());
        rentInfo.ROwner    = txtOwner.Text.Trim();
        rentInfo.ROwnerTel = txtOwnerTel.Text.Trim();
        rentInfo.RIDCard   = txtIDCard.Text.Trim();
        //rentInfo.RLocationDescription = txtLocationDescription.Text.Trim();

        rentInfo.RMapID = 0;

        if (string.IsNullOrEmpty(RentNo))
        {
            rentInfo.RCreatedBy   = SysContext.CurrentUserName;
            rentInfo.RCreatedDate = System.DateTime.Now;
        }
        else
        {
            rentInfo.RModifiedBy   = SysContext.CurrentUserName;
            rentInfo.RModifiedDate = System.DateTime.Now;
        }

        rentInfo.Longitude = txtLangitude.Text;
        rentInfo.Latitude  = txtLatitude.Text;

        rentInfoHelper.UpdateRent(rentInfo);
        Session["RentNo"] = null;
        ScriptManager.RegisterStartupScript(btnSave, GetType(), "warning", "javascript:SubmitDialog('" + rentInfo.RentNo + "');", true);
        //}
    }
コード例 #25
0
        public static Boolean addPhieuDat(RentInfo r, List <Room> lstrooms)
        {
            try
            {
                //GetDBConnection();
                //conn.Open();
                //SqlTransaction transaction = conn.BeginTransaction();
                String cmndkh  = r.idCard;
                String checkkh = "Select * FROM KHACHHANG WHERE CMND_PASSPORT ='" + r.idCard + "'";
                int    temp    = 0;
                String mahuy   = RandomString();

                if (r.gender)
                {
                    temp = 1;
                }
                DataTable dt = ExecSqlDataTable(checkkh, DataUtil.connstr);
                if (dt.Rows.Count > 0)
                {
                    String sqlkh = "UPDATE [dbo].[KHACHHANG] SET  [HoKH] = N'" + "',[TenKH] = N'" + r.nameClient + "',[SoDienThoaiKH] = '" + r.phone + "',[GioiTinhKH] = " + temp + ",[NgaySinhKH] = '" + r.birth + "',[Email] = '" + r.email + "' WHERE CMND_PASSPORT = '" + r.idCard + "'";
                    if (ExecQueryString(sqlkh))
                    {
                        String    checkippd = "select * from PHIEUDAT ";
                        DataTable table     = ExecSqlDataTable(checkippd, connstr);
                        String    mpd       = "ONLINE" + (table.Rows.Count + 1);
                        string    sql       = "INSERT INTO [PHIEUDAT]([MAPhieuDat],[CNMDKH],[MANV],[NgayDen],[NgayDi],[NgayDat],[TrangThaiPhieudat],[TienCoc],[MaHuy])VALUES('" + mpd + "',N'" + r.idCard + "',NULL,'" + r.dateRent + "','" + r.datePay + "','" + DateTime.Now + "', " + 1 + "," + r.deposit + ",'" + mahuy + "')";

                        if (ExecQueryString(sql))
                        {
                            foreach (Room room in lstrooms)
                            {
                                string sqlct = "INSERT INTO [CTPHIEUDAT]([MAPhieuDat],[MAHangPhong],[SoLuong])VALUES('" + mpd + "','" + room.hangphong + "','" + room.soluong + "')";
                                if (!ExecQueryString(sqlct))
                                {
                                    throw new System.Exception("Error:  " + mpd);
                                }
                            }
                        }
                        else
                        {
                            throw new System.Exception("Error:  " + mpd);
                        }
                    }
                }
                else
                {
                    string sqlkh = "INSERT INTO [KHACHHANG]([CMND_PASSPORT],[HoKH],[TenKH],[SoDienThoaiKH],[GioiTinhKH],[NgaySinhKH],[Email]) VALUES('" + r.idCard + "',N'" + "',N'" + r.nameClient + "','" + r.phone + "'," + temp + ",'" + r.birth + "','" + r.email + "')";
                    if (ExecQueryString(sqlkh))
                    {
                        String checkippd = "select * from PHIEUDAT ";
                        GetDBConnection();
                        conn.Open();
                        DataTable t = ExecSqlDataTable(checkippd, connstr);
                        conn.Close();
                        String mpd = "ONLINE" + (t.Rows.Count + 1);
                        string sql = "INSERT INTO [PHIEUDAT]([MAPhieuDat],[CNMDKH],[MANV],[NgayDen],[NgayDi],[NgayDat],[TrangThaiPhieuDat],[TienCoc],[MaHuy])VALUES('" + mpd + "',N'" + r.idCard + "',NULL,'" + r.dateRent + "','" + r.datePay + "','" + DateTime.Now + "', " + 1 + "," + r.deposit + ",'Ma Huy')";

                        if (ExecQueryString(sql))
                        {
                            foreach (Room room in lstrooms)
                            {
                                string sqlct = "INSERT INTO [CTPHIEUDAT]([MAPhieuDat],[MAHangPhong],[SoLuong])VALUES('" + mpd + "','" + room.hangphong + "','" + room.soluong + "')";
                                if (!ExecQueryString(sqlct))
                                {
                                    throw new System.Exception("Error:  " + mpd);
                                }
                            }
                            //transaction.Commit();
                        }
                        else
                        {
                            //transaction.Rollback();
                            throw new System.Exception("Error:  " + mpd);
                        }
                    }
                    else
                    {
                        throw new System.Exception("Error:  " + r.idCard);
                    }
                }
                return(true);
            }
            catch (Exception e)
            {
                Console.Write("aaaaaaaaaa" + e.Message);
                return(false);
            }
        }
コード例 #26
0
ファイル: DBManager.cs プロジェクト: lironsh11/CarsRent
 //all RentInfos functions - get list, add new RentInfo, delete current RentInfo, and update current RentInfo
 #region RentInfoFunctions
 public void AddRentInfo(RentInfo Value)
 {
     DataBase.RentInfo.Add(Value);
 }
コード例 #27
0
ファイル: DBManager.cs プロジェクト: lironsh11/CarsRent
 public void DeleteRentInfo(RentInfo Value)
 {
     DataBase.RentInfo.Remove(Value);
 }
コード例 #28
0
ファイル: DBManager.cs プロジェクト: lironsh11/CarsRent
 public void UpdateRentInfo(RentInfo Value)
 {
     DataBase.RentInfo.Update(Value);
 }
コード例 #29
0
ファイル: RentIconAdd.aspx.cs プロジェクト: Tony9866/anxinsu
    protected void btnSave_Click(object sender, EventArgs e)
    {
        RentInfo rentInfo = new RentInfo(RentNo);
        //租户身份扫描

        RentAttributeHelper rentAttributeHelper = new RentAttributeHelper();

        RentAttribute rentAttribute = new RentAttribute(lblRentNo.Text);

        rentAttribute.RentNo             = lblRentNo.Text;
        rentAttribute.RRAContactName     = txtContactName.Text.Trim();
        rentAttribute.RRAContactTel      = txtContactTel.Text.Trim();
        rentAttribute.RRANationName      = txtPassword.Text;
        rentAttribute.RRAIDCard          = txtIDCard.Text.Trim();
        rentAttribute.RRentPrice         = Convert.ToDecimal(txtRentPrice.Text.Trim());
        rentAttribute.RRAContactProvince = string.Empty;
        rentAttribute.RRAStartDate       = Convert.ToDateTime(txtStartDate.Text);
        rentAttribute.RRAEndDate         = Convert.ToDateTime(txtEndDate.Text);
        rentAttribute.RRADescription     = string.Empty;
        rentAttribute.Status             = ((int)RentAttributeHelper.AttributeStatus.Complete).ToString();



        if (rentInfo.IsAvailable == false)
        {
            rentAttribute.RRACreatedBy   = SysContext.CurrentUserName;
            rentAttribute.RRACreatedDate = System.DateTime.Now;
        }
        else
        {
            if (EditType == "E")
            {
                rentAttribute.RRAModifiedBy   = SysContext.CurrentUserName;
                rentAttribute.RRAModifiedDate = System.DateTime.Now;
                rentAttributeHelper.UpdateRentAttribute(rentAttribute);
            }
        }
        RentAttributeHelper helper = new RentAttributeHelper();
        string number = helper.AddRentAttribute(rentAttribute);

        for (int i = 0; i < dlRenties.Items.Count; i++)
        {
            TextBox txtName   = dlRenties.Items[i].FindControl("txtName") as TextBox;
            TextBox txtIdCard = dlRenties.Items[i].FindControl("txtIdCard") as TextBox;

            dtRenties.Rows[i][0] = txtName.Text;
            dtRenties.Rows[i][1] = txtIdCard.Text;
        }
        //写入随行人员
        foreach (DataRow row in dtRenties.Rows)
        {
            if (!row.IsNull("Name") && !row.IsNull("IDCard"))
            {
                helper.AddRetinues(row["Name"].ToString(), row["IDCard"].ToString(), number);
            }
        }

        //写入密码
        helper.AddPassword(lblRentNo.Text, txtPassword.Text, txtStartDate.Text, txtEndDate.Text, txtContactTel.Text);

        //写入华泽数据
        helper.UploadDataToHZ(number, lblRentNo.Text);

        //string imgUrl = CreateQR(number);
        //Session["RentOrder"] = rentAttribute;
        //Response.Redirect("ScanImage.aspx?url=" + imgUrl + "&ran=" + number);

        //Session["RentNo"] = null;
        ScriptManager.RegisterStartupScript(btnSave, GetType(), "warning", "javascript:SubmitDialog();", true);
        //}
    }
コード例 #30
0
ファイル: RentDetail.aspx.cs プロジェクト: Tony9866/anxinsu
    protected void InitialControls()
    {
        DataBindDistrict();
        DataBindPoliceStationParent();

        DataBindRoomType();

        if (string.IsNullOrEmpty(RentNo) && EditType == "E")
        {
            lblCreatedBy.Text     = SysContext.CurrentUserName;
            lblCreatedByName.Text = SysContext.CurrentRealName;
            lblCreatedDate.Text   = System.DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");

            CFUserInfo info = new CFUserInfo(SysContext.CurrentUserName);
            txtOwner.Text    = info.RealName;
            txtIDCard.Text   = info.IDCard;
            txtOwnerTel.Text = info.Phone;
        }
        else
        {
            ddlDistrict.Enabled = false;
            RentInfo rentInfo = new RentInfo(RentNo);
            ViewState["RentNo"] = RentNo;
            lblRentNo.Text      = RentNo;

            ddlDistrict.SelectedIndex = ddlDistrict.Items.IndexOf(ddlDistrict.Items.FindByValue(rentInfo.RDName));
            DataBindStreet();
            ddlStreet.SelectedIndex = ddlStreet.Items.IndexOf(ddlStreet.Items.FindByValue(rentInfo.RSName));
            DataBindRoad(string.Empty);
            ddlRoad.SelectedIndex = ddlRoad.Items.IndexOf(ddlRoad.Items.FindByValue(rentInfo.RRName));

            ddlPoliceStationParent.SelectedIndex = ddlPoliceStationParent.Items.IndexOf(ddlPoliceStationParent.Items.FindByValue(rentInfo.RPSParentName));

            DataBindPoliceStation();
            if (rentInfo.RPSID != null)
            {
                ddlPoliceStation.SelectedIndex = ddlPoliceStation.Items.IndexOf(ddlPoliceStation.Items.FindByValue(rentInfo.RPSID.ToString()));
            }
            else
            {
                ddlPoliceStation.SelectedIndex = -1;
            }

            ddlRoomType.SelectedIndex     = ddlRoomType.Items.IndexOf(ddlRoomType.Items.FindByValue(rentInfo.RRoomType));
            ddlDirection.SelectedIndex    = ddlDirection.Items.IndexOf(ddlDirection.Items.FindByValue(rentInfo.RDirection));
            ddlBuildingType.SelectedIndex = ddlBuildingType.Items.IndexOf(ddlBuildingType.Items.FindByValue(rentInfo.RBuildingType));
            ddlStructure.SelectedIndex    = ddlStructure.Items.IndexOf(ddlStructure.Items.FindByValue(rentInfo.RStructure));
            ddlProperty.SelectedIndex     = ddlProperty.Items.IndexOf(ddlProperty.Items.FindByValue(rentInfo.RProperty));

            ddlRentType.SelectedIndex = ddlRentType.Items.IndexOf(ddlRentType.Items.FindByValue(rentInfo.RentType));
            ddlOwnType.SelectedIndex  = ddlOwnType.Items.IndexOf(ddlOwnType.Items.FindByValue(rentInfo.OwnType));

            txtAddress.Text = rentInfo.RAddress;
            txtDoor.Text    = rentInfo.RDoor;
            if (rentInfo.RTotalDoor == 0)
            {
                txtTotalDoor.Text = string.Empty;
            }
            else
            {
                txtTotalDoor.Text = rentInfo.RTotalDoor.ToString();
            }
            txtFloor.Text = rentInfo.RFloor.ToString();
            if (rentInfo.RTotalFloor == 0)
            {
                txtTotalFloor.Text = string.Empty;
            }
            else
            {
                txtTotalFloor.Text = rentInfo.RTotalFloor.ToString();
            }
            txtHouseAge.Text      = rentInfo.RHouseAge.ToString();
            txtBuildRentArea.Text = rentInfo.RRentArea.ToString();
            txtOwner.Text         = rentInfo.ROwner;
            txtIDCard.Text        = rentInfo.RIDCard;
            txtOwnerTel.Text      = rentInfo.ROwnerTel;
            txtFee.Text           = rentInfo.RLocationDescription;
            lblCreatedBy.Text     = rentInfo.RCreatedBy;
            RentInfoHelper helper = new RentInfoHelper();
            DataTable      dtUser = helper.GetDataTable("select * from cf_user where loginName='" + lblCreatedBy.Text + "'");
            foreach (DataRow row in dtUser.Rows)
            {
                lblCreatedByName.Text = row["RealName"].ToString();
            }
            lblCreatedDate.Text = rentInfo.RCreatedDate.ToString("yyyy-MM-dd hh:mm:ss");
            txtLangitude.Text   = rentInfo.Longitude;
            txtLatitude.Text    = rentInfo.Latitude;

            if (EditType == "E")
            {
                btnSave.Visible = true;
            }
            else
            {
                btnSave.Visible = false;
            }
        }
    }