예제 #1
0
        private void LoadList(statusEN en, Exception ex)
        {
            AJAXObj obj = null;

            if (en == statusEN.err)
            {
                obj = new AJAXObj()
                {
                    Status = statusEN.err.ToString(),
                    Msg    = ex.Message,
                    Datas  = null
                };
            }
            else if (en == statusEN.success)
            {
                obj = new AJAXObj()
                {
                    Status = statusEN.success.ToString(),
                    Msg    = "加载成功",
                    Datas  = GetModelList()
                };
            }
            string jsonStr = Kits.JsSerializer(obj);

            Response.Write(jsonStr);
        }
예제 #2
0
        private void _ic_Notified(CVResult result, object obj)
        {
            if (result == CVResult.ResourceOperationResponded)
            {
                if (obj is ResourcePt)
                {
                    ResourcePt r = obj as ResourcePt;

                    if (r.service == 4)
                    {
                        if (r.success == 0)
                        {
                            string tempPathfile = Kits.GetTempPathfile(r.name);

                            string           pathfile = _dc.GetFtpPathfileWithoutRemoteDirectory(r.pathfile);
                            DownloadDataItem ddi      = new DownloadDataItem()
                            {
                                Source = pathfile,
                                Target = tempPathfile,
                                Id     = r.objectid,
                                Crc    = r.crc
                            };
                            _dc.Add(ddi);
                        }
                        else
                        {
                            Notified?.Invoke(CVResRequestResult.SourceNotFound, r.msg);
                        }
                    }
                }
            }
        }
예제 #3
0
 public Weapon(Kits restriction, string name, WeaponSlots slot, DamageTypes damage)
 {
     this.KitRestriction = restriction;
     this.Name           = name;
     this.Slot           = slot;
     this.Damage         = damage;
 }
예제 #4
0
 internal void AddLog(Log.Type type, string app, string evt, string text)
 {
     if (_logTableOp != null)
     {
         if (type != Log.Type.Sys && string.Equals(app, Log.SysTypeDesc, System.StringComparison.CurrentCultureIgnoreCase))
         {
             //'sys' 系统保留使用
             Notify(CVResult.LogFailed, "'" + app + "'系统保留使用");
             return;
         }
         if (type == Log.Type.App || Log.EnableSystemEvent)
         {
             string sql = @"INSERT INTO pub_log(ty,uid,uname,app,ip,machine,evt,text,tm)VALUES("
                          + (ushort)type + "," + Id + ",'" + Username + "','" + app + "','" + _localIp + "','"
                          + _localName + "','" + evt + "','" + text + "','"
                          + Kits.GetNowString() + "')";
             _logTableOp.Token = type == 0 ? "add_evt" : "add_log";
             _logTableOp.Insert(sql);
         }
     }
     else
     {
         Notify(CVResult.LogFailed, "日志系统无效");
     }
 }
예제 #5
0
파일: Weapon.cs 프로젝트: eaceaser/PRoCon
 public Weapon(Kits restriction, string name, WeaponSlots slot, DamageTypes damage)
 {
     this.KitRestriction = restriction;
     this.Name = name;
     this.Slot = slot;
     this.Damage = damage;
 }
예제 #6
0
        public ActionResult add(UserInfoAdd model)
        {
            if (ModelState.IsValid == false)
            {
                return(WriteError("验证失败"));
            }
            try
            {
                sysUserInfo user = new sysUserInfo()
                {
                    uLoginName   = model.uLoginName,
                    uStatus      = model.uStatus,
                    uGender      = model.uGender,
                    uEmail       = model.uEmail,
                    uRealName    = model.uRealName,
                    uMobile      = model.uMobile,
                    uLoginPWD    = Kits.MD5Entry("123456"),
                    uUpdateTime  = DateTime.Now,
                    uCreateID    = UserMgr.GetCurrentUserInfo().uID,
                    uCreateTime  = DateTime.Now,
                    uCompanyID   = model.uCompanyID,
                    uDepID       = model.uDepID,
                    uWorkGroupID = model.uWorkGroupID
                };

                _userinfoSer.Add(user);
                _userinfoSer.SaveChanges();
                return(WriteSuccess("新增成功"));
            }
            catch (Exception ex)
            {
                return(WriteError(ex));
            }
        }
예제 #7
0
        public async Task <IActionResult> Edit(int id, [Bind("KitId,KitName,Cost,Details")] Kits kits)
        {
            if (id != kits.KitId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(kits);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!KitsExists(kits.KitId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(kits));
        }
예제 #8
0
        /// <summary>
        /// Производит удаление всех коллекций прогноза
        /// </summary>
        public void Dispose()
        {
            // Создаем все коллекции
            ForecastDatas.Clear();
            ForecastDatas = null;
            BaseComponents.Clear();
            BaseComponents = null;
            BaseComponentDirectives.Clear();
            BaseComponentDirectives = null;
            Components.Clear();
            Components = null;
            ComponentDirectives.Clear();
            ComponentDirectives = null;
            AdStatus.Clear();
            AdStatus = null;
            Damages.Clear();
            Damages = null;
            DefferedItems.Clear();
            DefferedItems = null;
            EngineeringOrders.Clear();
            EngineeringOrders = null;
            OutOfPhaseItems.Clear();
            OutOfPhaseItems = null;
            ServiceBulletins.Clear();
            ServiceBulletins = null;
            MaintenanceChecks.Clear();
            MaintenanceChecks = null;
            Kits.Clear();
            Kits = null;

            DirectiveCollections.Clear();
            DirectiveCollections = null;
        }
예제 #9
0
 private void PreencheDados(Kits Dadoskit)
 {
     txtNomeKit.Text      = Dadoskit.Nome;
     txtDescricaoKit.Text = Dadoskit.Descricao;
     txtQtdPessoaKit.Text = Dadoskit.QtdPessoa.ToString();
     txtPrecoKit.Text     = Dadoskit.Preco.ToString();
 }
예제 #10
0
        public ActionResult Login(LoginInfo model)
        {
            try
            {
                //1.0实体参数合法性验证
                if (ModelState.IsValid == false)
                {
                    return(WriteError("实体验证失败"));
                }
                //2.0检查验证码的合法性
                string vcodeFromSession = string.Empty;
                if (Session[Keys.vcode] != null)
                {
                    vcodeFromSession = Session[Keys.vcode].ToString();
                }
                if (model.VCode.IsEmpty() || vcodeFromSession.Equals(model.VCode, StringComparison.OrdinalIgnoreCase) == false)
                {
                    return(WriteError("验证码不合法"));
                }
                //3.0用户名和密码的正确性
                string md5PWD   = Kits.MD5Entry(model.uLoginPWD);
                var    userinfo = _userinfoSer.QueryWhere(
                    c => c.uLoginName == model.uLoginName &&
                    c.uLoginPWD == md5PWD).FirstOrDefault();
                if (userinfo == null)
                {
                    return(WriteError("用户名或密码错误"));
                }
                //4.0将userinfo存入session
                Session[Keys.uinfo] = userinfo;
                //5.0判断logininfo实体model中ismember是否为true,
                //如果成立则将用户id写入cookie中
                if (model.IsMember)
                {
                    //一般要将用户ID加密成密文DES(对称加密算法),自定义密码
                    HttpCookie cookie = new HttpCookie(Keys.IsMember, userinfo.uID.ToString());
                    cookie.Expires = DateTime.Now.AddDays(3);
                    Response.Cookies.Add(cookie);
                }
                else
                {//清除cookie操作
                    HttpCookie cookie = new HttpCookie(Keys.IsMember, "");
                    cookie.Expires = DateTime.Now.AddDays(-3);
                    Response.Cookies.Add(cookie);
                }


                //5.0将当前用户的所有按钮缓存起来,
                // 选择此缓存永久有效,当管理员操作用户分配角色和设置次用户所在角色的权限菜单的时候,要是缓存你失效
                _permissSer.GetFunctionsForUserByCache(userinfo.uID);

                //6.0 返回登录成功消息
                return(WriteSuccess("登录成功"));
            }
            catch (Exception ex)
            {
                return(WriteError(ex));
            }
        }
예제 #11
0
        public ActionResult Login(LoginInfo model)
        {
            //按照用户名进行数据库的访问操作
            try
            {
                //视图验证
                if (ModelState.IsValid == false)
                {
                    return(View());
                }

                string vcode = string.Empty;
                if (Session[Keys.vcode] != null)
                {
                    vcode = Session[Keys.vcode].ToString();
                }

                if (string.IsNullOrWhiteSpace(model.Vcode) || model.Vcode.Equals(vcode, StringComparison.OrdinalIgnoreCase) == false)
                {
                    ModelState.AddModelError("", "验证码错误");
                    return(View());
                }

                //查找数据库验证
                string md5Pwd   = Kits.Md5Entry(model.uLoginPWD);
                var    userInfo = userinfoSer.CheckUser(model.uLoginName, md5Pwd);

                if (userInfo == null)
                {
                    ModelState.AddModelError("", "用户名或密码错误");
                    return(View());
                }
                //将userinfo保存到session中
                Session[Keys.Uinfo] = userInfo;

                //4.0是否记住三天
                if (Request.Form["remember"] != null)
                {
                    //用户选择记住三天,将用户的id写入cookie
                    //userInfo.uID
                    HttpCookie cookie = new HttpCookie(Keys.remember, userInfo.uID.ToString());
                    cookie.Expires = DateTime.Now.AddDays(3);
                    Response.Cookies.Add(cookie);
                }
                else
                {
                    //用户没有勾选则应该手动清空
                    HttpCookie cookie = new HttpCookie(Keys.remember, "");
                    cookie.Expires = DateTime.Now.AddYears(-1);
                    Response.Cookies.Add(cookie);
                }
                return(Redirect("/Admin/Home/Index"));
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("", ex.Message);
                return(View());
            }
        }
예제 #12
0
 private void Clear()
 {
     ShowKitOther   = false;
     Expiry         = DateTime.Today;
     KitOther       = LotNumber = String.Empty;
     SelectedKit    = Kits.OrderBy(x => x.Rank).FirstOrDefault();
     SelectedResult = Results.OrderBy(x => x.Rank).FirstOrDefault();
 }
예제 #13
0
        public static void ExcluirKit(int id)
        {
            Kits kitAtual = ContextoSingleton.Instancia.TblKit.Find(id);

            ContextoSingleton.Instancia.Entry(kitAtual).State =
                System.Data.Entity.EntityState.Deleted;
            ContextoSingleton.Instancia.SaveChanges();
        }
예제 #14
0
        public void AddKitCount(Kits kit) {

            if (this.KitCounter.ContainsKey(kit) == true) {
                this.KitCounter[kit] = this.KitCounter[kit] + 1;
            }
            else {
                this.KitCounter.Add(kit, 1);
            }
        }
예제 #15
0
 public void AddKitCount(Kits kit)
 {
     if (this.KitCounter.ContainsKey(kit) == true)
     {
         this.KitCounter[kit] = this.KitCounter[kit] + 1;
     }
     else
     {
         this.KitCounter.Add(kit, 1);
     }
 }
예제 #16
0
        public async Task <IActionResult> Create([Bind("KitId,KitName,Cost,Details")] Kits kits)
        {
            if (ModelState.IsValid)
            {
                _context.Add(kits);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(kits));
        }
예제 #17
0
 private void LoadTest()
 {
     if (null != TestResult)
     {
         Id             = TestResult.Id;
         SelectedKit    = Kits.FirstOrDefault(x => x.ItemId == TestResult.Kit);
         KitOther       = TestResult.KitOther;
         LotNumber      = TestResult.LotNumber;
         Expiry         = TestResult.Expiry;
         SelectedResult = Results.FirstOrDefault(x => x.ItemId == TestResult.Result);
     }
 }
예제 #18
0
        private void _dc_Ended(IDataOpItem item)
        {
            if (item is DownloadDataItem)
            {
                DownloadDataItem ddi = item as DownloadDataItem;
                if (ddi.Success)
                {
                    if (_excludedItems.Contains(Kits.GetFilename(ddi.Target)))
                    {
                        return;
                    }
                    _downedCount++;
                    //unpackage
                    string target = ddi.Target.Replace(@"\" + _temp, "");

                    string dir = (new FileInfo(target)).DirectoryName;
                    if (!Directory.Exists(dir))
                    {
                        Directory.CreateDirectory(dir);
                    }

                    try
                    {
                        int l = ResourcePackage.Unpackage(ddi.Target, target);
                        Notified?.Invoke(CVRDownloadResult.Finished, new FinishedItem {
                            Name = target, Length = l
                        });
                    }
                    catch
                    {
                        Notified?.Invoke(CVRDownloadResult.UnpackageHappened, target);
                    }

                    if (_requestedCount == _downedCount)
                    {
                        string targetemp = Path.Combine(Target, _temp);
                        if (Directory.Exists(targetemp))
                        {
                            Kits.DeleteDirectory(targetemp);
                        }

                        Notified?.Invoke(CVRDownloadResult.Completed, _downedCount);
                    }
                }
                else
                {
                    Notified?.Invoke(CVRDownloadResult.DownloadHappened, ddi.Source);
                }
            }
        }
예제 #19
0
        /// <summary>
        /// Создает воздушное судно без дополнительной информации
        /// </summary>
        public ComponentDirective(ComponentDirective toCopy) : this()
        {
            if (toCopy == null)
            {
                return;
            }

            Cost            = toCopy.Cost;
            ComponentId     = toCopy.ComponentId;
            DirectiveTypeId = toCopy.DirectiveTypeId;
            FaaFormFileId   = toCopy.FaaFormFileId;
            HiddenRemarks   = toCopy.HiddenRemarks;
            Highlight       = toCopy.Highlight;
            IsClosed        = toCopy.IsClosed;
            KitRequired     = toCopy.KitRequired;
            ManHours        = toCopy.ManHours;
            MPDTaskType     = toCopy.MPDTaskType;
            ParentComponent = toCopy.ParentComponent;
            Remarks         = toCopy.Remarks;
            _threshold      = toCopy.Threshold;

            FaaFormFile = toCopy.FaaFormFile;

            if (_performanceRecords == null)
            {
                _performanceRecords = new BaseRecordCollection <DirectiveRecord>();
            }
            _performanceRecords.Clear();
            foreach (DirectiveRecord directiveRecord in toCopy.PerformanceRecords)
            {
                _performanceRecords.Add(new DirectiveRecord(directiveRecord)
                {
                    Parent = this, ParentId = ItemId
                });
            }

            if (Kits == null)
            {
                Kits = new CommonCollection <AccessoryRequired>();
            }
            Kits.Clear();
            foreach (AccessoryRequired kit in toCopy.Kits)
            {
                Kits.Add(new AccessoryRequired(kit)
                {
                    ParentObject = this, ParentId = ItemId
                });
            }
        }
예제 #20
0
 /// <summary>
 /// Создание и удаление аптечек
 /// </summary>
 private static void UpdateKits()
 {
     if (Kits.Count == 0 && Rand.Next(0, St.KitAppearence) == Rand.Next(0, St.KitAppearence) && Ship?.Health < St.SpaceShipMaxHealth * 0.5) // Создание новых аптечек
     {
         Kits.Add(new Kit(new Point(St.FieldMaxWidth - Kit.Img.Size.Width, Rand.Next(Kit.Img.Size.Height, St.FieldMaxHeight - Kit.Img.Size.Height)),
                          new Point(-St.KitDir[DiffLvl], Rand.Next(-St.KitDir[DiffLvl], St.KitDir[DiffLvl]))));
     }
     for (int i = Kits.Count - 1; i >= 0; i--) // Обновление и удаление пропущенных аптечек
     {
         Kits[i].Update();
         if (Kits[i].Pos.X + Kit.Img.Size.Width < 0)
         {
             Kits[i].Del(Kits, i);
         }
     }
 }
예제 #21
0
        public ActionResult Login(UserInfoView entityView)
        {
            if (ModelState.IsValid)
            {
                UserInfo entity = AutoEntityMap <UserInfoView, UserInfo> .EntityMap(entityView);

                string pwd = Kits.GetMD5(entity.UserPwd);
                bool   b   = UserInfoBLL.Where(c => c.UserName == entity.UserName && c.UserPwd == pwd).Any();
                if (b)
                {
                    Session[Keys.SessionKey] = entity.UserName;
                    return(RedirectToAction("Index", "Dashboard"));
                }
            }
            ModelState.AddModelError("", "用户名或密码错误");
            return(View());
        }
예제 #22
0
        public Task <IEnumerable <KitModel> > AllKitPatterns()
        {
            _kitPatterns ??= Kits
            .Select(kit => new KitModel
            {
                Title        = kit.Title,
                Manufacturer = kit.Manufacturer,
                Item         = kit.Item,
                Size         = kit.Size,
                ImageUrl     = kit.ImageUrl,
                HasXSD       = kit.HasXSD
            })
            .OrderBy(x => _random.Next())
            .ToArray();

            return(Task.FromResult(_kitPatterns));
        }
예제 #23
0
        /// <summary>
        /// 上传
        /// </summary>
        /// <param name="localPathfile">本地全路径文件名</param>
        /// <param name="version"></param>
        /// <param name="group"></param>
        /// <param name="remark"></param>
        public void Upload(string localPathfile, string version = "", int group = 0, string remark = "")
        {
            try
            {
                string tempPathfile = Kits.GetTempPathfile(Kits.GetFilename(localPathfile));
                ResourcePackage.Package(localPathfile, tempPathfile);

                UploadDataItem ud = new UploadDataItem()
                {
                    Source  = tempPathfile,
                    Target  = _dc.GetRemotePathfile(localPathfile),
                    Version = version,
                    Group   = group,
                    Remark  = remark,
                    Tag     = localPathfile
                };
                _dc.Add(ud);
            }
            catch (IOException ioe)
            {
                Notified?.Invoke(CVReSubmitResult.SourceNotFound, ioe.Message);
            }
        }
예제 #24
0
        /// <summary>
        /// 客户端实例
        /// </summary>
        /// <param name="ip">信息中心ip,应保证其合法性</param>
        /// <param name="port"></param>
        private Infocenter(string ip, int port, string user, string pwd)
        {
            _ip   = ip;
            _port = port;
            _user = user;
            _pwd  = pwd;

            if (string.IsNullOrEmpty(_ip) ||
                string.IsNullOrEmpty(_user) ||
                string.IsNullOrEmpty(_pwd) ||
                _port == 0
                )
            {
                Notified?.Invoke(CVResult.InfocenterParameterHappened, "服务器参数配置问题");
            }

            _connected = false;
            _remoteEP  = new IPEndPoint(IPAddress.Parse(ip), port);

            //本机特征
            _localIp   = Kits.GetIp();
            _localName = Environment.MachineName;
            Log.Added += AddLog;
        }
예제 #25
0
        private void _dc_Ended(IDataOpItem item)
        {
            if (item is UploadDataItem)
            {
                UploadDataItem udi = item as UploadDataItem;

                if (udi.Success)
                {
                    string source = udi.Tag as string;
                    string crc    = FileMD5.Create(udi.Source);
                    string name   = Kits.GetFilename(source);

                    string pathname = _dc.GetPathfileByRemotePathfile(udi.Target);

                    ResourceOp rop = OpFactory <ResourceOp> .Create(_ic);

                    rop.Add(pathname, name, udi.Group, 0, udi.Version, Kits.GetLastWriteTime(source), udi.Remark, "cvraddresource", crc);
                }
                else
                {
                    Notified?.Invoke(CVReSubmitResult.UploadFailed, udi.Message);
                }
            }
        }
예제 #26
0
 //**********************************************************************************************
 //**********************************************************************************************
 //   UTILITY PROCEDURES
 //**********************************************************************************************
 //**********************************************************************************************
 // a bit of funky c# overloading to convert item to string key
 string item_key(Kits k)
 {
     if (k == null || k == Kits.None) return "No kit key";
     try
     {
         return Enum.GetName(typeof(Kits), k);
     }
     catch { }
     return "No kit key";
 }
예제 #27
0
        public override IResultInfoDal CreateResultInfoDal()
        {
            string nspace = Kits.GetAppSettingsValue("dalFactory");

            return((IResultInfoDal)Kits.CreateObj(nspace, "ResultInfoDal"));
        }
예제 #28
0
 public Inventory(Kits kit)
 {
     this.Kit             = kit;
     this.Weapons         = new WeaponDictionary();
     this.Specializations = new SpecializationDictionary();
 }
예제 #29
0
 public Inventory(Kits kit)
 {
     this.Kit = kit;
     this.Weapons = new WeaponDictionary();
     this.Specializations = new SpecializationDictionary();
 }
예제 #30
0
        public override IDepartmentDal CreateDepartmentDal()
        {
            string nspace = Kits.GetAppSettingsValue("dalFactory");

            return((IDepartmentDal)Kits.CreateObj(nspace, "DepartmentDal"));
        }
예제 #31
0
        public override IeducationDal CreateeducationDal()
        {
            string nspace = Kits.GetAppSettingsValue("dalFactory");

            return((IeducationDal)Kits.CreateObj(nspace, "educationDal"));
        }
예제 #32
0
        public override IFamilyDal CreateFamilyDal()
        {
            string nspace = Kits.GetAppSettingsValue("dalFactory");

            return((IFamilyDal)Kits.CreateObj(nspace, "FamilyDal"));
        }
예제 #33
0
        public override ISourceDal CreateSourceDal()
        {
            string nspace = Kits.GetAppSettingsValue("dalFactory");

            return((ISourceDal)Kits.CreateObj(nspace, "SourceDal"));
        }
예제 #34
0
        public ActionResult Login(LoginInfo model)
        {
            try
            {
                //1.0 验证码检查
                string vcodeFromSession = string.Empty;
                if (Session[Keys.Vcode] != null)
                {
                    vcodeFromSession = Session[Keys.Vcode].ToString();
                }

                if (model.VCode.IsEmpty() ||
                    model.VCode.Equals(vcodeFromSession, StringComparison.OrdinalIgnoreCase) == false)
                {
                    return(WriteError("验证码错误,请重新输入"));
                }

                //2.0 验证用户名和密码的正确性
                string md5Pwd = Kits.MD5Entry(model.LoginPWD);

                if (model.LoginName.IsEmpty())
                {
                    return(WriteError("登录账号不能为空"));
                }

                if (model.LoginPWD.IsEmpty())
                {
                    return(WriteError("登录密码不能为空"));
                }

                var userinfo = userinfoSer.QueryWhere(c => c.uLoginName == model.LoginName &&
                                                      c.uLoginPWD == md5Pwd).FirstOrDefault();

                if (userinfo == null)
                {
                    return(WriteError("用户名或者密码错误,请重新输入"));
                }

                //3.0 将userinfo存入session中
                Session[Keys.uinfo] = userinfo;

                //4.0 判断model.isrememeber ==true 则应该写一个cookie存入到浏览器的硬盘中
                if (model.IsReMember)
                {
                    HttpCookie cookie = new HttpCookie(Keys.isremember, userinfo.uID.ToString());
                    //设置cookie的过期时间为3天
                    cookie.Expires = DateTime.Now.AddDays(3);

                    //添加到响应报文头中
                    Response.Cookies.Add(cookie);
                }
                else
                {
                    HttpCookie cookie = new HttpCookie(Keys.isremember, "");
                    //设置cookie的过期时间为3年前,一定过期
                    cookie.Expires = DateTime.Now.AddYears(-3);

                    //添加到响应报文头中
                    Response.Cookies.Add(cookie);
                }

                //5.0 将当前用户的权限按钮数据缓存起来
                //permissSer.GetPermissListByUid(userinfo.uID);

                return(WriteSuccess("登录成功,正在跳转到首页..."));
            }
            catch (Exception ex)
            {
                return(WriteError(ex));
            }
        }