예제 #1
0
        public bool InsertGroupPerjawatan(GroupPerjawatan objGroupPerjawatan)
        {
            try
            {
                db.GroupPerjawatans.Add(objGroupPerjawatan);
                db.SaveChanges();

                BPEventLog bpe = new BPEventLog();
                bpe.Object           = "ServiceGroup";
                bpe.ObjectName       = objGroupPerjawatan.GroupPerjawatanCode;
                bpe.ObjectChanges    = string.Empty;
                bpe.EventMassage     = "Success";
                bpe.Status           = "A";
                bpe.CreatedBy        = objGroupPerjawatan.CreatedBy;
                bpe.CreatedTimeStamp = objGroupPerjawatan.CreatedTimeStamp;
                new EventLogDAL().AddEventLog(bpe);

                return(true);
            }
            catch (Exception ex)
            {
                BPEventLog bpe = new BPEventLog();
                bpe.Object           = "ServiceGroup";
                bpe.ObjectName       = objGroupPerjawatan.GroupPerjawatanCode;
                bpe.ObjectChanges    = string.Empty;
                bpe.EventMassage     = "Failure";
                bpe.Status           = "A";
                bpe.CreatedBy        = objGroupPerjawatan.CreatedBy;
                bpe.CreatedTimeStamp = objGroupPerjawatan.CreatedTimeStamp;
                new EventLogDAL().AddEventLog(bpe);

                throw ex;
            }
        }
예제 #2
0
        public bool UpdateGroupPerjawatan(GroupPerjawatan objGroupPerjawatan)
        {
            GroupPerjawatan obj     = db.GroupPerjawatans.Where(x => x.GroupPerjawatanCode == objGroupPerjawatan.GroupPerjawatanCode).FirstOrDefault();
            string          changes = new EventLogDAL().ObjectDifference(obj, objGroupPerjawatan);

            try
            {
                if (obj != null)
                {
                    //obj.GroupPerjawatanCode = objGroupPerjawatan.GroupPerjawatanCode;
                    obj.GroupPerjawatanDesc     = objGroupPerjawatan.GroupPerjawatanDesc;
                    obj.ParentGroupPerjawatanID = objGroupPerjawatan.ParentGroupPerjawatanID;
                    obj.Status            = objGroupPerjawatan.Status;
                    obj.ModifiedBy        = objGroupPerjawatan.ModifiedBy;
                    obj.ModifiedTimeStamp = objGroupPerjawatan.ModifiedTimeStamp;
                    db.SaveChanges();

                    BPEventLog bpe = new BPEventLog();
                    bpe.Object           = "ServiceGroup";
                    bpe.ObjectName       = objGroupPerjawatan.GroupPerjawatanCode;
                    bpe.ObjectChanges    = changes;
                    bpe.EventMassage     = "Success";
                    bpe.Status           = "A";
                    bpe.CreatedBy        = objGroupPerjawatan.ModifiedBy;
                    bpe.CreatedTimeStamp = objGroupPerjawatan.ModifiedTimeStamp;
                    new EventLogDAL().AddEventLog(bpe);
                }
                return(true);
            }
            catch (Exception ex)
            {
                BPEventLog bpe = new BPEventLog();
                bpe.Object           = "ServiceGroup";
                bpe.ObjectName       = objGroupPerjawatan.GroupPerjawatanCode;
                bpe.ObjectChanges    = changes;
                bpe.EventMassage     = "Failure";
                bpe.Status           = "A";
                bpe.CreatedBy        = objGroupPerjawatan.ModifiedBy;
                bpe.CreatedTimeStamp = objGroupPerjawatan.ModifiedTimeStamp;
                new EventLogDAL().AddEventLog(bpe);

                throw ex;
            }
        }