Beispiel #1
0
    /// <summary>
    /// 完成任务方法
    /// </summary>
    /// <param name="taskID">任务id</param>
    void TaskDoneAsID(string taskID)
    {
        //任务表,需要服务器取到 taskTable
        yuan.YuanMemoryDB.YuanTable taskTable = new yuan.YuanMemoryDB.YuanTable("taskTable", "id");
        foreach (yuan.YuanMemoryDB.YuanRow rows in taskTable.Rows)
        {
            if (rows["id"].YuanColumnText == taskID)
            {
                MainTask task = new MainTask();
                task.taskName          = rows["TaskName"].YuanColumnText;
                task.taskType          = (MainTaskType)int.Parse(rows["TaskType"].YuanColumnText);
                task.id                = rows["id"].YuanColumnText;
                task.needType          = (MainTaskNeedType)int.Parse(rows["id"].YuanColumnText);
                task.needId            = rows["TaskNeedInfo"].YuanColumnText;
                task.leixing           = GetIntDBAsName("BranchType", 0, rows);
                task.jindu             = 0;
                task.RewardItemMaster  = getTaskReward(rows, task.RewardItemMaster, "RewardItemMaster");
                task.RewardItemSoldier = getTaskReward(rows, task.RewardItemSoldier, "RewardItemSoldier");
                task.RewardItemRobber  = getTaskReward(rows, task.RewardItemRobber, "RewardItemRobber");
                task.reward            = getTaskReward(rows, task.RewardItemRobber, "RewardItemMaster");
                task.doneType          = rows["ConditonInfo"].YuanColumnText;
                task.ExcludeTask       = rows["ExcludeTask"].YuanColumnText;
                if (task.taskType == (MainTaskType)4)
                {
                    task.doneItem = task.doneType.Substring(15, 7);
                }

                string itemid2;
                if (task.reward.itemId.Length > 4)
                {
                    itemid2 = task.reward.itemId.Substring(0, 2);
                    if (itemid2 == "88")
                    {
                        //道具id
                        //	task.reward.itemId;
                    }
                    else
                    if (itemid2 == "72")
                    {
                        //坐骑id
                        //task.reward.itemId;
                    }
                    else
                    {
                        //装备id
                        //	task.reward.itemId;
                        InRoom.GetInRoomInstantiate().SetSetPlayerBehavior(yuan.YuanPhoton.PlayerBehaviorType.GetItem, task.reward.itemId);
                    }
                }
                //经验值
                //task.reward.exp

                //增加的声望值,字段"Prestige"
                //20

                //金币
                //task.reward.gold

                //血石
                //task.reward.rank

                //角色表,需要服务器取到 playerTable
                yuan.YuanMemoryDB.YuanTable playerTable = new yuan.YuanMemoryDB.YuanTable("playerTable", "id");
                playerTable.Rows[0]["CompletTask"].YuanColumnText += taskID + ";";
                string[] strArray;
                string[] taskStrs;
                int      i;
                strArray = playerTable.Rows[0]["Task"].YuanColumnText.Split(';');
                for (i = 0; i < strArray.Length; i++)
                {
                    taskStrs = strArray[i].Split(',');
                    if (taskStrs.Length > 1 && taskStrs[0] == taskID)
                    {
                        strArray[i] = "";
                    }
                }
                for (i = 0; i < strArray.Length; i++)
                {
                    if (strArray[i] != "")
                    {
                        playerTable.Rows[0]["Task"].YuanColumnText += strArray[i] + ";";
                    }
                }
            }
        }
    }
Beispiel #2
0
 public PresenceServiceInitializer(Container container)
 {
     ServiceCore.configure(container);
     MainTask.configure();
 }
Beispiel #3
0
        private void ButtonRun_Click(object sender, EventArgs e)
        {
            MainTask task = new MainTask() { NeuroDirectory = TextBoxNeuroDirectory.Text };
            task.ImageLimit = (int)NumericUpDownImageLimit.Value;
            task.ParseMethod(ComboBoxMethod.Text);
            if (sender == ButtonRunTraining)
            {
                task.Type = MainTaskType.Training;
                task.Inputs = GetFiles(TextBoxInputDirectory.Text);
            }
            else if(sender == ButtonRunForecast)
            {
                task.Type = MainTaskType.Forecast;
                task.Inputs = GetFiles(TextBoxForecast.Text);
                task.Outputs.Add(TextBoxForecastOutput.Text);
            }
            Properties.Settings.Default.Save();
            if (task.Type == MainTaskType.None) return;

            EnableButtons(false);
            BackgroundWorkerMain.RunWorkerAsync(task);
        }
        public ActionResult Create(MainTask item, int[] ChuDe, int[] ChuDeVIP, string Type, HttpPostedFileBase Picture = null)
        {
            try
            {
                ChuDe         = ChuDe ?? new int[] { };
                ChuDeVIP      = ChuDeVIP ?? new int[] { };
                item.NgayDang = DateTime.Now;
                if (item.StartDate > item.FinishDate)
                {
                    return(Json(new { TT = 1, Value = "Ngày kết thúc không được nhỏ hơn ngày bắt đầu" }, JsonRequestBehavior.AllowGet));
                }
                var file = SubmitFile(new List <HttpPostedFileBase> {
                    Picture
                });
                if (file.Count > 0)
                {
                    item.Picture = file.FirstOrDefault();
                }

                if (Type == Common.ConstTrangThai.CongKhai)
                {
                    item.Status = Type;
                }
                else
                {
                    item.Status = Common.ConstTrangThai.RiengTu;
                }



                item.Page   = false;
                item.SeoUrl = Extentions.SeoUrl.SeoURL(item.TaskName);

                var nguoidung = (Planner2.Models.User)Session[Planner2.Controllers.LoginAuth.NameSession];

                string noidungmail = "";
                using (Models.Planner2Entities db = new Models.Planner2Entities())
                {
                    var ChudeDang = ChuDe.ToList();
                    ChudeDang.AddRange(ChuDeVIP.ToList());

                    double SoTienPhaiThanhToan = PhaiThanhToan(ChudeDang, item);

                    var nd = db.Users.Where(c => c.Id == nguoidung.Id).FirstOrDefault();
                    nd.SoTien = nd.SoTien ?? 0;
                    nd.SoTien = nd.SoTien.Value - (int)SoTienPhaiThanhToan;
                    if (nd.SoTien < 0)
                    {
                        var dtr = "Bạn không đủ tiền để mua chuyên mục đăng bài";
                        return(Json(new { TT = 1, Value = dtr }, JsonRequestBehavior.AllowGet));
                    }
                    db.SaveChanges();
                    Session[Planner2.Controllers.LoginAuth.NameSession] = nd;


                    if (db.MainTasks.Where(v => v.SeoUrl == item.SeoUrl && v.Id != item.Id).Count() > 0)
                    {
                        return(Json(new { TT = 1, Value = "Tên tiêu đề đã tồn tại, không thể thêm được tiêu đề giống nhau" }, JsonRequestBehavior.AllowGet));
                    }


                    if (item.Id != 0)
                    {
                        var task = db.MainTasks.Where(z => z.Id == item.Id).FirstOrDefault();

                        // clone task để phục vụ so sánh thay đổi
                        var TaskBK = Models.CompareClass.Clone <MainTask>(task);


                        task.TinMuaBan          = item.TinMuaBan;
                        task.TaskName           = item.TaskName;
                        task.Description        = item.Description;
                        task.KhuVuc_TP          = item.KhuVuc_TP;
                        task.KhuVuc_Xa          = item.KhuVuc_Xa;
                        task.KhuVuc_Huyen       = item.KhuVuc_Huyen;
                        task.NgayDang           = item.NgayDang;
                        task.Gia                = item.Gia;
                        task.StartDate          = item.StartDate;
                        task.FinishDate         = item.FinishDate;
                        task.SeoUrl             = item.SeoUrl;
                        task.TyGia              = item.TyGia;
                        task.Map_LoaiBatDongSan = item.Map_LoaiBatDongSan;
                        task.Map_Huong          = item.Map_Huong;
                        task.Map_SoPhongNgu     = item.Map_SoPhongNgu;
                        task.Map_DuAn           = item.Map_DuAn;
                        task.Map_TenLienLac     = item.Map_TenLienLac;
                        task.DienTich           = item.DienTich;
                        task.Map_Zalo           = item.Map_Zalo;
                        task.Map_DienThoai      = item.Map_DienThoai;
                        task.Map_Skyper         = item.Map_Skyper;
                        task.Page               = item.Page;
                        task.Status             = item.Status;
                        task.Map_Email          = item.Map_Email;
                        task.NgayDang           = item.NgayDang;
                        task.Youtube            = item.Youtube;
                        if (!string.IsNullOrEmpty(item.Picture))
                        {
                            task.Picture = item.Picture;
                        }
                        task.CategoryList = task.CategoryList + "," + string.Join(",", ChuDeVIP);
                        // kiểm tra sự thay đổi
                        var Change = Models.CompareClass.ClassWithClassToTableHTML <MainTask>(TaskBK, task);
                        if (Change != null)
                        {
                            db.SaveChanges();



                            string process = nguoidung.StaffID + " - " + nguoidung.StaffName + " đã sửa đổi, bổ sung dữ liệu dữ liệu.";
                            noidungmail = process + Change;


                            // Thêm lịch sử
                            AddHistory(item.Id, noidungmail, process);
                            // Gửi mail
                            SendMainTask(item.Id, noidungmail);
                        }
                    }
                    if (item.Id == 0)
                    {
                        // thêm phòng ban vào đầu mã dữ liệu
                        if (string.IsNullOrEmpty(item.Picture))
                        {
                            item.Picture = "https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1280px-No_image_3x4.svg.png";
                        }
                        item.XetDuyet = 0;
                        if (nguoidung.SupperAdmin == 1)
                        {
                            item.XetDuyet = 1;
                        }
                        item.CategoryList = string.Join(",", ChuDeVIP);

                        item.Created      = DateTime.Now;
                        item.CreatedBy    = nguoidung.UserName;
                        item.AttendPerson = nguoidung.UserName;


                        db.MainTasks.Add(item);
                        db.SaveChanges();


                        noidungmail = nguoidung.StaffID + "-" + nguoidung.StaffName + " đã tạo mới dữ liệu." + TrangThaiTask(item);
                        // Thêm lịch sử
                        AddHistory(item.Id, noidungmail);
                        // Gửi mail
                        SendMainTask(item.Id, noidungmail);
                    }
                    db.MainTask_ChuDe.RemoveRange(db.MainTask_ChuDe.Where(v => v.TaskID == item.Id));
                    foreach (var it in ChuDe)
                    {
                        MainTask_ChuDe mcd = new MainTask_ChuDe();
                        mcd.TaskID        = item.Id;
                        mcd.CategoryRowID = it;
                        db.MainTask_ChuDe.Add(mcd);
                    }
                    foreach (var it in ChuDeVIP)
                    {
                        MainTask_ChuDe mcd = new MainTask_ChuDe();
                        mcd.TaskID        = item.Id;
                        mcd.CategoryRowID = it;
                        db.MainTask_ChuDe.Add(mcd);
                    }
                    item.UuTien = ChuDeVIP.Count();
                    db.SaveChanges();

                    SubmitFile(Request.Files, "MainTask", "FileDinhKem", item.Id);


                    return(Json(new { TT = 0, Value = item.Id }, JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception ex)
            {
                return(Json(new { TT = 1, Value = "Lỗi, vui lòng kiểm tra lại \n" + ex.ToString() }, JsonRequestBehavior.AllowGet));
            }
        }
Beispiel #5
0
        static void Main(string[] args)
        {
            var     openGUI = true;
            Version version = new Version();

            // Review & parse command line arguments

            if (args != null && args.Length > 0)
            {
                #region Parse Arguments
                foreach (string arg in args)
                {
                    #region Argument -nogui
                    if (arg.Contains("-nogui"))
                    {
                        openGUI = false;
                        Profile selectedProfile = new Profile();
                        Logger.ColoredConsoleWrite(ConsoleColor.Cyan, "Argument: -nogui");
                        if (!arg.Contains(":")) // Load Default Profile
                        {
                            #region Read bot settings
                            if (File.Exists(GlobalVars.FileForProfiles))
                            {
                                var Profiles = Newtonsoft.Json.JsonConvert.DeserializeObject <Collection <Profile> >(File.ReadAllText(GlobalVars.FileForProfiles));
                                foreach (Profile _profile in Profiles)
                                {
                                    if (_profile.IsDefault)
                                    {
                                        selectedProfile = _profile;
                                        break;
                                    }
                                }
                                if (selectedProfile != null)
                                {
                                    GlobalVars.ProfileName   = selectedProfile.ProfileName;
                                    selectedProfile.Settings = ProfileSettings.LoadFromFile(Path.Combine(GlobalVars.PathToConfigs, $"{selectedProfile.ProfileName}.json"));
                                    selectedProfile.Settings.SaveToGlobals();
                                }
                                else
                                {
                                    Logger.ColoredConsoleWrite(ConsoleColor.Red, "Default Profile not found! You didn't setup the bot correctly by running it with -nogui.");
                                    Environment.Exit(-1);
                                }
                            }
                            else
                            {
                                Logger.ColoredConsoleWrite(ConsoleColor.Red, "You have not setup the bot yet. Run it without -nogui to Configure.");
                                Environment.Exit(-1);
                            }
                        }
                        else // Load selected profile
                        {
                            var givenProfile = arg.Split(':');
                            if (File.Exists(Path.Combine(GlobalVars.PathToConfigs, givenProfile[1] + ".json")))
                            {
                                selectedProfile.ProfileName = givenProfile[1];
                                GlobalVars.ProfileName      = selectedProfile.ProfileName;
                                selectedProfile.Settings    = ProfileSettings.LoadFromFile(Path.Combine(GlobalVars.PathToConfigs, givenProfile[1] + ".json"));
                                selectedProfile.Settings.SaveToGlobals();
                            }
                            else
                            {
                                Logger.ColoredConsoleWrite(ConsoleColor.Red, "Profile not found! You didn't setup the bot correctly by running it with -nogui.");
                                Environment.Exit(-1);
                            }
                        }

                        Logger.ColoredConsoleWrite(ConsoleColor.Cyan, "Argument: profile. Using " + GlobalVars.ProfileName + ". Check logs in this profile log folder.");
                        CheckLogDirectories(Path.Combine(GlobalVars.PathToLogs, GlobalVars.ProfileName));

                        if (GlobalVars.UsePwdEncryption)
                        {
                            GlobalVars.Password = Encryption.Decrypt(GlobalVars.Password);
                        }
                        #endregion
                    }
                    #endregion

                    #region Argument Coordinates
                    if (arg.Contains(","))
                    {
                        if (File.Exists(GlobalVars.FileForCoordinates))
                        {
                            Logger.ColoredConsoleWrite(ConsoleColor.Yellow, "Last coords file exists, trying to delete it");
                            File.Delete(GlobalVars.FileForCoordinates);
                        }

                        string[] crdParts = arg.Split(',');
                        GlobalVars.latitude  = double.Parse(crdParts[0].Replace(',', '.'), ConfigWindow.cords, System.Globalization.NumberFormatInfo.InvariantInfo);
                        GlobalVars.longitude = double.Parse(crdParts[1].Replace(',', '.'), ConfigWindow.cords, System.Globalization.NumberFormatInfo.InvariantInfo);
                        Logger.ColoredConsoleWrite(ConsoleColor.Cyan, $"Argument: coordinates. Starting at: {GlobalVars.latitude},{GlobalVars.longitude},{GlobalVars.altitude}");
                        //we assume -nogui
                        openGUI = false;
                    }
                    #endregion

                    #region Argument -bypassversioncheck
                    GlobalVars.BypassCheckCompatibilityVersion |= arg.ToLower().Contains("-bypassversioncheck");
                    #endregion

                    #region Argument -bypasskillswitch
                    GlobalVars.BypassKillSwitch |= arg.ToLower().Contains("-bypasskillswitch");
                    #endregion

                    #region Argument -help
                    if (arg.ToLower().Contains("-help"))
                    {
                        //Show Help
                        System.Console.WriteLine($"Pokemon BOT C# v{Resources.BotVersion.ToString()} help" + Environment.NewLine);
                        System.Console.WriteLine("Use:");
                        System.Console.WriteLine("  -nogui<:profile_name> <lat>,<long>         Console mode only, starting on the indicated Profile , Latitude & Longitude ");
                        System.Console.WriteLine("  -bypassversioncheck         Do NOT check BOT & API compatibility (be careful with that option!)");
                        System.Console.WriteLine("  -bypasskillswitch           Do NOT check the forced bot stop (this assures a more than probable ban of your account)");
                        System.Console.WriteLine("  -help                       This help" + Environment.NewLine);
                        Environment.Exit(0);
                    }
                    #endregion
                }
            }
            #endregion

            // Checking if current BOT API implementation supports NIANTIC current API (unless there's an override command line switch)
            var currentAPIVersion = new CurrentAPIVersion();
            Logger.ColoredConsoleWrite(ConsoleColor.DarkCyan, "_____________________________________________________________");
            Logger.ColoredConsoleWrite(ConsoleColor.White, "Attention: NO BOT IS SAFE - YOUR ACCOUNT MIGHT BE BANNED !!!");
            Logger.ColoredConsoleWrite(ConsoleColor.Gray, "----- You have been warned => Your decision, your risk -----");
            Logger.ColoredConsoleWrite(ConsoleColor.DarkCyan, "_____________________________________________________________");
            Logger.ColoredConsoleWrite(ConsoleColor.Gray, $"             Supported API version: {Resources.BotApiSupportedVersion}");
            Logger.ColoredConsoleWrite(ConsoleColor.Gray, $"              Current API version: {currentAPIVersion.GetNianticAPIVersion()}");
            Logger.ColoredConsoleWrite(ConsoleColor.DarkCyan, $"_____________________________________________________v{Resources.BotVersion}");

            Resources.SetApiVars(currentAPIVersion.GetNianticAPIVersion());
            // Check if a new version of BOT is available
            CheckForNewBotVersion();

            if (!GlobalVars.BypassCheckCompatibilityVersion)
            {
                bool CurrentVersionsOK = currentAPIVersion.CheckAPIVersionCompatibility(GlobalVars.BotApiSupportedVersion);
                if (!CurrentVersionsOK)
                {
                    Logger.ColoredConsoleWrite(ConsoleColor.Red, $"Atention, current API version is new and still not supported by Bot.");
                    Logger.ColoredConsoleWrite(ConsoleColor.Red, $"Bot will now exit to keep your account safe.");
                    Logger.ColoredConsoleWrite(ConsoleColor.Red, $"---------- PRESS ANY KEY TO CLOSE ----------");

                    Console.ReadKey();
                    Environment.Exit(-1);
                }
            }

            // Check if Bot is deactivated at server level
            if (!GlobalVars.BypassKillSwitch)
            {
                StringUtils.CheckKillSwitch();
            }

            if (openGUI)
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new ConfigWindow());

                Task.Run(() =>
                {
                    new Panels.SplashScreen().ShowDialog();
                });
                openGUI = GlobalVars.EnablePokeList;
                if (GlobalVars.EnableConsoleInTab)
                {
                    Logger.type = 1;
                }
                // To open tabbed GUI to test programing

                /*
                 * TabbedSystem.skipReadyToUse = true;
                 * Application.Run( new TabbedSystem());
                 * Environment.Exit(0);
                 */
            }

            SleepHelper.PreventSleep();

            // Ensure all log paths exists
            CheckLogDirectories(Path.Combine(GlobalVars.PathToLogs, GlobalVars.ProfileName));

            GlobalVars.infoObservable.HandleNewHuntStats += SaveHuntStats;

            Task MainTask;

            MainTask = Task.Run(() =>
            {
                do
                {
                    try
                    {
                        DeviceSetup.SelectDevice(GlobalVars.DeviceTradeName, GlobalVars.DeviceID, GlobalVars.FileForDeviceData);
                        new Logic.Logic(new Settings(), GlobalVars.infoObservable).Execute();
                    }
                    catch (Exception ex)
                    {
                        Logger.Error($"Unhandled exception: {ex}");
                    }
                    Logger.Error("Restarting in 20 Seconds.");
                    Thread.Sleep(20000);
                }while (Logic.Logic.restartLogic);
            });

            if (openGUI)
            {
                if (GlobalVars.simulatedPGO)
                {
                    Application.Run(new GameAspectSimulator());
                }
                else
                {
                    if (GlobalVars.EnableConsoleInTab)
                    {
                        FreeConsole();
                    }
                    Application.Run(new TabbedSystem());
                }
            }

            MainTask.Wait();

            SleepHelper.AllowSleep();
        }
Beispiel #6
0
 public async Task <IActionResult> Update(Int32 id, [FromBody] MainTask model)
 {
     return(this.Ok("TaskController.Update(id, model)"));
 }
Beispiel #7
0
 public TaskObject(MainTask task, ObservableCollection <TaskObject> taskObjects)
 {
     Task     = task;
     SubTasks = taskObjects;
 }
        public ActionResult Search(MainTask item, string key, string DienTich, int?page, string sort)
        {
            ViewBag.LEFTHIDEN = true;

            IQueryable <MainTask> data;
            List <MainTask>       Localdata;

            using (Models.Planner2Entities db = new Planner2Entities())
            {
                int pageNumber = (page ?? 1);
                int pageSize   = 10;
                if (pageNumber != -1 && Session["dataSearch"] != null)
                {
                    Localdata = (List <MainTask>)Session["dataSearch"];
                    goto End;
                }
                pageNumber = 1;

                var date = DateTime.Now.Date;

                data = db.MainTasks
                       .Where(v => v.FinishDate >= date && v.StartDate <= date).
                       Where(v => v.Page == false && v.Status == Common.ConstTrangThai.CongKhai);
                if (!string.IsNullOrEmpty(key))
                {
                    data = data.Where(z => z.TaskName != null && z.TaskName.ToUpper().Contains(key.ToUpper()));
                }

                if (!string.IsNullOrEmpty(item.Map_LoaiBatDongSan))
                {
                    data = data.Where(z => z.Map_LoaiBatDongSan == item.Map_LoaiBatDongSan);
                }

                if (item.KhuVuc_TP.HasValue)
                {
                    data = data.Where(z => z.KhuVuc_TP == item.KhuVuc_TP);
                }


                if (item.KhuVuc_Huyen.HasValue)
                {
                    data = data.Where(z => z.KhuVuc_Huyen == item.KhuVuc_Huyen);
                }

                if (item.KhuVuc_Xa.HasValue)
                {
                    data = data.Where(z => z.KhuVuc_Xa == item.KhuVuc_Xa);
                }

                // dien tich
                if (!string.IsNullOrEmpty(DienTich))
                {
                    int start = 0;
                    int end   = 0;
                    int.TryParse(DienTich.Split('-').FirstOrDefault(), out start);
                    int.TryParse(DienTich.Split('-').LastOrDefault(), out end);
                    if (start != 0)
                    {
                        data = data.Where(z => z.DienTich >= start);
                    }

                    if (end != 0)
                    {
                        data = data.Where(z => z.DienTich <= end);
                    }
                }

                // muc gia
                if (item.Gia.HasValue)
                {
                    switch (item.Gia)
                    {
                    case 1: data = data.Where(z => z.Gia == null || z.Gia == 0); break;

                    case 2: data = data.Where(z => z.Gia < 500 && z.TyGia == Planner2.Common.ConstVal.TrieuDong); break;

                    case 3: data = data.Where(z => z.Gia >= 500 && z.Gia < 1000 && z.TyGia == Planner2.Common.ConstVal.TrieuDong); break;

                    case 4: data = data.Where(z => z.Gia >= 1 && z.Gia < 3 && z.TyGia == Planner2.Common.ConstVal.TyDong); break;

                    case 5: data = data.Where(z => z.Gia >= 3 && z.Gia < 5 && z.TyGia == Planner2.Common.ConstVal.TyDong); break;

                    case 6: data = data.Where(z => z.Gia >= 5); break;
                    }
                }


                if (!string.IsNullOrEmpty(item.Map_Huong))
                {
                    data = data.Where(z => z.Map_Huong == item.Map_Huong);
                }

                if (item.Map_SoPhongNgu.HasValue)
                {
                    data = data.Where(z => z.Map_SoPhongNgu >= item.Map_SoPhongNgu);
                }

                if (!string.IsNullOrEmpty(item.Map_DuAn))
                {
                    data = data.Where(z => z.Map_DuAn == item.Map_DuAn);
                }


                Localdata             = data.ToList();
                Session["dataSearch"] = Localdata;


                End : ViewBag.sort   = sort;
                ViewBag.page         = page;
                ViewBag.key          = key;
                ViewBag.DienTich     = DienTich;
                ViewBag.itemSearch   = item;
                ViewBag.action       = "Search";
                ViewBag.KhuVuc_TP    = db.ThanhPhoes.Where(v => v.MaThanhPho == item.KhuVuc_TP).Select(z => z.TenThanhPho).FirstOrDefault();
                ViewBag.KhuVuc_Huyen = db.ThanhPhoes.Where(v => v.MaThanhPho == item.KhuVuc_Huyen).Select(z => z.QuanHuyen).FirstOrDefault();
                ViewBag.KhuVuc_Xa    = db.ThanhPhoes.Where(v => v.MaThanhPho == item.KhuVuc_Xa).Select(z => z.PhuongXa).FirstOrDefault();

                ViewBag.TitleChuDe = "Kết quả tìm kiếm";
                Localdata          = SortGrid(Localdata, sort);
                return(View(Localdata.ToPagedList(pageNumber, pageSize)));
            }
        }
 public void Insert(MainTask mainTask)
 {
     _db.MainTasks.Add(mainTask);
 }
Beispiel #10
0
 public async Task <MainTask> Update(MainTask model)
 {
     return(await this.repositories.Update(model));
 }
 public string TrangThaiTask(MainTask task)
 {
     return(task.Status);
 }
 public string CheckTrangThai(MainTask task)
 {
     return(task.Status);
 }
        public List <string> GetPeopleOfTask(MainTask task)
        {
            List <string> People = (task.AttendPerson + "").Split(',').Where(v => !string.IsNullOrEmpty(v)).ToList();

            return(People);
        }
Beispiel #14
0
 public bool Add(MainTask mainTask)
 {
     return(_mainTaskRepository.Add(mainTask) > 0);
 }
Beispiel #15
0
 public bool Update(MainTask mainTask)
 {
     return(_mainTaskService.Update(mainTask));
 }
Beispiel #16
0
 public bool Update(MainTask mainTask)
 {
     return(_mainTaskRepository.Update(mainTask) > 0);
 }
Beispiel #17
0
 private void backgroundTaskWorker_DoWork(object sender, DoWorkEventArgs e)
 {
     BackgroundWorker worker = sender as BackgroundWorker;
     WorkerArguments taskArguments = (WorkerArguments)e.Argument;
     lastScheduledTask = taskArguments.scheduledTask;
     if (taskArguments.scheduledTask == MainTask.OpenDirectory) {
         bool clear = (bool) taskArguments.taskArgs[0];
         DataGenerator.UpdateList(clear, worker, e);
     } else if (taskArguments.scheduledTask == MainTask.DownloadData) {
         DataGenerator.GetAllTitles(worker, e);
     } else if (taskArguments.scheduledTask == MainTask.CreateRelations) {
         DataGenerator.GetAllRelations(worker, e);
     } else if (taskArguments.scheduledTask == MainTask.Rename) {
         MediaFileManager.Instance.Rename(worker, e);
     }
 }
Beispiel #18
0
        public List <Package> GetAllowedPackagesForMainTask(MainTask iMainTask)
        {
            var result = new List <Package>();

            var affectedPackageIsLocked = false;

            if (iMainTask != null)
            {
                //Package déjà affecté à la tâche
                var originalMainTask = GetMainTaskById(iMainTask.MainTaskId, GranularityEnum.Nude);
                if (originalMainTask.PackageId != null)
                {
                    var affectedPackage = GetPackageById((long)originalMainTask.PackageId, GranularityEnum.Full);
                    result.Add(affectedPackage);
                    if (affectedPackage.IsLocked)
                    {
                        affectedPackageIsLocked = true;
                    }
                }
            }

            if (affectedPackageIsLocked)
            {
                //Retourne seulement le package affecté locké
                return(result);
            }
            else
            {
                //Récupération des packages non ouvert déverrouillé
                var unopenUnlockPackages = DBReleaseDataService.GetQuery <T_E_Package>(null).Where(x => !x.IsLocked && x.StatusRef == (short)PackageStatusEnum.Waiting).Enum().ToList().Select(x => GetPackageById(x.PackageId, GranularityEnum.Full)).Enum().ToList();
                result.AddRange(unopenUnlockPackages.Enum());
            }

            if (iMainTask != null)
            {
                //Récupération des packages ouvert déverrouillé
                var openUnlockPackages = DBReleaseDataService.GetQuery <T_E_Package>(null).Where(x => !x.IsLocked && x.StatusRef == (short)PackageStatusEnum.Developpement).Enum().ToList().Select(x => GetPackageById(x.PackageId, GranularityEnum.Full)).Enum().ToList();

                //Garde les packages ouvert dont les projets sont commun
                var packageWithCommonProject = new List <Package>();
                foreach (var item in openUnlockPackages.Enum())
                {
                    if (item.SubTasks.Exists(x => iMainTask.SubTasks.Exists(y => y.ProjectGUID == x.ProjectGUID)))
                    {
                        packageWithCommonProject.Add(item);
                    }
                }

                //Si un seul projet alors seule solution
                if (packageWithCommonProject.Count == 1)
                {
                    result.Add(packageWithCommonProject.Single());
                }
                //Si aucun package de projet en commun alors tous les projets sont possibles
                else if (packageWithCommonProject.Count == 0)
                {
                    result.AddRange(openUnlockPackages.Enum());
                }
            }
            else
            {
                var openUnlockPackages = DBReleaseDataService.GetQuery <T_E_Package>(null).Where(x => !x.IsLocked && x.StatusRef == (short)PackageStatusEnum.Developpement).Enum().ToList().Select(x => GetPackageById(x.PackageId, GranularityEnum.Full)).Enum().ToList();
                result.AddRange(openUnlockPackages.Enum());
            }

            //Suppression des doublons
            return(result.Enum().GroupBy(x => x.PackageId).Select(x => x.First()).ToList());
        }
 private void UpdateMainTask(MainTask iMainTask)
 {
     DisplayEditMainTaskMode();
     this.ucMainTaskEdit.EditMainTask(iMainTask);
 }
Beispiel #20
0
 public async Task <IActionResult> Create([FromBody] MainTask model)
 {
     return(this.Ok("TaskController.Create(model)"));
 }
 private void MainTaskSelected(MainTask iMainTask)
 {
     ucMainTaskEdit.Show();
     ucMainTaskEdit.EditMainTask(iMainTask);
     ucSubTaskManager.LoadControl(iMainTask);
 }
        public JsonResult CreateTask([FromBody] MainTask taskDetails)
        {
            var json = taskDetails;

            return(null);
        }
 private void CreateSubTask(MainTask iMainTask)
 {
     DisplayEditSubTaskMode();
     ucSubTaskEdit.Visible = true;
     this.ucSubTaskEdit.CreateProjectTask(iMainTask);
 }
        public long AddMainTask(MainTask iMainTask)
        {
            if (iMainTask == null)
            {
                throw new Exception("La tâche principale est null");
            }

            if (iMainTask.TaskType == MainTaskTypeEnum.ProjectDeveloppement && iMainTask.ExternalProjectId == null)
            {
                throw new Exception("Une tâche de type projet requiert un numéro de projet");
            }

            if (iMainTask.Status != MainTaskStatusEnum.Requested &&
                iMainTask.Status != MainTaskStatusEnum.Waiting)
            {
                throw new Exception("Le statut ne permet pas la création de la tâche");
            }

            if (iMainTask.Status == MainTaskStatusEnum.Requested && iMainTask.PackageId != null)
            {
                throw new Exception("Le statut requested ne permet l'attachement à un package");
            }

            long newMainTaskId = 0;

            using (var ts = new TransactionScope())
            {
                if (iMainTask.PackageId != null)
                {
                    var affectedPackage = GetPackageById((long)iMainTask.PackageId, GranularityEnum.Nude);
                    if (affectedPackage.Status == PackageStatusEnum.Developpement)
                    {
                        iMainTask.Status     = MainTaskStatusEnum.Dev;
                        iMainTask.OpenedDate = DateTime.Now;
                    }
                    else if (affectedPackage.Status == PackageStatusEnum.Canceled ||
                             affectedPackage.Status == PackageStatusEnum.Production ||
                             affectedPackage.Status == PackageStatusEnum.Staging)
                    {
                        throw new Exception("Il n'est pas possible d'affecter une tâche au package avec ce status");
                    }
                    else if (affectedPackage.Status == PackageStatusEnum.Waiting)
                    {
                        //ne rien faire
                    }
                    else
                    {
                        throw new Exception(affectedPackage.Status.ToStringWithEnumName());
                    }
                }

                var entity = new T_E_MainTask();
                entity.Merge(iMainTask);
                newMainTaskId = DBReleaseDataService.AddMainTask(entity);

                //SubTask
                foreach (var subTaskItem in iMainTask.SubTasks.Enum())
                {
                    subTaskItem.MainTaskId = newMainTaskId;
                    AddSubTask(subTaskItem);
                }

                //ProductLine
                foreach (var productLineItem in iMainTask.ProductLines.Enum())
                {
                    var productLineTaskEntity = new T_E_ProductLineTask();
                    productLineTaskEntity.ProductLineTaskId = -1;
                    productLineTaskEntity.MainTaskId        = newMainTaskId;
                    productLineTaskEntity.ProductLineId     = productLineItem.ProductLineId;
                    DBProductDataService.Add <T_E_ProductLineTask>(productLineTaskEntity);
                }

                ts.Complete();
            }
            return(newMainTaskId);
        }
        public ActionResult GetPhaiThanhToan(List <int> ThanhToan, MainTask item)
        {
            var st = PhaiThanhToan(ThanhToan, item);

            return(Json(st.ToString("#,####"), JsonRequestBehavior.AllowGet));
        }