Beispiel #1
0
        public static void Disable(SpareEntities db, int id, TS_OPERATOR oper)
        {
            var location = db.TA_STORE_LOCATION.Single(p => p.UID == id);

            location.State = (int)DataState.Disabled;
            OperLogController.AddLog(db, LogType.BaseDataDisable, oper.OperName, location.ToString());
        }
Beispiel #2
0
        public static void Disable(SpareEntities db, int id, TS_OPERATOR oper)
        {
            var data = db.TA_STORE_GROUP.Single(p => p.UID == id);

            data.State = (int)DataState.Disabled;
            OperLogController.AddLog(db, LogType.BaseDataDisable, oper.OperName, data.ToString());
        }
Beispiel #3
0
        public static void Disable(SpareEntities db, long id, TS_OPERATOR oper)
        {
            var part = db.TA_PART.Single(p => p.UID == id);

            part.State = (int)DataState.Disabled;
            OperLogController.AddLog(db, LogType.BaseDataDisable, oper.OperName, part.ToString());
        }
Beispiel #4
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtOperCode.Text == "")
                {
                    MessageHelper.ShowError("请输入人员编号!");
                    txtOperCode.Focus();
                    return;
                }
                TS_OPERATOR oper     = new TS_OPERATOR();
                string      operCode = txtOperCode.Text;
                string      password = EncryptHelper.Encrypt(txtPassword.Text);
                using (PowerEntities powerdb = EntitiesFactory.CreatePowerInstance())
                {
                    oper = OperController.Login(powerdb, operCode, password);
                    if (oper == null)
                    {
                        MessageHelper.ShowError("错误的用户名或密码,登录失败!");
                        txtOperCode.Focus();
                        txtOperCode.SelectAll();
                        return;
                    }
                    this.DialogResult = DialogResult.OK;
                    //EntitiesFactory.SaveDb(powerdb);
                    GlobalVar.Oper          = oper;
                    GlobalVar.PowerMenuList = PowerController.GetPowerMenuList(powerdb, GlobalVar.PortalCode,
                                                                               oper.OperCode);
                    GlobalVar.NotifytypeList = PowerController.GetNotiFyTypeList(powerdb, GlobalVar.PortalCode,
                                                                                 oper.OperCode);
                    GlobalBuffer.FactoryCode = GlobalVar.Oper.DeptCode;
                }

                using (SpareEntities wmsdb = EntitiesFactory.CreateSpareInstance())
                {
                    OperLogController.AddLog(wmsdb, LogType.Login, oper.OperName, operCode, "登录成功");

                    EntitiesFactory.SaveDb(wmsdb);
                    GlobalVar.InitGlobalVar(wmsdb, GlobalVar.Oper);
                }
            }
            catch (WmsException ex)
            {
                MessageHelper.ShowInfo(ex.ToString());
            }
            catch (Exception ex)
            {
                var inner = ex.InnerException;
                MessageHelper.ShowError((string.IsNullOrEmpty(inner?.Message)) ? ex : inner);
            }
        }
Beispiel #5
0
        public static void AddOrUpdate(SpareEntities db, TA_STORE_LOCATION selectedData, TS_OPERATOR oper)
        {
            var logType = db.TA_STORE_LOCATION.Any(p => p.UID == selectedData.UID) ? LogType.BaseDataModify : LogType.BaseDataCreate;

            try
            {
                db.TA_STORE_LOCATION.AddOrUpdate(p => p.LocCode, selectedData);
                OperLogController.AddLog(db, logType, oper.OperName, selectedData.ToString());
            }
            catch (DbEntityValidationException dbEx)
            {
                Console.WriteLine(dbEx.ToString());
                throw;
            }
        }
Beispiel #6
0
        public static void AddList(SpareEntities db, IList <TB_BILL> billList)
        {
            db.TB_BILL.AddRange(billList);
            var logType = LogType.BillCreate;

            try
            {
                foreach (TB_BILL bill in billList)
                {
                    OperLogController.AddLog(db, logType, bill.OperName, billList.ToString());
                }
            }
            catch (DbEntityValidationException dbEx)
            {
                Console.WriteLine(dbEx.ToString());
                throw;
            }
        }
Beispiel #7
0
 public static void Delete(SpareEntities db, TA_STORE_LOCATION data, TS_OPERATOR oper)
 {
     db.Entry(data).State = EntityState.Deleted;
     OperLogController.AddLog(db, LogType.BaseDataDelete, oper.OperName, data.ToString());
 }