Ejemplo n.º 1
0
        public ActivityLogService(Activity activityToLog /*,vw_Users_Role_Org sessionUser*/, CPMmodel dbcExisting)
            : base(dbcExisting)
        {
            Act = activityToLog;

            Usr.ID = _SessionUsr.ID;
            Usr.Email = _SessionUsr.Email;
            Usr.Name = _SessionUsr.UserName;
        }
Ejemplo n.º 2
0
 public _ServiceBase()
 {
     if (dbc == null)
     {
         dbc = new CPMmodel();
         /*dbc = new CPMmodel(new StackExchange.Profiling.Data.ProfiledDbConnection
             (dbc.Connection, StackExchange.Profiling.MiniProfiler.Current)) { DeferredLoadingEnabled = true };*/
     }
     //http://blogs.microsoft.co.il/blogs/bursteg/archive/2007/10/06/linq-to-sql-deferred-loading-lazy-load.aspx
     //http://dotnetslackers.com/articles/csharp/Load-Lazy-in-LINQ-to-SQL.aspx
 }
Ejemplo n.º 3
0
        public void BulkAddEditDel(List<FileHeader> records, Claim claimObj, bool doSubmit, CPMmodel dbcContext)
        {
            //OLD: if (claimID <= Defaults.Integer) return; //Can't move forward if its a new Claim entry
            #region NOTE
            /* Perform Bulk Add, Edit & Del based on Object properties set in VIEW
             * MEANT ONLY FOR ASYNC BULK OPERATIONS
             * Handle transaction, error and final commit in Caller */
            #endregion

            //using{dbc}, try-catch and transaction must be handled in callee function
            foreach (FileHeader item in records)
            {
                #region Perform Db operations
                item.ClaimID = claimObj.ID;
                item.LastModifiedBy = _SessionUsr.ID;
                item.LastModifiedDate = DateTime.Now;
                item.UploadedOn = DateTime.Now; // double ensure dates are not null !

                //Special case handling for IE with KO - null becomes "null"
                if (item.Comment == "null") item.Comment = "";

                if (item._Deleted)
                    Delete(item, false);
                else if (item._Edited)//Make sure Delete is LAST
                    AddEdit(item, false);
                else if (item._Added)
                    Add(item, false);
                #endregion

                #region Log Activity (finally when the uploaded file data is entered in the DB
                if (item._Added || item._Edited)
                {
                    //Special case: Call the econd overload which has "doSubmit" parameter
                    new ActivityLogService(ActivityLogService.Activity.ClaimFileUpload, dbcContext).Add(
                    new ActivityHistory() { FileName = item.FileName, ClaimID = claimObj.ID, ClaimText = claimObj.ClaimNo.ToString() },
                    doSubmit);
                }
                #endregion
            }
            if (doSubmit) dbc.SubmitChanges();//Make a FINAL submit instead of periodic updates
            //Move header files
            ProcessFiles(records, claimObj.ID, claimObj.ClaimGUID);
        }
Ejemplo n.º 4
0
        public void BulkAddEditDel(List<FileDetail> records, Claim claimObj, int oldclaimDetailId, int claimDetailId, bool doSubmit, 
            CPMmodel dbcContext)
        {
            //using{dbc}, try-catch and transaction must be handled in callee function
            foreach (FileDetail item in records)
            {
                #region Perform Db operations
                item.LastModifiedBy = _SessionUsr.ID;
                item.LastModifiedDate = DateTime.Now;
                item.UploadedOn = DateTime.Now;// double ensure dates are not null !
                //HT: MUST: MAke sure this is set (i.e. the newly added Claimetail ID or it'll give FK err)
                item.ClaimDetailID = claimDetailId;
                item.ClaimID = claimObj.ID;

                //Special case handling for IE with KO - null becomes "null"
                if (item.Comment == "null") item.Comment = "";

                if (item._Deleted)
                    Delete(item, false);
                else if (item._Edited)//Make sure Delete is LAST
                    AddEdit(item, false);
                else if (item._Added)
                    Add(item, false);
                #endregion

                #region Log Activity (finally when the uploaded file data is entered in the DB
                if (item._Added || item._Edited)
                {//Special case: Call the econd overload which has "doSubmit" parameter
                    new ActivityLogService(ActivityLogService.Activity.ClaimFileUpload, dbcContext).Add(
                        new ActivityHistory() { FileName = item.FileName, ClaimID = item.ClaimID, ClaimDetailID = item.ClaimDetailID,
                                                ClaimText = claimObj.ClaimNo.ToString()
                        }, doSubmit);
                }
                #endregion
            }
            if (doSubmit) dbc.SubmitChanges(); //Make a FINAL submit instead of periodic updates
            //Move Item detail files
            ProcessFiles(records, claimObj.ID, claimObj.ClaimGUID, oldclaimDetailId, claimDetailId);
        }
Ejemplo n.º 5
0
        public void BulkAddEditDel(List<ClaimDetail> records, Claim claimObj, bool doSubmit, bool isNewClaim, CPMmodel dbcContext)
        {
            //using{dbc}, try-catch and transaction must be handled in callee function
            foreach (ClaimDetail item in records)
            {
                #region Perform Db operations
                item.ClaimID = claimObj.ID; //Required when adding new Claim
                item.LastModifiedBy = _SessionUsr.ID;
                item.LastModifiedDate = DateTime.Now;
                int oldClaimDetailId = item.ID;//store old id

                //Special case handling for IE with KO - null becomes "null"
                if (item.Note == "null") item.Note = "";
                if (item.Serial == "null") item.Serial = "";
                if (item.DOT == "null") item.DOT = "";

                if (item._Deleted)
                {
                    Delete(item, false);
                    // Make sure the Existing as well as Uploaded (Async) files are deleted
                    FileIO.EmptyDirectory(FileIO.GetClaimDirPathForDelete(claimObj.ID, item.ID, claimObj.ClaimGUID, true));
                    FileIO.EmptyDirectory(FileIO.GetClaimDirPathForDelete(claimObj.ID, item.ID, null,false));
                }
                else if (item._Edited)
                    AddEdit(item, false);
                else if (item._Added)
                    Add(item, false);

                #endregion

                if (doSubmit) //Make a FINAL submit here instead of periodic updates
                    dbc.SubmitChanges();

                // Finally, If Item is NOT deleted then process its Files
                if (!item._Deleted && item.aDFiles != null && item.aDFiles.Count() > 0) // Make sure item is not deleted
                    new FileDetailService(dbc).BulkAddEditDel(item.aDFiles, claimObj, oldClaimDetailId, item.ID, doSubmit, dbcContext);
            }
        }
Ejemplo n.º 6
0
 public FileHeaderService(CPMmodel dbcExisting)
     : base(dbcExisting)
 {
     ;
 }
Ejemplo n.º 7
0
 public CommentService(CPMmodel dbcExisting)
     : base(dbcExisting)
 {
     ;
 }
Ejemplo n.º 8
0
 public FileDetailService(CPMmodel dbcExisting)
     : base(dbcExisting)
 {
     ;
 }
Ejemplo n.º 9
0
 public ReportingService(CPMmodel dbcExisting)
     : base(dbcExisting)
 {
     ;
 }
Ejemplo n.º 10
0
 public ClaimDetailService(CPMmodel dbcExisting)
     : base(dbcExisting)
 {
     ;
 }
Ejemplo n.º 11
0
 public _ServiceBase(CPMmodel dbcExisting)
 {
     //Special case because even using(dbc) caused renewal of dbc from within
     dbc = dbcExisting;
 }
Ejemplo n.º 12
0
 public StatusHistoryService(CPMmodel dbcExisting)
     : base(dbcExisting)
 {
     ;
 }