Esempio n. 1
0
 public ActionResult Entry(EntryModel model)
 {
     try
     {
         if (CheckModelIsValid(model))
         {
             UserInfo   sysUser  = CacheInit.GetUserInfo(HttpContext);
             DataUpdate dbUpdate = new DataUpdate();
             try
             {
                 dbUpdate.BeginTransaction();
                 PasswordModifiyRepository rep = new PasswordModifiyRepository();
                 rep.DbUpdate = dbUpdate;
                 rep.ModifiyPassword(model, sysUser.UserId);
                 dbUpdate.Commit();
             }
             catch (Exception ex)
             {
                 dbUpdate.Rollback();
                 throw new Exception(ex.Message);
             }
             finally
             {
                 dbUpdate.Close();
             }
         }
         return(View(model));
     }
     catch (Exception ex)
     {
         AppLog.WriteLog(AppMember.AppText["SystemUser"], LogType.Error, "PasswordModifiyController.Entry post", "[Message]:" + ex.Message + " [StackTrace]:" + ex.StackTrace);
         return(new JsonResult());
     }
 }
Esempio n. 2
0
        protected int Update(BarcodePrintRepository rep, Entry2Model model, string viewTitle)
        {
            UserInfo   sysUser  = CacheInit.GetUserInfo(HttpContext);
            DataUpdate dbUpdate = new DataUpdate();

            try
            {
                dbUpdate.BeginTransaction();
                rep.DbUpdate = dbUpdate;
                rep.Update(model, sysUser, viewTitle);
                dbUpdate.Commit();
                return(1);
            }
            catch (Exception ex)
            {
                dbUpdate.Rollback();
                model.Message  = ex.Message;
                model.HasError = "true";
                return(0);
            }
            finally
            {
                dbUpdate.Close();
            }
        }
Esempio n. 3
0
 public static void ExcuteAutoUpdateByThread()
 {
     if (!TaskExcuting)
     {
         TaskExcuting = true;
         //AppLog.WriteLog(AppMember.AppText["SystemUser"], LogType.Debug, "AutoTask", string.Format(AppMember.AppText["AutoDepreciationProcess"]));
         AssetsDepreciationRepository rep = new AssetsDepreciationRepository();
         DataUpdate dbUpdate = new DataUpdate();
         try
         {
             dbUpdate.BeginTransaction();
             rep.DbUpdate = dbUpdate;
             rep.UpdateAuto(AppMember.AppText["MonthAutoUpdate"]);
             dbUpdate.Commit();
         }
         catch (Exception ex)
         {
             dbUpdate.Rollback();
             AppLog.WriteLog(AppMember.AppText["SystemUser"], LogType.Error, "AutoTask", ex.Message);
             throw ex;
         }
         finally
         {
             dbUpdate.Close();
             TaskExcuting = false;
         }
     }
 }
Esempio n. 4
0
        private static void OnTimedEvent(object source, System.Timers.ElapsedEventArgs e)
        {
            myTimer.Stop();
            AppLog.WriteLog(AppMember.AppText["SystemUser"], LogType.Debug, "AutoTask", string.Format(AppMember.AppText["AutoDepreciationProcess"]));
            AssetsDepreciationRepository rep = new AssetsDepreciationRepository();
            DataUpdate dbUpdate = new DataUpdate();

            try
            {
                dbUpdate.BeginTransaction();
                rep.DbUpdate = dbUpdate;
                rep.UpdateAuto(AppMember.AppText["MonthAutoUpdate"]);
                dbUpdate.Commit();
            }
            catch (Exception ex)
            {
                dbUpdate.Rollback();
                throw ex;
            }
            finally
            {
                dbUpdate.Close();
                myTimer.Start();
            }
        }
Esempio n. 5
0
 public ActionResult ReplaceFavorit(string tableName, string pkValue)
 {
     try
     {
         UserInfo   sysUser  = CacheInit.GetUserInfo(HttpContext);
         DataUpdate dbUpdate = new DataUpdate();
         try
         {
             dbUpdate.BeginTransaction();
             CacheRepository drep = new CacheRepository();
             drep.DbUpdate = dbUpdate;
             drep.ReplaceFavorit(pkValue, sysUser.UserId, tableName);
             dbUpdate.Commit();
         }
         catch (Exception ex)
         {
             dbUpdate.Rollback();
             throw new Exception(ex.Message);
         }
         finally
         {
             dbUpdate.Close();
         }
         return(Content("0", "text/html"));
     }
     catch (Exception ex)
     {
         AppLog.WriteLog(AppMember.AppText["SystemUser"], LogType.Error, "MasterController.ReplaceFavorit", ControllerName + "[Message]:" + ex.Message + " [StackTrace]:" + ex.StackTrace);
         return(Content(ControllerName + "[Message]:" + ex.Message + " [StackTrace]:" + ex.StackTrace, "text/html"));
     }
 }
Esempio n. 6
0
        [WebMethod] // 删除指定模板
        public int fun10(int _class, string _LabelId)
        {
            AppInit.Init();
            DataUpdate             dbUpdate = new DataUpdate();
            BarcodePrintRepository rep      = new BarcodePrintRepository();

            try
            {
                dbUpdate.BeginTransaction();
                rep.DbUpdate = dbUpdate;
                string labelType = "";
                if (_class == 0)
                {
                    labelType = "Z";
                }
                else
                {
                    labelType = "C";
                }
                rep.DeleteStyle(labelType, _LabelId, "Print Tools Update");
                dbUpdate.Commit();
                return(1);
            }
            catch (Exception)
            {
                dbUpdate.Rollback();
                return(0);
            }
            finally
            {
                dbUpdate.Close();
            }
        }
 public ActionResult BatchDelete(string pageId, string formMode, string viewTitle, string gridString, string isCascadeDelete)
 {
     try
     {
         UserInfo         sysUser  = CacheInit.GetUserInfo(HttpContext);
         AssetsRepository arep     = new AssetsRepository();
         DataUpdate       dbUpdate = new DataUpdate();
         try
         {
             dbUpdate.BeginTransaction();
             arep.DbUpdate = dbUpdate;
             arep.BatchDelete(sysUser, gridString, viewTitle, isCascadeDelete);
             dbUpdate.Commit();
             return(Content("1"));
         }
         catch (Exception)
         {
             dbUpdate.Rollback();
             return(Content(AppMember.AppText["DeleteExistRefrence"]));
         }
         finally
         {
             dbUpdate.Close();
         }
     }
     catch (Exception ex)
     {
         AppLog.WriteLog(AppMember.AppText["SystemUser"], LogType.Error, "AssetsManageController.BatchDelete post", "[Message]:" + ex.Message + " [StackTrace]:" + ex.StackTrace);
         return(Content("[Message]:" + ex.Message + " [StackTrace]:" + ex.StackTrace, "text/html"));
     }
 }
        protected int Update(IApproveEntry rep, ApproveEntryViewModel model, string pkValue, string approveReturn)
        {
            UserInfo   sysUser  = CacheInit.GetUserInfo(HttpContext);
            DataUpdate dbUpdate = new DataUpdate();

            try
            {
                dbUpdate.BeginTransaction();
                rep.DbUpdate = dbUpdate;
                if (model.FormMode != "approve")
                {
                    //再申请的,将状态由再申请初期变为再申请
                    if (model.FormMode == "reapply")
                    {
                        ApproveRepository repApprove = new ApproveRepository();
                        repApprove.DbUpdate = rep.DbUpdate;
                        repApprove.EditData(sysUser, model.ViewTitle, model.ApproveTableName, model.ApprovePkField, model.ApprovePkValue, "A", model.ApproveMind, model.ApproveNode);
                    }
                    if (CheckModelIsValid(model))
                    {
                        rep.Update(model, sysUser, model.FormMode, pkValue, model.ViewTitle);
                    }
                    else
                    {
                        return(0);
                    }
                }
                else
                {
                    //ModelState.Clear();
                    if (ApproveAndUpdate(rep, model, pkValue, approveReturn, sysUser) == 0)
                    {
                        return(0);
                    }
                    int val = DealApprove(rep, model, approveReturn, "");
                    if (val == 0)
                    {
                        return(0);
                    }
                }
                dbUpdate.Commit();
                return(1);
            }
            catch (Exception ex)
            {
                dbUpdate.Rollback();
                model.Message  = ex.Message;
                model.HasError = "true";
                AppLog.WriteLog(sysUser.UserName, LogType.Error, "UpdateError", "[Message]:" + ex.Message + " [StackTrace]:" + ex.StackTrace);
                return(0);
            }
            finally
            {
                dbUpdate.Close();
            }
        }
Esempio n. 9
0
        //protected void Update(IEntry rep, EntryViewModel model, string mode, string pkValue, string viewTitle)
        //{
        //    UserInfo sysUser = CacheInit.GetUserInfo(HttpContext);
        //    DataUpdate dbUpdate = new DataUpdate(); dbUpdate = new DataUpdate();
        //    try
        //    {
        //        dbUpdate.BeginTransaction();
        //        rep.DbUpdate = dbUpdate;
        //        rep.Update(model, sysUser, mode, pkValue, viewTitle);
        //        dbUpdate.Commit();
        //        CacheInit.RefreshCache(HttpContext, EntryRepository, ControllerName + "DropList", DateTime.Now.AddMinutes(CacheExpiryMinute), CachePriority, CacheCreateType.Immediately);
        //    }
        //    catch (Exception ex)
        //    {
        //        dbUpdate.Rollback();
        //        model.Message = ex.Message;
        //        model.HasError = "true";
        //    }
        //    finally
        //    {
        //        dbUpdate.Close();
        //    }
        //}

        protected virtual int Update(IEntry rep, EntryViewModel model, string pkValue)
        {
            UserInfo   sysUser  = CacheInit.GetUserInfo(HttpContext);
            DataUpdate dbUpdate = new DataUpdate();

            try
            {
                if (CheckModelIsValid(model))
                {
                    if (CheckSelfBeforeSave(model))
                    {
                        dbUpdate.BeginTransaction();
                        rep.DbUpdate = dbUpdate;
                        rep.Update(model, sysUser, model.FormMode, pkValue, model.ViewTitle);
                        dbUpdate.Commit();
                        if (!NotNeedCache)
                        {
                            CacheInit.RefreshCache(HttpContext, EntryRepository, ControllerName + "DropList", DateTime.Now.AddMinutes(CacheExpiryMinute), CachePriority, CacheCreateType.Immediately);
                        }
                        return(1);
                    }
                    else
                    {
                        return(0);
                    }
                }
                else
                {
                    return(0);
                }
            }
            catch (Exception ex)
            {
                dbUpdate.Rollback();
                model.Message  = ex.Message;
                model.HasError = "true";
                AppLog.WriteLog(sysUser.UserName, LogType.Error, "UpdateError", "[Message]:" + ex.Message + " [StackTrace]:" + ex.StackTrace);
                return(0);
            }
            finally
            {
                dbUpdate.Close();
            }
        }
Esempio n. 10
0
 public ActionResult Entry(EntryModel model)
 {
     try
     {
         DataImportRepository rep     = new DataImportRepository();
         UserInfo             sysUser = CacheInit.GetUserInfo(HttpContext);
         string     path      = Server.MapPath("~/Content/uploads/excel/");
         string     fileNames = Request.Form["listExcelFileString"].ToString();
         DataUpdate dbUpdate  = new DataUpdate();
         try
         {
             dbUpdate.BeginTransaction();
             rep.DbUpdate = dbUpdate;
             rep.Import(path, fileNames, sysUser, model.ViewTitle);
             dbUpdate.Commit();
             model.HasError = "false";
         }
         catch (Exception ex)
         {
             dbUpdate.Rollback();
             model.Message  = ex.Message;
             model.HasError = "true";
             AppLog.WriteLog(sysUser.UserName, LogType.Error, "UpdateError", "[Message]:" + ex.Message + " [StackTrace]:" + ex.StackTrace);
         }
         finally
         {
             dbUpdate.Close();
         }
         model.EntryGridLayout = EntryGridLayout();
         if (model.HasError == "false")
         {
             return(RedirectToAction("Entry", new { pageId = model.PageId, viewTitle = model.ViewTitle }));
         }
         else
         {
             return(View(model));
         }
     }
     catch (Exception ex)
     {
         AppLog.WriteLog(AppMember.AppText["SystemUser"], LogType.Error, "DataImportController.Entry post", "[Message]:" + ex.Message + " [StackTrace]:" + ex.StackTrace);
         return(Content("[Message]:" + ex.Message + " [StackTrace]:" + ex.StackTrace, "text/html"));
     }
 }
Esempio n. 11
0
        private static void OnTimedEvent(object source, System.Timers.ElapsedEventArgs e)
        {
            MonthRecordRepository rep      = new MonthRecordRepository();
            DataUpdate            dbUpdate = new DataUpdate();

            try
            {
                dbUpdate.BeginTransaction();
                rep.DbUpdate = dbUpdate;
                rep.UpdateAuto(AppMember.AppText["MonthAutoUpdate"]);
                dbUpdate.Commit();
            }
            catch (Exception ex)
            {
                dbUpdate.Rollback();
                throw ex;
            }
            finally
            {
                dbUpdate.Close();
            }
        }