Esempio n. 1
0
        private void btnAddHotel_Click(object sender, EventArgs e)
        {
            AddHotel addHotel = new AddHotel();

            if (addHotel.ShowDialog() == DialogResult.OK)
            {
                if (isModify)
                {
                    addHotel.hotel.SupplierID = supplier.SupplierID;
                    string    str_result = WebCall.PostMethod <HotelDto>(WebCall.AddHotel, addHotel.hotel);
                    WebResult result     = AppUtils.JsonDeserialize <WebResult>(str_result);
                    if (result.Code.Equals(SystemConst.MSG_SUCCESS))
                    {
                        hotels.Add(addHotel.hotel);
                        dgHotel.DataSource = null;
                        dgHotel.DataSource = hotels;
                    }
                    else
                    {
                        ClientUtils.WarningCode(result.Message);
                    }
                }
                else
                {
                    hotels.Add(addHotel.hotel);
                    dgHotel.DataSource = null;
                    dgHotel.DataSource = hotels;
                }
            }
        }
Esempio n. 2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (!ClientUtils.CheckEmpty(txtName, "EMPTY_NAME") ||
                !ClientUtils.CheckEmpty(txtLoginName, "EMPTY_LOGIN_NAME") ||
                !ClientUtils.CheckEmpty(cbxRole, "EMPTY_ROLE"))
            {
                return;
            }
            int     id    = isModify ? user.UserID : 0;
            UserDto param = new UserDto
            {
                UserID    = id,
                UserName  = txtName.Text,
                LoginName = txtLoginName.Text,
                RoleID    = roles[cbxRole.SelectedIndex].RoleID,
                isEnable  = chkEnable.Checked
            };

            string    strResult = WebCall.PostMethod <UserDto>(isModify?WebCall.ModifyUser:WebCall.AddUser, param);
            WebResult result    = AppUtils.JsonDeserialize <WebResult>(strResult);

            if (result.Code.Equals(SystemConst.MSG_SUCCESS))
            {
                ClientUtils.WarningCode(Travel.Client.Lang.LangBase.GetString(isModify? "MODIFY_SUCCESS" : "ADD_USER_SUCCESS") + result.Message);
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            else
            {
                ClientUtils.WarningCode(result.Message);
            }
        }
Esempio n. 3
0
        private void btnAddService_Click(object sender, EventArgs e)
        {
            AddTravelProject addTravel = new AddTravelProject();

            if (addTravel.ShowDialog() == DialogResult.OK)
            {
                if (isModify)
                {
                    addTravel.travelProject.SupplierID = supplier.SupplierID;
                    string    str_result = WebCall.PostMethod <TravelProjectDto>(WebCall.AddTravelService, addTravel.travelProject);
                    WebResult result     = AppUtils.JsonDeserialize <WebResult>(str_result);
                    if (result.Code.Equals(SystemConst.MSG_SUCCESS))
                    {
                        refreshData();
                    }
                    else
                    {
                        ClientUtils.WarningCode(result.Message);
                    }
                }
                else
                {
                    travelProjects.Add(addTravel.travelProject);
                    dgTravelService.DataSource = null;
                    dgTravelService.DataSource = travelProjects;
                }
            }
        }
Esempio n. 4
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (!ClientUtils.CheckEmpty(txtName, "EMPTY_VIP_NAME"))
            {
                return;
            }
            int    id    = isModify ? vip.ServerID: 0;
            VIPDto param = new VIPDto
            {
                ServerID   = id,
                SupplierID = supplierID,
                ServerName = txtName.Text,
                Contact    = txtContact.Text,
                Tel        = txtTel.Text,
                Remark     = txtRemark.Text,
            };
            string    strResult = WebCall.PostMethod <VIPDto>(isModify ? WebCall.ModifyVips : WebCall.AddVips, param);
            WebResult result    = AppUtils.JsonDeserialize <WebResult>(strResult);

            if (result.Code.Equals(SystemConst.MSG_SUCCESS))
            {
                ClientUtils.WarningCode(Travel.Client.Lang.LangBase.GetString(isModify ? "MODIFY_VIP_SUCCESS" : "ADD_VIP_SUCCESS") + result.Message);
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            else
            {
                ClientUtils.WarningCode(result.Message);
            }
        }
Esempio n. 5
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (!ClientUtils.CheckEmpty(txtName, "EMPTY_DRIVER_NAME") ||
                !ClientUtils.CheckEmpty(txtBigCar, "EMPTY_FEE") ||
                !ClientUtils.CheckEmpty(txtAgentBigCar, "EMPTY_FEE") ||
                !ClientUtils.CheckEmpty(txtSmallCar, "EMPTY_FEE") ||
                !ClientUtils.CheckEmpty(txtAgentSmallCar, "EMPTY_FEE") ||
                !ClientUtils.CheckEmpty(txtBigCarPick, "EMPTY_FEE") ||
                !ClientUtils.CheckEmpty(txtAgentBigCarPick, "EMPTY_FEE") ||
                !ClientUtils.CheckEmpty(txtSmallCarPick, "EMPTY_FEE") ||
                !ClientUtils.CheckEmpty(txtAgentSmallCarPick, "EMPTY_FEE") ||
                !ClientUtils.CheckEmpty(txtBigCarSend, "EMPTY_FEE") ||
                !ClientUtils.CheckEmpty(txtAgentBigCarSend, "EMPTY_FEE") ||
                !ClientUtils.CheckEmpty(txtSmallCarSend, "EMPTY_FEE") ||
                !ClientUtils.CheckEmpty(txtAgentSmallCarSend, "EMPTY_FEE"))
            {
                return;
            }
            int       driverID = isModify ? selectedDriver.DriverID : 0;
            DriverDto param    = new DriverDto
            {
                DriverID                    = driverID,
                DriverName                  = txtName.Text,
                Tel                         = txtTel.Text,
                Contact                     = txtContact.Text,
                BigCarFee                   = Convert.ToSingle(txtBigCar.Text),
                SmallCarFee                 = Convert.ToSingle(txtSmallCar.Text),
                AgentBigCarFee              = Convert.ToSingle(txtAgentBigCar.Text),
                AgentBigCarPickAirportFee   = Convert.ToSingle(txtAgentBigCarPick.Text),
                AgentBigCarSendAirportFee   = Convert.ToSingle(txtAgentBigCarSend.Text),
                BigCarPickAirportFee        = Convert.ToSingle(txtBigCarPick.Text),
                BigCarSendAirportFee        = Convert.ToSingle(txtBigCarSend.Text),
                AgentSmallCarFee            = Convert.ToSingle(txtAgentSmallCar.Text),
                AgentSmallCarPickAirportFee = Convert.ToSingle(txtAgentSmallCarPick.Text),
                AgentSmallCarSendAirportFee = Convert.ToSingle(txtAgentSmallCarSend.Text),
                SmallCarPickAirportFee      = Convert.ToSingle(txtSmallCarPick.Text),
                SmallCarSendAirportFee      = Convert.ToSingle(txtSmallCarSend.Text),
                Remark                      = txtRemark.Text,
                SupplierID                  = supplierID
            };
            string    strResult = WebCall.PostMethod <DriverDto>(isModify ? WebCall.ModifyDrivers: WebCall.AddDrivers, param);
            WebResult result    = AppUtils.JsonDeserialize <WebResult>(strResult);

            if (result.Code.Equals(SystemConst.MSG_SUCCESS))
            {
                ClientUtils.WarningCode(Travel.Client.Lang.LangBase.GetString(isModify ? "MODIFY_SUCCESS" : "ADD_SUCCESS") + result.Message);
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            else
            {
                ClientUtils.WarningCode(result.Message);
            }
        }
Esempio n. 6
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (!ClientUtils.CheckEmpty(txtSupplierName, "EMPTY_SUPPLIER_NAME") ||
                !ClientUtils.CheckEmpty(txtContact, "EMPTY_SUPPLIER_CONTACT"))
            {
                return;
            }

            if (!isModify)
            {
                SupplierPara supplierPara = new SupplierPara();
                supplierPara.supplier = new Supplier
                {
                    SupplierName = txtSupplierName.Text,
                    Contact      = txtContact.Text
                };
                supplierPara.travelProjects = travelProjects.ToList();
                supplierPara.hotels         = hotels.ToList();
                string    str_result = WebCall.PostMethod <SupplierPara>(WebCall.AddSupplier, supplierPara);
                WebResult result     = AppUtils.JsonDeserialize <WebResult>(str_result);
                if (result.Code.Equals(SystemConst.MSG_SUCCESS))
                {
                    ClientUtils.WarningCode("ADD_SUCCESS");
                    this.DialogResult = DialogResult.OK;
                    this.Close();
                }
                else
                {
                    ClientUtils.WarningCode(result.Message);
                }
            }
            else
            {
                Supplier selectSupplier = new Supplier
                {
                    SupplierID   = supplier.SupplierID,
                    SupplierName = txtSupplierName.Text,
                    Contact      = txtContact.Text
                };
                string    str_result = WebCall.PostMethod <Supplier>(WebCall.ModifySupplier, selectSupplier);
                WebResult result     = AppUtils.JsonDeserialize <WebResult>(str_result);
                if (result.Code.Equals(SystemConst.MSG_SUCCESS))
                {
                    ClientUtils.WarningCode("MODIFY_SUCCESS");
                    this.DialogResult = DialogResult.OK;
                    this.Close();
                }
                else
                {
                    ClientUtils.WarningCode(result.Message);
                }
            }
        }
Esempio n. 7
0
 private void modifyHotel()
 {
     if (dgHotel.SelectedCells.Count == 0)
     {
         MessageBox.Show(LangBase.GetString("NOT_SELECT_HOTEL"));
         return;
     }
     else
     {
         int      rowIndex    = dgHotel.SelectedCells[0].RowIndex;
         HotelDto hotel       = hotels[rowIndex];
         AddHotel modifyHotel = new AddHotel(hotel);
         if (isModify)
         {
             if (modifyHotel.ShowDialog() == DialogResult.OK)
             {
                 modifyHotel.hotel.HouseID = hotel.HouseID;
                 string    str_result = WebCall.PostMethod <HotelDto>(WebCall.ModifyHotel, modifyHotel.hotel);
                 WebResult result     = AppUtils.JsonDeserialize <WebResult>(str_result);
                 if (result.Code.Equals(SystemConst.MSG_SUCCESS))
                 {
                     hotel.HouseName    = modifyHotel.hotel.HouseName;
                     hotel.Fee          = modifyHotel.hotel.Fee;
                     hotel.AgentFee     = modifyHotel.hotel.AgentFee;
                     hotel.CoverPic     = modifyHotel.hotel.CoverPic;
                     hotel.Pics         = modifyHotel.hotel.Pics;
                     hotel.Description  = modifyHotel.hotel.Description;
                     hotel.Remark       = modifyHotel.hotel.Remark;
                     hotel.Location     = modifyHotel.hotel.Location;
                     hotel.RoomCount    = modifyHotel.hotel.RoomCount;
                     dgHotel.DataSource = null;
                     dgHotel.DataSource = hotels;
                 }
                 else
                 {
                     ClientUtils.WarningCode(result.Message);
                 }
             }
         }
         else
         {
             if (modifyHotel.ShowDialog() == DialogResult.OK)
             {
                 hotels.RemoveAt(rowIndex);
                 hotels.Add(modifyHotel.hotel);
                 dgHotel.DataSource = null;
                 dgHotel.DataSource = hotels;
             }
         }
     }
 }
Esempio n. 8
0
 private void modifyTravelService()
 {
     if (dgTravelService.SelectedCells.Count == 0)
     {
         MessageBox.Show(LangBase.GetString("NOT_SELECT_TRAVEL_SERVICE"));
         return;
     }
     else
     {
         int rowIndex = dgTravelService.SelectedCells[0].RowIndex;
         TravelProjectDto travelProject       = travelProjects[rowIndex];
         AddTravelProject modifyTravelProject = new AddTravelProject(travelProject);
         if (isModify)
         {
             if (modifyTravelProject.ShowDialog() == DialogResult.OK)
             {
                 modifyTravelProject.travelProject.ProjectID = travelProject.ProjectID;
                 string    str_result = WebCall.PostMethod <TravelProjectDto>(WebCall.ModifyTravelService, modifyTravelProject.travelProject);
                 WebResult result     = AppUtils.JsonDeserialize <WebResult>(str_result);
                 if (result.Code.Equals(SystemConst.MSG_SUCCESS))
                 {
                     travelProject.ProjectName   = modifyTravelProject.travelProject.ProjectName;
                     travelProject.AdultFee      = modifyTravelProject.travelProject.AdultFee;
                     travelProject.ChildFee      = modifyTravelProject.travelProject.ChildFee;
                     travelProject.AgentAdultFee = modifyTravelProject.travelProject.AgentAdultFee;
                     travelProject.AgentChildFee = modifyTravelProject.travelProject.AgentChildFee;
                     travelProject.Description   = modifyTravelProject.travelProject.Description;
                     travelProject.ProjectTypeID = modifyTravelProject.travelProject.ProjectTypeID;
                     travelProject.Remark        = modifyTravelProject.travelProject.Remark;
                     travelProject.CoverPic      = modifyTravelProject.travelProject.CoverPic;
                     dgTravelService.DataSource  = null;
                     dgTravelService.DataSource  = travelProjects;
                 }
                 else
                 {
                     ClientUtils.WarningCode(result.Message);
                 }
             }
         }
         else
         {
             if (modifyTravelProject.ShowDialog() == DialogResult.OK)
             {
                 travelProjects.RemoveAt(rowIndex);
                 travelProjects.Add(modifyTravelProject.travelProject);
                 dgTravelService.DataSource = null;
                 dgTravelService.DataSource = travelProjects;
             }
         }
     }
 }
Esempio n. 9
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (!ClientUtils.CheckEmpty(txtGuideName, "EMPTY_GUIDE_NAME") ||
                !ClientUtils.CheckEmpty(txtLandFee, "EMPTY_LAND_FEE") ||
                !ClientUtils.CheckEmpty(txtSeaFee, "EMPTY_SEA_FEE") ||
                !ClientUtils.CheckEmpty(txtAgentLandFee, "EMPTY_AGENT_LAND_FEE") ||
                !ClientUtils.CheckEmpty(txtAgentSeaFee, "EMPTY_AGENT_SEA_FEE"))
            {
                return;
            }
            int      guideID = selectedGuide == null ? 0 : selectedGuide.GuideID;
            GuideDto param   = new GuideDto
            {
                GuideID      = guideID,
                GuideName    = txtGuideName.Text,
                Tel          = txtTel.Text,
                Contact      = txtContact.Text,
                LandFee      = Convert.ToSingle(txtLandFee.Text),
                AgentLandFee = Convert.ToSingle(txtAgentLandFee.Text),
                SeaFee       = Convert.ToSingle(txtSeaFee.Text),
                AgentSeaFee  = Convert.ToSingle(txtAgentSeaFee.Text),
                Remark       = txtRemark.Text,
                SupplierID   = supplierID
            };
            string    strResult = WebCall.PostMethod <GuideDto>(isModify ? WebCall.ModifyGuides: WebCall.AddGuides, param);
            WebResult result    = AppUtils.JsonDeserialize <WebResult>(strResult);

            if (result.Code.Equals(SystemConst.MSG_SUCCESS))
            {
                ClientUtils.WarningCode(Travel.Client.Lang.LangBase.GetString(isModify ? "MODIFY_SUCCESS" : "ADD_SUCCESS") + result.Message);
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            else
            {
                ClientUtils.WarningCode(result.Message);
            }
        }
Esempio n. 10
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            LoginPara para = new LoginPara()
            {
                Username = txtUser.Text,
                Password = AppUtils.SHA1Hash(txtPwd.Text)
            };
            string      str_result = WebCall.PostMethod <LoginPara>(WebCall.Login, para);
            LoginResult result     = AppUtils.JsonDeserialize <LoginResult>(str_result);

            if (result.Code.Equals(SystemConst.MSG_SUCCESS))
            {
                Configure.UserID    = result.Data.UserID;
                Configure.UserName  = result.Data.UserName;
                Configure.Functions = result.Data.Functions;
                isLogined           = true;
                this.Close();
            }
            else
            {
                MessageBox.Show(LangBase.GetString(result.Message));
            }
        }