示例#1
0
 private void btnOutDepartment_Click(object sender, EventArgs e)
 {
     if (!checkAddOutDepartment())
     {
         return;
     }
     try
     {
         tmpoutdepartmentsBindingSource.AddNew();
         tmp_out_department newitem = (tmp_out_department)tmpoutdepartmentsBindingSource.Current;
         newitem.description = txtDescription.Text.Trim();
         newitem.location    = DDLocation.Text;
         try
         {
             newitem.start_date = Convert.ToDateTime(txtTime.Text.Trim());
         }
         catch (Exception)
         {
             newitem.start_date = null;
             return;
         }
         txtDescription.Text      = "";
         DDLocation.SelectedIndex = -1;
         txtTime.Text             = "";
     }
     catch (Exception ex)
     {
         Program.MessageError(this.Name, "btnOutDeportment_Click", ex, false);
         throw;
     }
 }
示例#2
0
        private void frmPreRegister_Load(object sender, EventArgs e)
        {
            this.Text           = "Pre Register";
            lbDataFullName.Text = FullName;
            lbDataHN.Text       = HNno;
            frmBGScreen frmbg = new frmBGScreen();

            frmbg.Show();
            Application.DoEvents();

            LoadData();

            Application.DoEvents();
            try
            {
                DateTime datenow = Program.GetServerDateTime();

                var objlocation = (from t1 in dbc.mst_locations
                                   where datenow.Date >= t1.mlc_effective_date.Value.Date &&
                                   (t1.mlc_expire_date == null || (t1.mlc_expire_date != null && datenow.Date <= t1.mlc_expire_date.Value.Date))
                                   select new LocationRegis {
                    strlocation = t1.mlc_ename
                }).ToList();
                LocationRegis newselect = new LocationRegis();
                newselect.strlocation = "- Select -";
                objlocation.Insert(0, newselect);
                DDLocation.DataSource    = objlocation;
                DDLocation.DisplayMember = "strlocation";
                DDLocation.ValueMember   = "strlocation";
                if (isAddnew == true)
                {
                    using (Service.WS_TrakcareCls ws = new Service.WS_TrakcareCls())
                    {
                        string SiteCode = Program.CurrentSite.mhs_code;

                        //LoadOutDepart
                        DataTable dtOutDepart = ws.getApptByHN(HNno, SiteCode, datenow.ToString("yyyy-MM-dd"));
                        foreach (DataRow droutDepart in dtOutDepart.Rows)
                        {
                            tmp_out_department newitem = (tmp_out_department)tmpoutdepartmentsBindingSource.AddNew();
                            newitem.description = droutDepart["SER_Desc"].ToString();
                            newitem.location    = droutDepart["CTLOC_Desc"].ToString();

                            try
                            {
                                DateTime dtdata       = Convert.ToDateTime(droutDepart["AS_Date"].ToString());
                                TimeSpan tarrivaltime = TimeSpan.Parse(droutDepart["AS_SessStartTime"].ToString().Replace("PT", "").Replace("H", ":").Replace("M", ""));
                                newitem.start_date = new DateTime(dtdata.Year, dtdata.Month, dtdata.Day, tarrivaltime.Hours, tarrivaltime.Minutes, 0);
                            }
                            catch (Exception)
                            {
                                newitem.start_date = null;
                                return;
                            }
                        }
                    }
                }
                GenRowNoDridoutDepartment();
                //this.GetPackageTakecare(Program.Tmp_GetPtarrived.paadm_rowid);// Load Pacakge
            }
            catch (Exception ex)
            {
                Program.MessageError(this.Name, "frmPreRegister_Load", ex, false);
                //throw;
            }

            //ไม่Default Aviation Type
            RDAviationCategoryNewcase.Enabled = false;
            RDaviationTypeFollowup.Enabled    = false;
            RDAviationCategoryNewcase.Checked = false;
            RDaviationTypeFollowup.Checked    = false;
            CBAviationCategory.Enabled        = false;
            // Other
            GridOtherAddress.AutoGenerateColumns = false;
            panel2.Enabled = true;
            GC.Collect();

            frmbg.Close();
        }