예제 #1
0
        public officeDB.OfficerRow Load(string userName)
        {
            if (myA.AtMng.AppMan.UseService)
            {
                Fill(myA.AtMng.AppMan.AtriumX().OfficerLoadByUserName(userName, myA.AtMng.AppMan.AtriumXCon));
            }
            else
            {
                try
                {
                    Fill(myDAL.LoadByUserName(userName));
                }
                catch (System.Runtime.Serialization.SerializationException x)
                {
                    RecoverDAL();
                    Fill(myDAL.LoadByUserName(userName));
                }
            }

            officeDB.OfficerRow[] ors = (officeDB.OfficerRow[]) this.myOfficerDT.Select("UserName='******'", "''") + "'");
            if (ors.Length == 1)
            {
                SetLocalDates();
                officeDB.OfficerRow or = ors[0];
                return(or);
            }
            else
            {
                throw new AtriumException(atriumBE.Properties.Resources.BadUserName);
            }
        }
예제 #2
0
        protected override void BeforeUpdate(DataRow ddr)
        {
            officeDB.OfficerRow dr = (officeDB.OfficerRow)ddr;
            //if(!dr.IsCreateAccountNull() && dr.CreateAccount)
            //{
            //    myA.AtMng.SecurityManager.GetsecUser();
            //    myA.AtMng.SecurityManager.GetsecMembership();

            //    SecurityDB.secUserRow sur = myA.AtMng.SecurityManager.DB.secUser.NewsecUserRow();
            //    myA.AtMng.SecurityManager.DB.secUser.AddsecUserRow(sur);

            //    sur.BeginEdit();
            //    sur.UserId=dr.OfficerId;
            //    //if(dr.OfficeRow.OfficeTypeCode=="HQ" ||dr.OfficeRow.OfficeTypeCode=="C")
            //    //    sur.UserName=dr.OfficeRow.OfficeCode+@"\"+dr.LastName.Replace(" ","")+"."+dr.FirstName.Substring(0,1);
            //    //else
            //    //    sur.UserName=dr.OfficeRow.OfficeCode+@"\"+dr.LastName.Replace(" ","")+"."+dr.FirstName.Substring(0,1);
            //    sur.UserName = dr.UserName;
            //    sur.Active = true;
            //    sur.LockedOut=false;
            //    //sur.Password="******";
            //    sur.EndEdit();


            //    dr.BeginEdit();
            //    dr.CreateAccount=false;
            //    dr.EndEdit();


            //}
        }
예제 #3
0
        protected override void BeforeUpdate(DataRow dr)
        {
            BeforeChange("Subject", dr);

            atriumDB.AppointmentRow apptRow = (atriumDB.AppointmentRow)dr;

            if (!apptRow.IsIntervalNull())
            {
                officeDB.OfficerRow workingas = myA.AtMng.WorkingAsOfficer;
                foreach (atriumDB.AttendeeRow att in apptRow.GetAttendeeRows())
                {
                    if (att.ContactId == workingas.OfficerId || att.RowState == DataRowState.Added)
                    {
                        att.Interval            = apptRow.Interval;
                        att.NotificationDismiss = false;
                    }
                }
            }

            //if (!apptRow.IsApptRecurrenceIdNull() && apptRow.OriginalRecurrence == true)
            //{
            //    apptRow.ApptRecurrenceRow.updateDate = DateTime.Now;
            //}
            if (!apptRow.IsApptRecurrenceIdNull())
            {
                if (apptRow.ApptRecurrenceRow.RecurrenceRemoved)
                {
                    apptRow.ApptRecurrenceRow.Delete();
                    apptRow.SetApptRecurrenceIdNull();
                    myA.DB.ApptRecurrence.AcceptChanges();
                }
            }
        }
예제 #4
0
        private void officerBindingSource_CurrentChanged(object sender, EventArgs e)
        {
            try
            {
                officeDB.OfficerRow dr = CurrentRow();

                if (dr == null)
                {
                    return;
                }

                if (dr.IsNull("OfficerId"))
                {
                    return;
                }


                if (!myLoadedOfficers.Contains(dr.OfficerId))
                {
                    myLoadedOfficers.Add(dr.OfficerId);
                    //load emails and delegates
                    FM.LeadOfficeMng.GetOfficerDelegate().LoadByOfficerId(dr.OfficerId);

                    FM.LeadOfficeMng.GetMemberProfile().Load(dr.OfficerId);

                    //load roles
                    FM.LeadOfficeMng.GetOfficerRole().LoadByOfficerID(dr.OfficerId);
                    FM.LeadOfficeMng.GetContactEmail().LoadByContactId(dr.OfficerId);
                }

                if ((dr.IsNull("PositionCode")) || (dr.PositionCode != "TM"))
                {
                    tribunalTabPage.Enabled = false;
                }
                else
                {
                    displayMemberProfile();
                }

                if (!dr.IsActiveNull())
                {
                    pnlDelegateRole.Enabled  = true;
                    pnlPersonalFiles.Enabled = true;
                    tsMyFile.Enabled         = Janus.Windows.UI.InheritableBoolean.True;
                }
                else
                {
                    pnlDelegateRole.Enabled  = false;
                    pnlPersonalFiles.Enabled = false;
                    tsMyFile.Enabled         = Janus.Windows.UI.InheritableBoolean.False;
                }

                ApplySecurity(dr);
            }
            catch (Exception x)
            {
                UIHelper.HandleUIException(x);
            }
        }
예제 #5
0
 public ucOfficerToolkit(officeDB.OfficerRow or, atriumManager atmng, fMain mainform)
 {
     InitializeComponent();
     SetAtmng(atmng, mainform);
     CreateNodes();
     setOfficer(or);
     ucFileContextMenu1.LoadLabels();
     LoadContextMenuLabels();
 }
예제 #6
0
 public fPreferences(atriumManager Atmng)
 {
     InitializeComponent();
     myAtmng = Atmng;
     LoadLabels();
     prefBE     = myAtmng.OfficeMng.GetOfficerPrefs();
     officerRow = myAtmng.OfficeMng.GetOfficer().Load(myAtmng.OfficerLoggedOn.OfficerId);
     CheckPrefs();
 }
예제 #7
0
        protected override void AfterChange(DataColumn dc, DataRow row)
        {
            officeDB.OfficerRow dr = (officeDB.OfficerRow)row;

            switch (dc.ColumnName)
            {
            case "OutOfOfficeStartDateLocal":
                if (!dr.IsOutOfOfficeStartDateLocalNull())
                {
                    if (dr.OutOfOfficeStartDateLocal > dr.OutOfOfficeEndDateLocal)
                    {
                        dr.OutOfOfficeEndDateLocal = dr.OutOfOfficeStartDateLocal;
                        dr.OutOfOfficeEndDateLocal = dr.OutOfOfficeEndDateLocal.AddMinutes(15);
                        dr.OutOfOfficeEndDate      = dr.OutOfOfficeEndDateLocal.ToUniversalTime();
                    }
                    dr.OutOfOfficeStartDate = dr.OutOfOfficeStartDateLocal.ToUniversalTime();
                    dr.EndEdit();
                }
                break;

            case "OutOfOfficeEndDateLocal":
                if (!dr.IsOutOfOfficeEndDateLocalNull())
                {
                    if (dr.OutOfOfficeStartDateLocal > dr.OutOfOfficeEndDateLocal)
                    {
                        dr.OutOfOfficeStartDateLocal = dr.OutOfOfficeEndDateLocal;
                        dr.OutOfOfficeEndDateLocal   = dr.OutOfOfficeEndDateLocal.AddMinutes(15);
                        dr.OutOfOfficeStartDate      = dr.OutOfOfficeStartDateLocal.ToUniversalTime();
                    }
                    dr.OutOfOfficeEndDate = dr.OutOfOfficeEndDateLocal.ToUniversalTime();
                    dr.EndEdit();
                }
                break;

            case "OutOfOffice":
                if (dr.IsOutOfOfficeNull() || !dr.OutOfOffice)
                {
                    dr.SetOutOfOfficeStartDateNull();
                    dr.SetOutOfOfficeStartDateLocalNull();
                    dr.SetOutEndEngNull();
                    dr.SetOutEndFreNull();
                    dr.SetOutOfOfficeEndDateNull();
                    dr.SetOutOfOfficeEndDateLocalNull();
                    dr.EndEdit();
                }
                else
                {
                    dr.OutOfOfficeStartDateLocal = DateTime.Today.AddHours(DateTime.Now.Hour);
                    dr.OutOfOfficeEndDateLocal   = dr.OutOfOfficeStartDateLocal.AddDays(1);
                    dr.OutOfOfficeEndDate        = dr.OutOfOfficeEndDateLocal.ToUniversalTime();
                    dr.OutOfOfficeStartDate      = dr.OutOfOfficeStartDateLocal.ToUniversalTime();
                    dr.EndEdit();
                }
                break;
            }
        }
예제 #8
0
 public void Resolve(officeDB.OfficerRow or, docDB.RecipientRow newR)
 {
     if (!or.IsEmailAddressNull())
     {
         newR.Address = or.EmailAddress;  //addresstype will default to SMTP so that shouldbe the primary email type for all users
     }
     newR.OfficeId  = or.OfficeId;
     newR.OfficerId = or.OfficerId;
     newR.Name      = or.LastName + ", " + or.FirstName + " (" + or.OfficerCode + ")";
 }
예제 #9
0
        protected override void AfterChange(DataColumn dc, DataRow dr)
        {
            docDB.RecipientRow row = (docDB.RecipientRow)dr;
            switch (dc.ColumnName)
            {
            case "OfficerId":
                //get officer record and set officeid,name,email
                officeDB.OfficerRow or = myA.AtMng.OfficeMng.DB.Officer.FindByOfficerId(row.OfficerId);
                if (or == null)
                {
                    or = myA.AtMng.OfficeMng.GetOfficer().Load(row.OfficerId);
                }

                if (or != null)
                {
                    DoNotResolve = true;
                    row.OfficeId = or.OfficeId;
                    row.Name     = or.LastName + ", " + or.FirstName + " (" + or.OfficerCode + ")";

                    row.Address = or.EmailAddress;
                    row.EndEdit();
                    DoNotResolve = false;
                }
                else
                {
                    atriumDB.ContactRow cr = myA.FM.GetPerson().Load(row.OfficerId);
                    if (cr != null)
                    {
                        DoNotResolve = true;
                        //     row.SetOfficerIdNull();
                        Resolve(cr, row);
                        DoNotResolve = false;
                    }
                }
                break;

            case "Address":
                //get officer record and set officeid,name,email
                if (row.IsAddressNull())
                {
                    row.Delete();
                }
                else
                {
                    if (!DoNotResolve)
                    {
                        Resolve(row.Address, row.Address, row, false);
                    }
                    row.EndEdit();
                }
                break;
            }
        }
예제 #10
0
        private DataRow AddX(officeDB.OfficerRow cr)
        {
            atriumDB.AddressRow dr = (atriumDB.AddressRow)base.Add(cr);

            dr.ContactId = cr.OfficerId;
            if (cr.IsAddressCurrentIDNull())
            {
                cr.AddressCurrentID = dr.AddressId;
            }

            return(dr);
        }
예제 #11
0
        public override bool CanDelete(DataRow dr)
        {
            bool ok = false;

            officeDB.OfficerRow fo = (officeDB.OfficerRow)dr;
            atSecurity.SecurityManager.LevelPermissions perm = myA.AtMng.SecurityManager.CanDelete(fo.OfficeRow.OfficeFileId, atSecurity.SecurityManager.Features.Officer);
            if (perm != atSecurity.SecurityManager.LevelPermissions.No)
            {
                ok = true;
            }

            return(ok);
        }
예제 #12
0
        public officeDB.OfficerRow FindLoad(int OfficerId)
        {
            officeDB.OfficerRow orr = myOfficerDT.FindByOfficerId(OfficerId);
            if (orr == null)
            {
                orr = Load(OfficerId);
                if (orr != null && !orr.IsOutOfOfficeEndDateNull() && orr.IsOutEndEngNull())
                {
                    orr.OutEndEng = orr.OutOfOfficeEndDate.ToString("MMMM d, yyyy h:mm tt", new System.Globalization.CultureInfo("en-US"));
                    orr.OutEndFre = orr.OutOfOfficeEndDate.ToString("d MMMM yyyy H:mm", new System.Globalization.CultureInfo("fr-CA"));
                    orr.AcceptChanges();
                }
            }

            return(orr);
        }
예제 #13
0
        protected override void AfterAdd(DataRow row)
        {
            base.AfterAdd(row);
            officeDB.OfficerRow dr = (officeDB.OfficerRow)row;
            string ObjectName      = this.myOfficerDT.TableName;

            dr.OfficerId       = dr.ContactId;// this.myA.AtMng.PKIDGet(ObjectName,1);
            dr.CreateAccount   = false;
            dr.CurrentEmployee = true;
            dr.IsMail          = true;
            dr.UsesBilling     = dr.OfficeRow.UsesBilling;
            dr.ContactClass    = "O";
            dr.OutOfOffice     = false;

            myA.AtMng.ClearCodesCache();
        }
예제 #14
0
        public officeDB.OfficerRow AddFromContact(atriumDB.ContactRow contactR, officeDB.OfficeRow officeR)
        {
            officeDB.OfficerRow or = (officeDB.OfficerRow)Add(officeR);
            or.ContactId = contactR.ContactId;
            or.OfficerId = or.ContactId;
            or.OfficeId  = officeR.OfficeId;

            foreach (DataColumn dc in contactR.Table.Columns)
            {
                if (!contactR.IsNull(dc))
                {
                    or[dc.ColumnName] = contactR[dc];
                }
            }
            return(or);
        }
예제 #15
0
        public void SetDelegateSecurity(officeDB.OfficerDelegateRow odr)
        {
            if (odr.WorkAs)
            {
                officeDB.OfficerRow or = odr.OfficerRowByOfficerWorkAs;
                if (or == null)
                {
                    or = myA.AtMng.GetOfficeForOfficer(odr.DelegateToId).GetOfficer().Load(odr.DelegateToId);
                }
                SecurityDB.secUserRow sur = myA.AtMng.SecurityManager.GetsecUser().GetSecUserForOfficer(or);

                if (!odr.OfficerRow.IsMyFileIdNull())
                {
                    myA.GetOfficer().AddUserFileRule(sur.UserId, myA.AtMng.GetFile(odr.OfficerRow.MyFileId).CurrentFile, (int)atSecurity.SpecialRules.DelegateFileRW);
                }
            }
        }
예제 #16
0
        public override bool CanEdit(DataRow dr)
        {
            bool ok = false;

            officeDB.OfficerRow or = (officeDB.OfficerRow)dr;
            atSecurity.SecurityManager.LevelPermissions perm = myA.AtMng.SecurityManager.CanUpdate(or.OfficeRow.OfficeFileId, atSecurity.SecurityManager.Features.Officer);
            if (perm != atSecurity.SecurityManager.LevelPermissions.No)
            {
                ok = true;
            }
            if (or.OfficerId == myA.AtMng.OfficerLoggedOn.OfficerId)
            {
                ok = true;
            }

            return(ok);
        }
예제 #17
0
 public SecurityDB.secUserRow GetSecUserForOfficer(officeDB.OfficerRow or)
 {
     SecurityDB.secUserRow sur;
     if (!or.IsUserNameNull())
     {
         sur = Load(or.UserName);
         if (sur == null)
         {
             throw new AtriumException("Officer must have an account");
         }
     }
     else
     {
         throw new AtriumException("Officer must have a user name");
     }
     return(sur);
 }
예제 #18
0
        public void CloseActivityTimePeriod(int srpId)
        {
            atriumDB.SRPRow drSrp = this.Load(srpId);
            if (drSrp.IsSRPSubmittedDateNull())
            {
                FileManager         fm = this.myA.AtMng.GetFile(drSrp.FileID);
                officeDB.OfficerRow or = fm.AtMng.OfficeMng.GetOfficer().LoadByMyFileId(fm.CurrentFile.FileId);
                if (or != null)
                {
                    try
                    {
                        //drSrp.BeginEdit();
                        //drSrp.SRPSubmittedDate = DateTime.Today;
                        //drSrp.EndEdit();

                        ////officeDB.SRPRow newSrp = (officeDB.SRPRow)this.Add(fm.CurrentFile);
                        ////newSrp.FileID = fm.CurrentFile.FileId;
                        ////newSrp.entryUser = "******";
                        ////newSrp.SRPDate = drSrp.SRPDate.AddMonths(1);

                        //BusinessProcess bp = myA.GetBP();
                        //bp.AddForUpdate(this);
                        //bp.Update();

                        //TODO: make sure this is part of the transaction
                        //this.myA.AppMan.ExecuteSP("SubmitTimeslip", drSrp.SRPID, or.OfficerId, drSrp.SRPDate, drSrp.SRPDate.AddMonths(1).AddDays(-1), DateTime.Today);

                        atriumDB.SRPDataTable dt = myDAL.SubmitTimeslip(drSrp.SRPID, or.OfficerId, drSrp.SRPDate, drSrp.SRPDate.AddMonths(1).AddDays(-1));
                        Fill(dt);
                        //this.Load(srpId);
                    }
                    catch
                    {
                        throw;
                    }
                }
                else
                {
                    throw new AtriumException("No officer for file");
                }
            }
            else
            {
                throw new AtriumException("Activity Time Period is already closed");
            }
        }
예제 #19
0
        public bool IsInRole(string roleCode, int officerId)
        {
            //use workingas
            //if( myA.AtMng.WorkingAsOfficer.GetOfficerRoleRows().Length==0)
            //    myA.GetOfficerRole().LoadByOfficerID(myA.AtMng.WorkingAsOfficer.OfficerId);

            officeDB.OfficerRow officer = FindLoad(officerId);

            officeDB.OfficerRoleRow[] orrs = officer.GetOfficerRoleRows();
            foreach (officeDB.OfficerRoleRow orr in orrs)
            {
                if (orr.RoleCode == roleCode)
                {
                    return(true);
                }
            }
            return(false);
        }
예제 #20
0
 private void fileContactGridEX_FormattingRow(object sender, Janus.Windows.GridEX.RowLoadEventArgs e)
 {
     try
     {
         if (fileContactGridEX.CurrentRow != null && e.Row.RowType == Janus.Windows.GridEX.RowType.Record && e.Row.Cells["IsLoaded"].Value == null && e.Row.Cells["ContactId"].Value != null && e.Row.Cells["ContactId"].Value.ToString().Length > 0)
         {
             e.Row.BeginEdit();
             if (e.Row.Cells["OfficerCode"].Value.ToString().Length > 0)
             {
                 officeDB.OfficerRow offrow = myfmAB.LeadOfficeMng.GetOfficer().LoadByOfficerCode(e.Row.Cells["OfficerCode"].Value.ToString());
                 if (!offrow.IsActiveNull() && offrow.Active)
                 {
                     e.Row.Cells["icon"].Value = 2; //active user
                 }
                 else
                 {
                     e.Row.Cells["icon"].Value = 1; //officer - non-user
                 }
             }
             else
             {
                 if (myfmAB.GetFileContact().IsADebtor((int)e.Row.Cells["ContactId"].Value))                 // is a debtor
                 {
                     e.Row.Cells["icon"].Value = 3;                                                          //debtor
                 }
                 else if (myfmAB.GetFileContact().FileContactCount((int)e.Row.Cells["ContactId"].Value) > 1) // is a shared plain contact
                 {
                     e.Row.Cells["icon"].Value = 4;                                                          //person, shared
                 }
                 else
                 {
                     e.Row.Cells["icon"].Value = 0; //contact, standalone - not shared
                 }
             }
             e.Row.Cells["IsLoaded"].Value = true;
             e.Row.EndEdit();
         }
     }
     catch (Exception x)
     {
         UIHelper.HandleUIException(x);
     }
 }
예제 #21
0
        public atriumDB.FileContactRow Add(officeDB.OfficerRow or, string contactType)
        {
            //if(myA.DB.FileContact.Rows.Count==0)
            //    LoadByFileId(myA.CurrentFile.FileId);

            if (myA.DB.FileContact.Select("ContactId=" + or.OfficerId.ToString()).Length == 0)
            {
                //add filecontact
                atriumDB.FileContactRow fcr = (atriumDB.FileContactRow)Add(myA.CurrentFile);
                fcr.ContactId   = or.OfficerId;
                fcr.ContactType = contactType;
                fcr.Active      = true;
                fcr.StartDate   = DateTime.Today;

                fcr.OfficeId = or.OfficeId;
            }

            return((atriumDB.FileContactRow)myA.DB.FileContact.Select("ContactId=" + or.OfficerId.ToString())[0]);
        }
예제 #22
0
        public officeDB.OfficerRow LoadByEmail(string email)
        {
            if (myA.AtMng.AppMan.UseService)
            {
                Fill(myA.AtMng.AppMan.AtriumX().OfficerLoadByEmail(email, myA.AtMng.AppMan.AtriumXCon));
            }
            else
            {
                try
                {
                    Fill(myDAL.LoadByEmail(email));
                }
                catch (System.Runtime.Serialization.SerializationException x)
                {
                    RecoverDAL();
                    Fill(myDAL.LoadByEmail(email));
                }
            }

            officeDB.OfficerRow[] ors = (officeDB.OfficerRow[]) this.myOfficerDT.Select("EmailAddress='" + email.Replace("'", "''") + "'");
            if (ors.Length == 1)
            {
                SetLocalDates();
                officeDB.OfficerRow or = ors[0];
                return(or);
            }
            else
            {
                myA.GetContactEmail().LoadByEmail(email);
                officeDB.ContactEmailRow[] cers = (officeDB.ContactEmailRow[])myA.DB.ContactEmail.Select("Email='" + email.Replace("'", "''") + "'");
                if (cers.Length > 0)
                {
                    SetLocalDates();
                    officeDB.OfficerRow or = myA.GetOfficer().Load(cers[0].ContactId);
                    return(or);
                }
                else
                {
                    return(null);
                }
            }
        }
예제 #23
0
        public override void ApplySecurity(DataRow dr)
        {
            if (FileForm() != null && FileForm().ReadOnly)
            {
                return;
            }

            if (dr == null)
            {
                return;
            }

            officeDB.OfficerRow odr = (officeDB.OfficerRow)dr;
            bool okToAdd            = FM.LeadOfficeMng.GetOfficer().CanAdd(odr.OfficeRow);

            UIHelper.EnableControls(officerBindingSource, FM.LeadOfficeMng.GetOfficer().CanEdit(odr));
            UIHelper.EnableCommandBarCommand(tsNew, okToAdd);
            UIHelper.EnableCommandBarCommand(tsCopyPrefs, okToAdd);
            UIHelper.EnableCommandBarCommand(tsSecurity, okToAdd);
            UIHelper.EnableCommandBarCommand(tsMyFile, okToAdd);
            UIHelper.EnableCommandBarCommand(cmdAddToAB, okToAdd);
            UIHelper.EnableCommandBarCommand(tsDelete, FM.LeadOfficeMng.GetOfficer().CanDelete(odr));

            bool isClientReadOnly = FM.AtMng.SecurityManager.CanExecute(0, atSecurity.SecurityManager.Features.Atrium) == atSecurity.SecurityManager.ExPermissions.No;

            uiTabPage2.TabVisible      = !isClientReadOnly;
            uiTabPage3.TabVisible      = !isClientReadOnly;
            uiTabPage4.TabVisible      = !isClientReadOnly;
            tribunalTabPage.TabVisible = (FM.GetSSTMng() != null);



            //if (!odr.IsActiveNull())
            //{
            //    currentEmployeeUICheckBox.Enabled = true;
            //}
            //else
            //{
            //    currentEmployeeUICheckBox.Enabled = false;
            //}
        }
예제 #24
0
 private void InitReminder()
 {
     try
     {
         officeDB.OfficerRow workingas = myFM.AtMng.WorkingAsOfficer;
         int OfficerId = workingas.OfficerId;
         atriumDB.AttendeeRow[] attws = (atriumDB.AttendeeRow[])myFM.DB.Attendee.Select("ApptId = " + apptRow.ApptId.ToString() + " AND ContactId =" + OfficerId.ToString());
         int len = attws.Length;
         if (len > 0)
         {
             atriumDB.AttendeeRow attw = attws[0];
             if (!attw.IsIntervalNull())
             {
                 apptRow.Interval = attw.Interval;
             }
         }
     }
     catch (Exception x)
     {
         UIHelper.HandleUIException(x);
     }
 }
예제 #25
0
        /// <summary>
        /// clears activitytime and srpclient rows related to the srprow from the datatables and reloads/recalculates totals for srp and srpclient for unclosed period.  will return w/o executing recalculation for closed period - i.e. srpsubmitted date is not null
        /// </summary>
        /// <param name="drSRP">the srp data row that requires the recalculation</param>
        private void CalculateOpenPeriodTotals(atriumDB.SRPRow drSRP)
        {
            //update total on timekeeping period based on data on client
            DateTime endDate = drSRP.SRPDate.AddMonths(1).AddMinutes(-1);

            officeDB.OfficerRow or = FM.AtMng.OfficeMng.GetOfficer().LoadByMyFileId(FM.CurrentFile.FileId);
            try
            {
                decimal srpHours = Convert.ToDecimal(TSdt.Compute("sum(Hours)", "StartTime>= '" + drSRP.SRPDate + "' and StartTime<='" + endDate + "' and OfficerId=" + or.OfficerId + " and SRPDate is null"));
                drSRP.FeesClaimed = srpHours;
            }

            catch (Exception x)
            {
                drSRP.FeesClaimed = 0;
            }


            //remove rows from srpclient datatable
            List <appDB.SRPClientRow> clientSRPsToRemove = new List <appDB.SRPClientRow>();

            foreach (appDB.SRPClientRow drSRPClient in SRPClientDt)
            {
                if (drSRPClient.SRPId == drSRP.SRPID)
                {
                    clientSRPsToRemove.Add(drSRPClient);
                }
            }
            foreach (appDB.SRPClientRow listClientRow in clientSRPsToRemove)
            {
                SRPClientDt.RemoveSRPClientRow(listClientRow);
            }
            LoadedSRPs.Remove(drSRP.SRPID);

            //reload client data
            LoadSrpClient(or.OfficerId, drSRP.SRPID, drSRP.SRPDate, endDate);
        }
예제 #26
0
        protected override void BeforeChange(DataColumn dc, DataRow ddr)
        {
            base.BeforeChange(dc, ddr);
            string ObjectName = this.myOfficerDT.TableName;

            officeDB.OfficerRow dr = (officeDB.OfficerRow)ddr;
            switch (dc.ColumnName)
            {
            case "OfficerCode":
                if (dr.IsUserNameNull())
                {
                    dr.UserName = dr.OfficerCode;
                }
                break;

            case "PositionCode":
                if (!myA.CheckDomain(dr.PositionCode, myA.AtMng.GetFile().Codes("PositionCode")))
                {
                    throw new AtriumException(atriumBE.Properties.Resources.BadDomainValue, dc.ColumnName, dr.Table.TableName, "Position Code");
                }
                if (dr.PositionCode == "LA" && dr.IsAssistantIdNull())
                {
                    throw new RequiredException("Assistant");
                }
                break;

            case "EmailAddress":
                if (dr.IsEmailAddressNull())
                {
                    throw new RequiredException(dc.ColumnName);
                }
                break;

            default:
                break;
            }
        }
예제 #27
0
        private void CalculateOpenPeriodTotals(atriumDB.SRPDataTable dtSRP)
        {
            foreach (atriumDB.SRPRow srpRow in dtSRP.Select("Fileid=" + FM.CurrentFile.FileId.ToString()))
            {
                if (!LoadedSRPs.Contains(srpRow.SRPID) && srpRow.IsSRPSubmittedDateNull())
                {
                    appDB.TimeSlipDataTable TSdt2Merge = new appDB.TimeSlipDataTable();

                    DateTime            endDate = srpRow.SRPDate.AddMonths(1).AddMinutes(-1);
                    officeDB.OfficerRow or      = FM.AtMng.OfficeMng.GetOfficer().LoadByMyFileId(FM.CurrentFile.FileId);
                    if (or != null)
                    {
                        TSdt2Merge = (appDB.TimeSlipDataTable)FM.GetActivityTime().LoadByOfficerId(or.OfficerId, srpRow.SRPDate, endDate);
                        if (TSdt2Merge.Rows.Count > 0)
                        {
                            decimal srpTotalTime = Convert.ToDecimal((TSdt2Merge.Compute("sum(Hours)", String.Empty)));
                            srpRow.FeesClaimed = srpTotalTime;
                        }
                        else
                        {
                            srpRow.FeesClaimed = 0;
                        }

                        LoadedSRPs.Add(srpRow.SRPID);
                        TSdt.Merge(TSdt2Merge);
                        LoadSrpClient(or.OfficerId, srpRow.SRPID, srpRow.SRPDate, endDate);
                        tsData.TimeSlipBranch.Merge(FM.GetActivityTime().LoadBranchByOfficerId(or.OfficerId, srpRow.SRPDate, endDate));
                    }
                    else
                    {
                        MessageBox.Show(LawMate.Properties.Resources.ThePersonalFileAssociatedTimekeepingNotFound, LawMate.Properties.Resources.PersonalFileNotFound, MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                }
            }
        }
예제 #28
0
        private void LoadOutlookFreeBusy(int ContactId, DateTime startDate, DateTime endDate)
        {
            //get email for contact
            officeDB.OfficerRow or = myA.AtMng.OfficeMng.DB.Officer.FindByOfficerId(ContactId);
            if (or == null)
            {
                or = myA.AtMng.OfficeMng.GetOfficer().Load(ContactId);
            }

            if (or != null)
            {
                string sEmail = or.EmailAddress;

                //get addressentry from RDO
                Redemption.RDOSession sess = DocumentBE.RDOSession();
                sess.Logon(missing, missing, missing, missing, missing, missing);
                //Redemption.RDOAddressList gal = sess.AddressBook.GAL;
                Redemption.RDOAddressEntry ae = sess.AddressBook.ResolveName(sEmail);
                //get free busy
                if (ae.Type == "EX")
                {
                    string s = ae.GetFreeBusy(startDate, 30);
                    Redemption.RDOFreeBusyRange fbr = ae.FreeBusyList;
                    //loop over array
                    foreach (Redemption.RDOFreeBusySlot fbs in fbr)
                    {
                        //load myTimelineDT
                        atriumDB.TimeLineRow tlr = myTimelineDT.NewTimeLineRow();
                        tlr.ContactId = ContactId;
                        tlr.StartDate = fbs.Start;
                        tlr.EndDate   = fbs.End;
                        myTimelineDT.AddTimeLineRow(tlr);
                    }
                }
            }
        }
예제 #29
0
        protected override void AfterChange(DataColumn dc, DataRow ddr)
        {
            atriumDB.FileContactRow dr = (atriumDB.FileContactRow)ddr;

            //JLL: Fires too often on contactid when it hasn't changed - because of ucContactSelect control

            switch (dc.ColumnName)
            {
            case FileContactFields.ContactType:
            case FileContactFields.ContactId:
                if (!dr.IsNull("ContactType") && dr.IsNull("ContactId"))
                {
                    if (!dr.NoReassign)     // only run it if noreassign not set JLL 2015-01-22
                    {
                        int id = myA.EFile.GetOfficerForContactType(dr.EFileRow, dr.ContactType);

                        if (id != 0)
                        {
                            dr.ContactId = id;
                            dr.EndEdit();
                        }
                    }
                }

                if (!dr.IsNull("ContactType") && !dr.IsNull("ContactId"))
                {
                    if (dr.ContactType == myA.AtMng.GetSetting(AppStringSetting.LeadPLContactType) && (dr.EFileRow.IsLeadParalegalIDNull() || dr.EFileRow.LeadParalegalID != dr.ContactId))
                    {
                        dr.EFileRow.LeadParalegalID = dr.ContactId;
                        dr.EFileRow.EndEdit();
                    }
                    if (dr.ContactType == myA.AtMng.GetSetting(AppStringSetting.OfficerContactType) && (dr.EFileRow.IsOfficerIdNull() || dr.EFileRow.OfficerId != dr.ContactId))
                    {
                        dr.EFileRow.OfficerId = dr.ContactId;
                        dr.EFileRow.EndEdit();
                    }    //if (dr.ContactType == "FLL" &&(dr.EFileRow.IsLeadLawyerIDNull() || dr.EFileRow.LeadLawyerID != dr.ContactId))
                         //{
                         //    dr.EFileRow.LeadLawyerID = dr.ContactId;
                         //    dr.EFileRow.EndEdit();
                         //}

                    //JLL: 2010/11/16 Can only have one Lead Lawyer on file
                    //update current Lead Lawyer to Assisting Lawyer, unless trying to update to same
                    if (dr.ContactType == myA.AtMng.GetSetting(AppStringSetting.LeadLawyerContactype))
                    {
                        foreach (atriumDB.FileContactRow fcr in myA.CurrentFile.GetFileContactRows())
                        {
                            if (!fcr.IsNull("ContactType") && dr != fcr && fcr.ContactType == "FLL" && fcr.Active)
                            {
                                if (dr.ContactId == fcr.ContactId)
                                {
                                    throw new AtriumException(String.Format(Properties.Resources.LeadLawyerAlreadyOnFile, myA.AtMng.AppMan.AppName));
                                }
                                else
                                {
                                    //found current - update to assisting and leave
                                    fcr.ContactType = "FAL";
                                    fcr.EndEdit();
                                    break;
                                }
                            }
                        }
                        if (dr.EFileRow.IsLeadLawyerIDNull() || dr.EFileRow.LeadLawyerID != dr.ContactId)
                        {
                            dr.EFileRow.LeadLawyerID = dr.ContactId;
                            dr.EFileRow.EndEdit();
                        }
                    }

                    //JLL: 2009/07/23 Can only have one Lead Client Contact on file
                    //update current Lead Client Contact to Secondary Client Contact
                    if (dr.ContactType == "FCC")
                    {
                        foreach (atriumDB.FileContactRow fcr in myA.CurrentFile.GetFileContactRows())
                        {
                            if (!fcr.IsNull("ContactType") && dr != fcr && fcr.ContactType == "FCC" && fcr.Active)
                            {
                                //if (dr.ContactId == fcr.ContactId)
                                //{

                                //    //We need to delete the duplicate somehow.
                                //    //to skip the error entirely means we end up with two contacts on the file that is the same person
                                //    // opinion/requestdocid beforeChange fires and adds another filecontact record when it is not needed
                                //    // maybe perform a check in opinion/requestdocid beforeChange to see if contactids match already and don't add if already OK
                                //    throw new AtriumException("The selected contact is already the Lead Client Contact on this file.  LawMate does not allow duplicate lead client contacts.");
                                //}
                                //else
                                //found current - update to secondary and leave
                                fcr.ContactType = "FSCC";
                                fcr.EndEdit();
                                break;
                            }
                        }
                    }
                }

                if (dr.RowState == DataRowState.Added & !dr.IsNull("ContactId") & !dr.IsNull("ContactType"))
                {
                    //find officeid

                    officeDB.OfficerRow orr = myA.AtMng.OfficeMng.GetOfficer().FindLoad(dr.ContactId);
                    if (orr != null)
                    {
                        //add office to file
                        //if (myA.DB.FileOffice.Rows.Count == 0)
                        //    myA.GetFileOffice().LoadByFileId(dr.FileId);

                        if (myA.DB.FileOffice.Select("OfficeID=" + orr.OfficeId.ToString()).Length == 0)
                        {
                            atriumDB.FileOfficeRow fo = (atriumDB.FileOfficeRow)myA.GetFileOffice().Add(myA.CurrentFile);
                            fo.OfficeId = orr.OfficeId;
                            if (dr.ContactType == "FCC" || dr.ContactType == "FHGD")
                            {
                                fo.IsClient = true;
                                object alloc = myA.DB.FileOffice.Compute("Sum(PercentAlloc)", "isclient=1");
                                if (alloc.GetType() == typeof(decimal))
                                {
                                    fo.PercentAlloc = 100 - System.Convert.ToDecimal(alloc);
                                }
                                else
                                {
                                    fo.PercentAlloc = 100;
                                }
                            }
                        }
                    }
                }
                break;

            case FileContactFields.EndDate:
                //JLL: 2009/07/23 - set active based on end date
                dr.Active    = dr.IsEndDateNull();
                dr.HideInToc = !dr.IsEndDateNull();
                dr.EndEdit();
                break;

            default:
                break;
            }
        }
예제 #30
0
        public void setOfficer(officeDB.OfficerRow or)
        {
            toolkitOfficerId = or.OfficerId;
            tkOfficeId       = or.OfficeId;

            tvOfficerToolkit.ExpandAll();

            tvOfficerToolkit.Nodes["nodeMyDocs"].Collapse();

            if (Atmng.OfficeMng.GetOfficerPrefs().GetPref(OfficerPrefsBE.OfficerTKHideBF, false))
            {
                AddNodeToDict(tvOfficerToolkit.Nodes["NodeMyItems"]);
            }

            tvOfficerToolkit.Nodes["nodeMyDocs"].Nodes["NodeMyChron"].Collapse();
            tvOfficerToolkit.Nodes["nodeMyDocs"].Nodes["nodReceived"].Collapse();
            if (Atmng.OfficeMng.GetOfficerPrefs().GetPref(OfficerPrefsBE.OfficerTKHideDocs, false))
            {
                AddNodeToDict(tvOfficerToolkit.Nodes["nodeMyDocs"]);
            }

            tvOfficerToolkit.Nodes["NodeMyFiles"].Nodes["ndRecentFiles"].Collapse();
            if (Atmng.OfficeMng.GetOfficerPrefs().GetPref(OfficerPrefsBE.OfficerTKHideFiles, false))
            {
                AddNodeToDict(tvOfficerToolkit.Nodes["NodeMyFiles"]);
            }

            if (Atmng.OfficeMng.GetOfficerPrefs().GetPref(OfficerPrefsBE.OfficerTKHideAddBook, false))
            {
                AddNodeToDict(tvOfficerToolkit.Nodes["nodeAddressBook"]);
            }

            if (Atmng.OfficeMng.GetOfficerPrefs().GetPref(OfficerPrefsBE.OfficerTKHideCalendar, false))
            {
                AddNodeToDict(tvOfficerToolkit.Nodes["ndCalendar"]);
            }

            if (or.OfficeRow.IsOfficeFileIdNull())
            {
                cmdMyOffice.Visible = Janus.Windows.UI.InheritableBoolean.False;
                tvOfficerToolkit.Nodes.Remove(tvOfficerToolkit.Nodes["NodeMyOffice"]);
            }
            else
            {
                tvOfficerToolkit.Nodes["NodeMyOffice"].Tag = or.OfficeRow.OfficeFileId;
                if (Atmng.OfficeMng.GetOfficerPrefs().GetPref(OfficerPrefsBE.OfficerTKHideMyOffice, false))
                {
                    AddNodeToDict(tvOfficerToolkit.Nodes["NodeMyOffice"]);
                }
            }

            if (or.IsMyFileIdNull())
            {
                cmdPersonalFile.Visible = Janus.Windows.UI.InheritableBoolean.False;
                tvOfficerToolkit.Nodes.Remove(tvOfficerToolkit.Nodes["NodePersonalFile"]);
            }
            else
            {
                tvOfficerToolkit.Nodes["NodePersonalFile"].Tag = or.MyFileId;
                if (Atmng.OfficeMng.GetOfficerPrefs().GetPref(OfficerPrefsBE.OfficerTKHidePersonalFile, false))
                {
                    AddNodeToDict(tvOfficerToolkit.Nodes["NodePersonalFile"]);
                }
            }

            if (or.IsShortcutsIdNull())
            {
                tvOfficerToolkit.Nodes["nodeMyDocShortcuts"].Remove();
            }
            else
            {
                tvOfficerToolkit.Nodes["nodeMyDocShortcuts"].Tag = or.ShortcutsId;
            }
        }