示例#1
0
        internal static int UpdatePublicHoliday()
        {
            n = 0;
            try
            {
                daPublicHoliday = new TblPublicHolidayTableAdapter();
                dtPublicHoliday = new DsLiveOutlook.TblPublicHolidayDataTable();
                daPublicHoliday.FillByID(dtPublicHoliday, PublicHolidayInfo.Day, PublicHolidayInfo.Month);

                drwPublicHoliday = dtPublicHoliday[0];

                drwPublicHoliday.BeginEdit();

                drwPublicHoliday.Day   = PublicHolidayInfo.NewDay;
                drwPublicHoliday.Month = PublicHolidayInfo.NewMonth;

                drwPublicHoliday.EndEdit();

                n = daPublicHoliday.Update(dtPublicHoliday);

                return(n);
            }
            catch (Exception ex)
            {
                Interactive.LInfoError(ex.Message, "Record was not saved !");
                return(n);
            }
        }
示例#2
0
 private void LiveSaveInfo()
 {
     if (LiveFormIsValid())
     {
         myR             = new RoleInfo();
         myR.RoleID      = txtRoleID.Text.Trim();
         myR.Description = txtDescription.Text.Trim();
         if (EditFlag)
         {
             myR.RoleID    = lblID.Text.Trim();
             myR.NewRoleID = txtRoleID.Text.Trim();
             if ((Interactive.LInfoConfirm("Are you sure you want to Edit ?", "") == DialogResult.Yes))
             {
                 if (myR.Edit())
                 {
                     Interactive.LInfo("Information saved successfully", "");
                     LiveLoad();
                 }
             }
         }
         else
         {
             if (myR.Add())
             {
                 Interactive.LInfo("Information saved successfully", "");
                 LiveLoad();
             }
         }
     }
     else
     {
         Interactive.LInfoError(err, string.Empty);
     }
 }
示例#3
0
        internal static int AddPublicHoliday()
        {
            n = 0;
            try
            {
                daPublicHoliday = new TblPublicHolidayTableAdapter();
                dtPublicHoliday = new DsLiveOutlook.TblPublicHolidayDataTable();

                drwPublicHoliday = dtPublicHoliday.NewTblPublicHolidayRow();

                drwPublicHoliday.Day   = PublicHolidayInfo.Day;
                drwPublicHoliday.Month = PublicHolidayInfo.Month;

                dtPublicHoliday.AddTblPublicHolidayRow(drwPublicHoliday);

                n = daPublicHoliday.Update(dtPublicHoliday);

                return(n);
            }
            catch (Exception ex)
            {
                Interactive.LInfoError(ex.Message, "Record was not saved !");
                return(n);
            }
        }
示例#4
0
        internal static int UpdateReserve()
        {
            n = 0;
            try
            {
                daReserve = new TblReserveTableAdapter();
                dtReserve = new DsLiveOutlook.TblReserveDataTable();
                daReserve.FillByID(dtReserve, ReserveInfo.Day, ReserveInfo.Month, ReserveInfo.Year);

                drwReserve = dtReserve[0];

                drwReserve.BeginEdit();

                drwReserve.Day             = ReserveInfo.NewDay;
                drwReserve.Month           = ReserveInfo.NewMonth;
                drwReserve.Year            = ReserveInfo.NewYear;
                drwReserve.MaxAppointments = ReserveInfo.MaxAppointments;

                drwReserve.EndEdit();

                n = daReserve.Update(dtReserve);

                return(n);
            }
            catch (Exception ex)
            {
                Interactive.LInfoError(ex.Message, "Record was not saved !");
                return(n);
            }
        }
示例#5
0
        internal static int AddReserve()
        {
            n = 0;
            try
            {
                daReserve = new TblReserveTableAdapter();
                dtReserve = new DsLiveOutlook.TblReserveDataTable();

                drwReserve = dtReserve.NewTblReserveRow();

                drwReserve.Day             = ReserveInfo.Day;
                drwReserve.Month           = ReserveInfo.Month;
                drwReserve.Year            = ReserveInfo.Year;
                drwReserve.MaxAppointments = ReserveInfo.MaxAppointments;

                dtReserve.AddTblReserveRow(drwReserve);

                n = daReserve.Update(dtReserve);

                return(n);
            }
            catch (Exception ex)
            {
                Interactive.LInfoError(ex.Message, "Record was not saved !");
                return(n);
            }
        }
示例#6
0
        internal static int AddFacility()
        {
            n = 0;
            try
            {
                daFacility = new  TblFacilityTableAdapter();
                dtFacility = new DsLiveOutlook.TblFacilityDataTable();

                drwFacility = dtFacility.NewTblFacilityRow();

                drwFacility.Fcode    = FacilityInfo.FCode.Trim().ToUpper();
                drwFacility.Facility = FacilityInfo.FName.Trim().ToUpper();

                dtFacility.AddTblFacilityRow(drwFacility);

                n = daFacility.Update(dtFacility);

                return(n);
            }
            catch (Exception ex)
            {
                Interactive.LInfoError(ex.Message, "Record was not saved !");
                return(n);
            }
        }
示例#7
0
        internal static int UpdateSettings()
        {
            n = 0;
            try
            {
                daSettings = new TblSettingsTableAdapter();
                dtSettings = new DsLiveOutlook.TblSettingsDataTable();
                daSettings.FillByID(dtSettings, SettingsInfo.ADay);

                drwSettings = dtSettings[0];

                drwSettings.BeginEdit();

                drwSettings.MaxAppointments = SettingsInfo.MaxAppointments;

                drwSettings.EndEdit();

                n = daSettings.Update(dtSettings);

                return(n);
            }
            catch (Exception ex)
            {
                Interactive.LInfoError(ex.Message, "Record was not saved !");
                return(n);
            }
        }
示例#8
0
        internal static int UpdateFacility()
        {
            n = 0;
            try
            {
                daFacility = new TblFacilityTableAdapter();
                dtFacility = new DsLiveOutlook.TblFacilityDataTable();
                daFacility.FillByID(dtFacility, FacilityInfo.FCode);

                drwFacility = dtFacility[0];

                drwFacility.BeginEdit();


                drwFacility.Fcode    = FacilityInfo.NewFCode.Trim().ToUpper();
                drwFacility.Facility = FacilityInfo.FName.Trim().ToUpper();

                drwFacility.EndEdit();

                n = daFacility.Update(dtFacility);

                return(n);
            }
            catch (Exception ex)
            {
                Interactive.LInfoError(ex.Message, "Record was not saved !");
                return(n);
            }
        }
示例#9
0
 public static void BackupData()
 {
     Interactive.STATUS = "Backing up Data... ";
     bw.ReportProgress(9);
     try
     {
         string     x   = DateTime.Now.ToString("ddMMMyyy-HHmmss").ToUpper();
         string     bak = DirBak + x;
         SqlCommand cmd;
         string     strBAK = "BACKUP DATABASE " + DbName + " TO Disk='" + bak + DbName + ".bak'";
         Temp = new SqlConnection();
         Temp.ConnectionString = Settings.Default.dbMasterConnectionString;
         if (Temp.State == ConnectionState.Closed)
         {
             Temp.Open();
         }
         cmd = new SqlCommand(strBAK, Temp);
         cmd.ExecuteNonQuery();
         bw.ReportProgress(11);
     }
     catch (Exception ex)
     {
         Interactive.LInfoError("Could not Back up data\n" + ex.Message, "Application Failure");
         //Application.Exit();
     }
     finally
     {
         Temp.Dispose();
     }
     bw.ReportProgress(12);
 }
示例#10
0
        private void LiveSaveInfo()
        {
            if (LiveFormIsValid())
            {
                myU          = new UserInfo();
                myU.UserID   = UserInfo.LiveUserID;
                myU.Password = txtOldPassword.Text.Trim();

                if (myU.IsLoginUser())
                {
                    myU.Password = txtConfirmPassword.Text.Trim();
                    if (myU.EditPassword())
                    {
                        Interactive.LInfo("Your password has been changed", "Change password");
                        LiveClearControls();
                        this.Close();
                    }
                }
                else
                {
                    Interactive.LInfoError("Old password is wrong", "Change password");
                    txtOldPassword.SelectAll();
                }
            }
            else
            {
                Interactive.LInfoError(err, string.Empty);
            }
        }
示例#11
0
        public void TestConnection(bool interactive)
        {
            try
            {
                Temp = new SqlConnection();
                Temp.ConnectionString = Settings.Default.dbOutlookConnectionString;


                if (Temp.State == ConnectionState.Closed)
                {
                    Temp.Open();
                }

                if (Temp.State == ConnectionState.Open)
                {
                    Temp.Close();
                }
                bw.ReportProgress(9);
            }
            catch (Exception ex)
            {
                Interactive.LInfoError("Database connection failed\n" + ex, "Application Fail");
                Application.Exit();
            }
            finally
            {
                Temp.Dispose();
            }
        }
示例#12
0
        internal static int UpdateClassification()
        {
            n = 0;
            try
            {
                daClassification = new TblClassificationTableAdapter();
                dtClassification = new DsLiveOutlook.TblClassificationDataTable();
                daClassification.FillByID(dtClassification, ClassificationInfo.ID, ClassificationInfo.AClass);

                drwClassification = dtClassification[0];

                drwClassification.BeginEdit();

                drwClassification.ID      = ClassificationInfo.NewID.Trim();
                drwClassification.Display = ClassificationInfo.Display.Trim();
                drwClassification.Value   = ClassificationInfo.Value;

                drwClassification.EndEdit();
                n = daClassification.Update(dtClassification);
                return(n);
            }
            catch (Exception ex)
            {
                Interactive.LInfoError(ex.Message, "Record was not saved !");
                return(n);
            }
        }
示例#13
0
        internal static int AddClassification()
        {
            n = 0;
            try
            {
                daClassification = new TblClassificationTableAdapter();
                dtClassification = new DsLiveOutlook.TblClassificationDataTable();

                drwClassification = dtClassification.NewTblClassificationRow();

                drwClassification.ID      = ClassificationInfo.ID.Trim();
                drwClassification.Class   = ClassificationInfo.AClass.Trim();
                drwClassification.Display = ClassificationInfo.Display.Trim();
                drwClassification.Value   = ClassificationInfo.Value;

                dtClassification.AddTblClassificationRow(drwClassification);

                n = daClassification.Update(dtClassification);

                return(n);
            }
            catch (Exception ex)
            {
                Interactive.LInfoError(ex.Message, "Record was not saved !");
                return(n);
            }
        }
示例#14
0
        internal static int AddAppointment()
        {
            n = 0;
            try
            {
                daAppointment = new TblAppointmentTableAdapter();
                dtAppointment = new DsLiveOutlook.TblAppointmentDataTable();

                drwAppointment = dtAppointment.NewTblAppointmentRow();

                drwAppointment.RegNo       = AppointmentInfo.RegNo.Trim();
                drwAppointment.Appointment = AppointmentInfo.Appointment;


                drwAppointment.Period      = AppointmentInfo.Period;
                drwAppointment.PeriodName  = AppointmentInfo.PeriodName;
                drwAppointment.SeenBy      = AppointmentInfo.SeenBy.Trim().ToUpper();
                drwAppointment.VisitDate   = AppointmentInfo.VisitDate;
                drwAppointment.VisitStatus = AppointmentInfo.VisitStatus;
                drwAppointment.AStatus     = AppointmentInfo.AStatus;

                dtAppointment.AddTblAppointmentRow(drwAppointment);

                n = daAppointment.Update(dtAppointment);
                daAppointment.UpdateDates();

                return(n);
            }
            catch (Exception ex)
            {
                Interactive.LInfoError(ex.Message, "Record was not saved !");
                return(n);
            }
        }
示例#15
0
 internal void UpdateStatus(UserInfo r)
 {
     try
     {
         da = new tblUserTableAdapter();
         da.UpdateOnlineStatus(r.Online, r.UserID);
     }
     catch (Exception ex)
     {
         Interactive.LInfoError(ex.Message, "Update Record");
     }
 }
示例#16
0
 internal int Delete(LivelogInfo r)
 {
     try
     {
         da = new tblLivelogTableAdapter();
         n  = da.Delete(r.LogID);
     }
     catch (Exception ex)
     {
         Interactive.LInfoError(ex.Message, "Insert Record");
     }
     return(n);
 }
示例#17
0
 public string GetVersion()
 {
     try
     {
         daLive = new TblLiveTableAdapter();
         strVer = daLive.GetVersion(LiveStart.LiveProduct).ToString();
     }
     catch (Exception ex)
     {
         Interactive.LInfoError("Could not Get version\n" + ex.Message, "Application Failure");
     }
     return(strVer);
 }
示例#18
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (gbPass.Enabled)
     {
         int cmp = string.Compare(txtPass.Text.Trim(), txtConfirmPass.Text.Trim());
         if (cmp != 0)
         {
             Interactive.LInfoError("Passwords do not match", "Users");
             return;
         }
     }
     LiveSaveInfo();
 }
示例#19
0
 internal int Update(LivelogInfo r)
 {
     try
     {
         da = new tblLivelogTableAdapter();
         n  = da.Update(r.LogDate, r.RecordUID, r.TableName, r.UserID, r.Action, r.SystemUser, r.Computer, r.LogID);
     }
     catch (Exception ex)
     {
         Interactive.LInfoError(ex.Message, "Insert Record");
     }
     return(n);
 }
示例#20
0
        private void SaveInfo()
        {
            if (FormIsValid())
            {
                myE = new EnrollmentInfo();
                EnrollmentInfo.RegNo     = txtRegNo.Text;
                EnrollmentInfo.Names     = txtName.Text;
                EnrollmentInfo.Age       = Convert.ToInt32(txtAge.Value);
                EnrollmentInfo.AgeUnit   = rbYr.Checked ? "Y" : "m";
                EnrollmentInfo.Sex       = rbM.Checked ? "M" : "F";
                EnrollmentInfo.RegDate   = dtpRegDate.Value;
                EnrollmentInfo.Residence = txtResidence.Text;

                try { EnrollmentInfo.ReferredBy = cmbReferredBy.SelectedValue.ToString(); }
                catch { };
                try { EnrollmentInfo.ReferredTo = cmbReferredTo.SelectedValue.ToString(); }
                catch { };

                EnrollmentInfo.Fcode = strFcode;

                try { EnrollmentInfo.Category = cmbCategory.SelectedValue.ToString(); }
                catch { };
                EnrollmentInfo.ContactInfo = txtContact.Text;
                try { EnrollmentInfo.Outcome = cmbOutcome.SelectedValue.ToString(); }
                catch { };
                if (EditFlag)
                {
                    EnrollmentInfo.RegNo    = lblRegNo.Text;
                    EnrollmentInfo.NewRegNo = txtRegNo.Text;
                    if ((Interactive.LInfoConfirm("Are you sure you want to Edit ?", "Enrollment") == DialogResult.Yes))
                    {
                        if (myE.EditEnrollment())
                        {
                            Load500Enrollments();
                        }
                    }
                }
                else
                {
                    if (myE.NewEnrollment())
                    {
                        Load500Enrollments();
                    }
                }
            }
            else
            {
                Interactive.LInfoError(err, "Enrollment");
            }
        }
示例#21
0
 internal int UpdatePassword(UserInfo r)
 {
     try
     {
         da = new tblUserTableAdapter();
         n  = da.UpdatePassword(r.Password, r.UserID);
         LivelogInfo.InsertLog(DateTime.Now, UserInfo.LiveUserID, "Users", UserInfo.LiveUserID, "changed password", UserInfo.SysUserID, UserInfo.Computer);
     }
     catch (Exception ex)
     {
         Interactive.LInfoError(ex.Message, "Insert Record");
     }
     return(n);
 }
示例#22
0
 internal int OnlineUserCount()
 {
     n = 0;
     try
     {
         da = new tblUserTableAdapter();
         n  = Convert.ToInt32(da.UsersOnline());
     }
     catch (Exception ex)
     {
         Interactive.LInfoError(ex.Message, "Check User");
     }
     return(n);
 }
示例#23
0
 internal DsSecurity.tblUserDataTable ViewAllByID(string uid)
 {
     try
     {
         da = new tblUserTableAdapter();
         dt = new DsSecurity.tblUserDataTable();
         da.FillByUserID(dt, uid);
     }
     catch (Exception ex)
     {
         Interactive.LInfoError(ex.Message, "View Record");
     }
     return(dt);
 }
示例#24
0
 internal static int Capacity()
 {
     n = 0;
     try
     {
         daAppointment = new TblAppointmentTableAdapter();
         n             = Convert.ToInt32(daAppointment.GetNoOfAppointments(Convert.ToDateTime(AppointmentInfo.Appointment.ToString("yyyy/MM/dd"))));
     }
     catch (Exception ex)
     {
         Interactive.LInfoError("Could not load Appointment Information\n" + ex.Message, "Database connection failure");
     }
     return(n + 1);
 }
示例#25
0
 internal int Insert(UserInfo r)
 {
     try
     {
         da = new tblUserTableAdapter();
         n  = da.Insert(r.UserID, r.Password, r.IsActive, r.RoleID, r.FullName);
         LivelogInfo.InsertLog(DateTime.Now, r.UserID, "User", UserInfo.LiveUserID, "added new record", UserInfo.SysUserID, UserInfo.Computer);
     }
     catch (Exception ex)
     {
         Interactive.LInfoError(ex.Message, "Insert Record");
     }
     return(n);
 }
示例#26
0
 internal DsSecurity.tblRoleDataTable ViewAll()
 {
     try
     {
         da = new tblRoleTableAdapter();
         dt = new DsSecurity.tblRoleDataTable();
         da.Fill(dt);
     }
     catch (Exception ex)
     {
         Interactive.LInfoError(ex.Message, "View Record");
     }
     return(dt);
 }
示例#27
0
 internal int Delete(RoleInfo r)
 {
     try
     {
         da = new tblRoleTableAdapter();
         n  = da.Delete(r.RoleID);
         LivelogInfo.InsertLog(DateTime.Now, r.RoleID, "Role", UserInfo.LiveUserID, "deleted record", UserInfo.SysUserID, UserInfo.Computer);
     }
     catch (Exception ex)
     {
         Interactive.LInfoError(ex.Message, "Insert Record");
     }
     return(n);
 }
示例#28
0
 internal static int DeleteFacility()
 {
     n = 0;
     try
     {
         daFacility = new TblFacilityTableAdapter();
         n          = daFacility.Delete1(FacilityInfo.FCode);
         return(n);
     }
     catch (Exception ex)
     {
         Interactive.LInfoError(ex.Message, "Record was not Deleted!");
         return(n);
     }
 }
示例#29
0
 internal static int DeleteReserve()
 {
     n = 0;
     try
     {
         daReserve = new TblReserveTableAdapter();
         n         = daReserve.Delete1(ReserveInfo.Day, ReserveInfo.Month, ReserveInfo.Year);
         return(n);
     }
     catch (Exception ex)
     {
         Interactive.LInfoError(ex.Message, "Record was not Deleted!");
         return(n);
     }
 }
示例#30
0
 internal static int DeletePublicHoliday()
 {
     n = 0;
     try
     {
         daPublicHoliday = new TblPublicHolidayTableAdapter();
         n = daPublicHoliday.Delete1(PublicHolidayInfo.Day, PublicHolidayInfo.Month);
         return(n);
     }
     catch (Exception ex)
     {
         Interactive.LInfoError(ex.Message, "Record was not Deleted!");
         return(n);
     }
 }