Example #1
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;
                }
            }
        }
Example #2
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;
             }
         }
     }
 }