Ejemplo n.º 1
0
 public HomeController(ILogger <HomeController> logger, AferogluDbContext context, IHttpContextAccessor httpContextAccessor)
 {
     _logger              = logger;
     _context             = context;
     _httpContextAccessor = httpContextAccessor;
     MainHelper.TryToSetLang(_httpContextAccessor);
 }
Ejemplo n.º 2
0
        public MainPageViewModel(INavigationService navigationService,
                                 IPageDialogService dialogService)
        {
            _navigationService = navigationService;
            _dialogService     = dialogService;

            GoPage1Command = new DelegateCommand(() =>
            {
                var fooPara = new NavigationParameters();
                fooPara.Add("MyData", "Come from MainPage");
                _navigationService.NavigateAsync("Page1Page", fooPara);
            });
            GoDeepCommand = new DelegateCommand(() =>
            {
                var fooPara1 = new NavigationParameters();
                fooPara1.Add("MyData", "Come from MainPage - Page1");
                var fooPara2 = new NavigationParameters();
                fooPara2.Add("MyData", "Come from MainPage - Page2");
                _navigationService.NavigateAsync($"Page1Page{fooPara1}/Page2Page{fooPara2}");
            });
            ResetLogCommand = new DelegateCommand(() =>
            {
                MainHelper.NavigationLogs = "";
            });
            ShowLogCommand = new DelegateCommand(async() =>
            {
                await MainHelper.ShowLog(_dialogService);
            });
        }
Ejemplo n.º 3
0
        public ActionResult AddServicePhoto(IEnumerable <HttpPostedFileBase> Photo, int Id)
        {
            CheckConnection();
            foreach (var item in Photo)
            {
                if (item != null)
                {
                    string name = MainHelper.Random32();
                    db.ServicesPhotoes.Add(new ServicesPhoto()
                    {
                        TourID = Id,
                        Photo  = "/images/ServiceSlider/" + name + ".jpeg",
                    });
                    using (var newimage = ScaleImage(Image.FromStream(item.InputStream, true, true), 1000, 1000))
                    {
                        string path = Server.MapPath("/images/ServiceSlider/" + name + ".jpeg");

                        newimage.Save(path, ImageFormat.Jpeg);
                    }
                    db.SaveChanges();
                }
            }
            TempData["Success"] = "წარმატებით დაემატა სლაიდერის ფოტოები";
            return(RedirectToAction("ChangeAddedService", new { id = Id }));
        }
Ejemplo n.º 4
0
        public ActionResult ChangeSliderText(TourModel model, HttpPostedFileBase Photo, int id)
        {
            CheckConnection();
            if (Photo != null)
            {
                string Pname    = db.Sliders.Where(x => x.Id == id).FirstOrDefault().Photo;
                string fullpath = Request.MapPath(Pname);
                if (System.IO.File.Exists(fullpath))
                {
                    System.IO.File.Delete(fullpath);
                }
                var    NewPhoto = db.Sliders.Where(x => x.Id == id).FirstOrDefault();
                string name     = MainHelper.Random32();
                NewPhoto.Photo = "/images/Slider/" + name + ".jpeg";
                using (var newimage = ScaleImage(Image.FromStream(Photo.InputStream, true, true), 2000, 2000))
                {
                    string path = Server.MapPath("/images/Slider/" + name + ".jpeg");

                    newimage.Save(path, ImageFormat.Jpeg);
                }
                db.SaveChanges();
            }
            var eng = db.SliderTranslateds.Where(x => x.SliderID == id && x.LangCode == "en-US").FirstOrDefault();

            eng.Text = model.TextEng;
            var rus = db.SliderTranslateds.Where(x => x.SliderID == id && x.LangCode == "ru-RU").FirstOrDefault();

            rus.Text = model.TextRus;
            var geo = db.SliderTranslateds.Where(x => x.SliderID == id && x.LangCode == "ka-GE").FirstOrDefault();

            geo.Text = model.TextGeo;
            db.SaveChanges();
            TempData["Success"] = "წარმატებით შეიცვალა";
            return(RedirectToAction("MainPage"));
        }
Ejemplo n.º 5
0
        public MainPageViewModel(INavigationService navigationService,
                                 IPageDialogService dialogService)
        {
            _navigationService = navigationService;

            _dialogService = dialogService;

            AppearingCommand = new DelegateCommand(() =>
            {
                MainHelper.WriteLog($"MainPage Appearing");
            });
            DisappearingCommand = new DelegateCommand(() =>
            {
                MainHelper.WriteLog($"MainPage Disappearing");
            });
            GoPage1Command = new DelegateCommand(() =>
            {
                _navigationService.NavigateAsync("Page1Page");
            });
            ResetLogCommand = new DelegateCommand(() =>
            {
                MainHelper.NavigationLogs = "";
            });
            ShowLogCommand = new DelegateCommand(async() =>
            {
                await MainHelper.ShowLog(_dialogService);
            });
        }
Ejemplo n.º 6
0
        static void Main(string[] args)
        {
            //此处填写购买得到的 MQTT 接入点域名
            String brokerUrl = ConfigurationManager.AppSettings["Mqtt_BrokerUrl"];
            //此处填写阿里云帐号 AccessKey
            String accessKey = ConfigurationManager.AppSettings["Mqtt_AccessKey"];
            //此处填写阿里云帐号 SecretKey
            String secretKey = ConfigurationManager.AppSettings["Mqtt_SecretKey"];
            //此处填写在 MQ 控制台创建的 Topic,作为 MQTT 的一级 Topic
            String parentTopic = ConfigurationManager.AppSettings["Mqtt_ParentTopic"];
            //此处填写客户端 ClientId,需要保证全局唯一,其中前缀部分即 GroupId 需要先在 MQ 控制台创建
            String     clientId = ConfigurationManager.AppSettings["Mqtt_GroupId"] + "@@@" + MainHelper.GetRandomString(16, true, true, true, false, "crm");
            MqttClient client   = new MqttClient(brokerUrl);

            client.MqttMsgPublishReceived += client_recvMsg;
            client.MqttMsgPublished       += client_publishSuccess;
            client.ConnectionClosed       += client_connectLose;
            String userName = accessKey;
            //计算签名
            String passWord = MainHelper.HMACSHA1(secretKey, clientId.Split('@')[0]);

            client.Connect(clientId, userName, passWord, true, 60);
            //订阅 Topic,支持多个 Topic,以及多级 Topic
            //string[] subTopicArray = { parentTopic + "/subDemo1", parentTopic + "/subDemo2/level3" };
            string[] subTopicArray = { parentTopic + "/School/", parentTopic + "/School/Sub1" };
            byte[]   qosLevels     = { MqttMsgBase.QOS_LEVEL_AT_MOST_ONCE, MqttMsgBase.QOS_LEVEL_AT_MOST_ONCE };
            client.Subscribe(subTopicArray, qosLevels);
            Console.WriteLine(DateTime.Now.ToString() + " 开始接收消息队列信息!");
            LogHelper.WriteProgramLog(DateTime.Now.ToString() + " 开始接收消息队列信息!");
            //client.Publish(parentTopic + "/School/", Encoding.UTF8.GetBytes("接收成功!"), MqttMsgBase.QOS_LEVEL_AT_LEAST_ONCE, false);
            ////发送 P2P 消息,二级 topic 必须是 p2p,三级 topic 是接收客户端的 clientId
            //client.Publish(parentTopic + "/p2p/" + clientId, Encoding.UTF8.GetBytes("hello mqtt"), MqttMsgBase.QOS_LEVEL_AT_LEAST_ONCE, false);
            //System.Threading.Thread.Sleep(50000);
            //client.Disconnect();
        }
Ejemplo n.º 7
0
        public Page1PageViewModel(INavigationService navigationService,
                                  IPageDialogService dialogService)
        {
            _navigationService = navigationService;

            _dialogService = dialogService;
            GoPage2Command = new DelegateCommand(() =>
            {
                var fooPara = new NavigationParameters();
                fooPara.Add("MyData", "Come from Page1");
                _navigationService.NavigateAsync("Page2Page", fooPara);
            });
            GoBackMainPageCommand = new DelegateCommand(() =>
            {
                _navigationService.GoBackAsync();
            });
            ResetLogCommand = new DelegateCommand(() =>
            {
                MainHelper.NavigationLogs = "";
            });
            ShowLogCommand = new DelegateCommand(async() =>
            {
                await MainHelper.ShowLog(_dialogService);
            });
        }
Ejemplo n.º 8
0
        public JsonResult AddReply(string Value, string text)
        {
            User Us = (User)Session["user"];

            Us = MainHelper.InitUser(Us.Id);

            if (Value.Contains("retweetid") == true)
            {
                string newstring = Value.Substring(Value.IndexOf(':') + 1);
                int    Id        = Convert.ToInt32(newstring);
                db.RetweetReplies.Add(new RetweetReply()
                {
                    UserID    = Us.Id,
                    RetweetID = Id,
                    ReplyText = text,
                    ReplyDate = DateTime.Now
                });
                db.SaveChanges();
                return(Json(false));
            }
            db.Replies.Add(new Reply()
            {
                UserID    = Us.Id,
                ReplyText = text,
                CommentID = Convert.ToInt32(Value),
                ReplyDate = DateTime.Now
            });
            db.SaveChanges();
            return(Json(true));
        }
Ejemplo n.º 9
0
        void LoadSettings()
        {
            // Load settings into form.
            LoggingTextBox.Text                 = SettingsManager.Options.LogText;
            SearchPattern                       = Encoding.ASCII.GetBytes(LoggingTextBox.Text);
            LoggingCheckBox.Checked             = SettingsManager.Options.LogEnable;
            CacheDataWriteCheckBox.Checked      = SettingsManager.Options.CacheDataWrite;
            CacheDataReadCheckBox.Checked       = SettingsManager.Options.CacheDataRead;
            CacheDataGeneralizeCheckBox.Checked = SettingsManager.Options.CacheDataGeneralize;
            UpdateWinCapState();
            var allowWinCap = SettingsManager.Options.UseWinCap & MainHelper.GetWinPcapVersion() != null;

            CaptureSocButton.Checked = !allowWinCap;
            CaptureWinButton.Checked = allowWinCap;
            // Update writer settings.
            SaveSettings();
            // Attach events.
            LoggingTextBox.TextChanged                 += LoggingTextBox_TextChanged;
            LoggingCheckBox.CheckedChanged             += LoggingCheckBox_CheckedChanged;
            CacheDataWriteCheckBox.CheckedChanged      += CacheDataWriteCheckBox_CheckedChanged;
            CacheDataReadCheckBox.CheckedChanged       += CacheDataReadCheckBox_CheckedChanged;
            CacheDataGeneralizeCheckBox.CheckedChanged += CacheDataGeneralizeCheckBox_CheckedChanged;
            LoggingPlaySoundCheckBox.CheckedChanged    += LoggingPlaySoundCheckBox_CheckedChanged;
            CaptureSocButton.CheckedChanged            += CaptureSocButton_CheckedChanged;
            CaptureWinButton.CheckedChanged            += CaptureWinButton_CheckedChanged;
            EnumeratePlaybackDevices();
            UpdatePlayBackDevice();
        }
Ejemplo n.º 10
0
        public async Task <IActionResult> Service(string _lang = "az", int id = 1)
        {
            ViewBag.Lang = _lang;
            MainHelper.SetLang(_httpContextAccessor, _lang);

            return(View(await _context.OurTeamLangs.Where(a => a.Lang.Code.ToLower() == _lang && a.OurTeam.Id == id).FirstOrDefaultAsync()));
        }
Ejemplo n.º 11
0
        public ActionResult Register(RegisterModel m)
        {
            MyConnectionDataContext db = new MyConnectionDataContext();
            // registration არის db-ს table სახელი
            registration c = new registration();

            c.Username = m.Username;
            c.Email    = m.Email;
            if (m.Password != m.Repeat_Password)
            {
                ViewBag.error = "passwords is not the same";
                return(View());
            }
            else if (m.Password.Length < 8 && m.Repeat_Password.Length < 8)
            {
                ViewBag.error = " The passwords should be longer than 8 characters";
                return(View());
            }
            else
            {
                c.Password  = MainHelper.MD5hash(m.Password + AuthSecret);
                c.CreatDate = DateTime.Now;

                db.registrations.InsertOnSubmit(c);
                db.SubmitChanges();
            }
            return(RedirectToAction("Login"));
        }
        public TempAcco GetTempAccount()
        {
            int    myUid  = int.Parse((Request.Properties["user"] as string));
            string newPwd = GetPassword();

            Account newAcco = new Account();

            newAcco.type                          = "t";
            newAcco.TemporaryAccount              = new TemporaryAccount();
            newAcco.TemporaryAccount.pwd          = MainHelper.HashPassword(newPwd);
            newAcco.TemporaryAccount.ancestor_uid = myUid;
            newAcco.TemporaryAccount.reg_time     = DateTime.UtcNow;
            newAcco.TemporaryAccount.ipv4         = System.Web.HttpContext.Current.Request.UserHostAddress;

            try
            {
                db.Account.Add(newAcco);
                db.SaveChanges();
                var r = db.Account.Find(myUid).PermanentAccount.TemporaryAccount.OrderByDescending(a => a.reg_time).FirstOrDefault();
                return(new TempAcco {
                    uid = r.uid, pwd = newPwd
                });
            }
            catch (Exception)
            {
                return(null);
            }
        }
Ejemplo n.º 13
0
        private void CalculateRouteButton_Click(object sender, EventArgs e)
        {
            MainHelper mainHelper = new MainHelper(loadedData);

            if (!int.TryParse(StartingCityTextBox.Text, out startingCityId) || startingCityId > loadedData.Count)
            {
                startingCityId = 1;
            }

            switch (currentHeuristic)
            {
            case HeuristicTypeEnum.ILS:
                currentPath = mainHelper.ILS(startingCityId);
                RedrawMap();
                break;

            case HeuristicTypeEnum.VNS:
                currentPath = mainHelper.Basic_VNS(startingCityId);
                RedrawMap();
                break;

            default:
                break;
            }

            StatisticsButton.Visible  = true;
            HideMarkersButton.Visible = true;
        }
Ejemplo n.º 14
0
        public async Task <IActionResult> Login([FromBody] LoginModel login)
        {
            if (MainHelper.IsValidEmail(login.LoginOrEmail))
            {
                var resultEmail = await _signInManager.UserManager.FindByEmailAsync(login.LoginOrEmail);

                if (resultEmail != null)
                {
                    login.LoginOrEmail = resultEmail.UserName;
                }
                else
                {
                    return(BadRequest(new LoginResult {
                        Successful = false, Error = "Username and password are invalid."
                    }));
                }
            }
            //
            var result = await _signInManager.PasswordSignInAsync(login.LoginOrEmail, login.Password, false, false);

            if (!result.Succeeded)
            {
                return(BadRequest(new LoginResult {
                    Successful = false, Error = "Username and password are invalid."
                }));
            }
            var strToken = _authenticationJWTService.GetTokenStr(login.LoginOrEmail);

            return(Ok(new LoginResult {
                Successful = true, Token = strToken
            }));
        }
Ejemplo n.º 15
0
        public Page2PageViewModel(INavigationService navigationService,
                                  IPageDialogService dialogService)
        {
            _navigationService = navigationService;

            _dialogService = dialogService;
            GoBackCommand  = new DelegateCommand(() =>
            {
                _navigationService.GoBackAsync();
            });
            GoBackParaCommand = new DelegateCommand(() =>
            {
                var fooPara = new NavigationParameters();
                fooPara.Add("MyReturnData", "Return from Page2");
                _navigationService.GoBackAsync(fooPara);
            });
            GoHomeCommand = new DelegateCommand(() =>
            {
                _navigationService.GoBackToRootAsync();
            });
            GoHomeParaCommand = new DelegateCommand(() =>
            {
                var fooPara = new NavigationParameters();
                fooPara.Add("MyReturnData", "Return from Page2");
                _navigationService.GoBackToRootAsync(fooPara);
            });
            ResetLogCommand = new DelegateCommand(() =>
            {
                MainHelper.NavigationLogs = "";
            });
            ShowLogCommand = new DelegateCommand(async() =>
            {
                await MainHelper.ShowLog(_dialogService);
            });
        }
Ejemplo n.º 16
0
        private IEnumerable <Client> BuildClientList()
        {
            var clientsList = new List <Client>
            {
                new Client
                {
                    Id                   = "ngAuthApp",
                    Secret               = MainHelper.GetHash("qwerty@123"),
                    Name                 = "AngularJS front-end Application",
                    ApplicationType      = Models.Enums.ApplicationTypes.JavaScript,
                    Active               = true,
                    RefreshTokenLifeTime = 7200,
                    AllowedOrigin        = "http://*****:*****@qwerty"),
                    Name                 = "Console Application",
                    ApplicationType      = Models.Enums.ApplicationTypes.NativeConfidential,
                    Active               = true,
                    RefreshTokenLifeTime = 14400,
                    AllowedOrigin        = "*"
                }
            };

            return(clientsList);
        }
        public HttpResponseMessage Login([FromBody] TempLoginData data)
        {
            HttpResponseMessage response = null;

            var r = db.TemporaryAccount.Find(data.uid);

            if (DateTime.Compare(r.reg_time.AddMinutes(accEffTime), DateTime.UtcNow) < 0)
            {
                // 臨時帳號accEffTime分鐘內有效
                response = this.Request.CreateResponse <APIResult>(HttpStatusCode.Unauthorized, new APIResult()
                {
                    Success = false,
                    Message = $"",
                    Payload = $"臨時帳號{accEffTime}分鐘內有效"
                });
            }
            else if (r.pwd == MainHelper.HashPassword(data.pwd))
            {
                // 帳號與密碼比對正確,回傳帳密比對正確

                #region 產生這次通過身分驗證的存取權杖 Access Token
                string secretKey = MainHelper.SecretKey;

                // 設定該存取權杖的有效期限
                IDateTimeProvider provider = new UtcDateTimeProvider();
                var expDate           = provider.GetNow().AddMinutes(accEffTime); //權杖效期accEffTime分鐘
                var unixEpoch         = UnixEpoch.Value;                          // 1970-01-01 00:00:00 UTC
                var secondsSinceEpoch = Math.Round((expDate - unixEpoch).TotalSeconds);

                //產生Token
                var jwtToken = new JwtBuilder()
                               .WithAlgorithm(new HMACSHA256Algorithm())
                               .WithSecret(secretKey)
                               .AddClaim("iss", r.uid.ToString()) //
                               .AddClaim("exp", secondsSinceEpoch)
                               .AddClaim("role", new string[] { "User", "People", "Guest" })
                               .Build();
                #endregion

                response = this.Request.CreateResponse <APIResult>(HttpStatusCode.OK, new APIResult()
                {
                    Success = true,
                    Message = $"{r.ancestor_uid}", //回傳祖先的ID 這樣才能用哦~
                    Payload = $"{jwtToken}"
                });
            }
            else
            {
                // 密碼錯誤
                response = this.Request.CreateResponse <APIResult>(HttpStatusCode.Unauthorized, new APIResult()
                {
                    Success = false,
                    Message = $"",
                    Payload = "UID或密碼不正確"
                });
            }

            return(response);
        }
Ejemplo n.º 18
0
        public FormMain()
        {
            InitializeComponent();
            mainHelper = new MainHelper(this);
#if DEBUG
            button1.Visible = true;
#endif
        }
Ejemplo n.º 19
0
        public async Task <IViewComponentResult> InvokeAsync(string _lang = "az")
        {
            ViewBag.Lang = _lang;
            MainHelper.SetLang(_httpContextAccessor, _lang);
            var social = _context.StaticDataLangs.FirstOrDefault(p => p.Lang.Code.ToLower() == _lang);

            return(View(await Task.FromResult(social)));
        }
Ejemplo n.º 20
0
        public ActionResult Registration(UserValidation user)
        {
            Session.Clear();
            string conf  = MainHelper.Random32();
            int    count = db.Users.Count() + 1;

            db.Users.Add(new User()
            {
                Name         = user.Name,
                Surname      = user.Surname,
                Email        = user.Email,
                Password     = MainHelper.CalculateMD5Hash(user.Password + AuthSecret),
                Confirmation = conf,
                RegNumber    = user.Name + count,
                Search       = user.Name + " " + user.Surname,
                CreateDate   = DateTime.Now
            });
            db.SaveChanges();
            db.ProfilePhotoes.Add(new ProfilePhoto()
            {
                UserID = db.Users.Max(x => x.Id),
                Photo  = "noImage.png"
            });
            db.SaveChanges();
            TempData["Success"] = "წარმატებით გაიარეთ რეგისტრაცია, გთხოვთ გააქტიუროთ ელ.ფოსტა";
            string Url         = "http://*****:*****@gmail.com", "Activation");
            var    reciveEmail = new MailAddress(user.Email, "Reciver");


            var password = "******";
            var sub      = "Actiovation";


            var smtp = new SmtpClient
            {
                Host                  = "smtp.gmail.com",
                Port                  = 587,
                EnableSsl             = true,
                DeliveryMethod        = SmtpDeliveryMethod.Network,
                UseDefaultCredentials = false,

                Credentials = new NetworkCredential(senderEmail.Address, password),
            };

            using (var mess = new MailMessage(senderEmail, reciveEmail)
            {
                Subject = sub,
                Body = body,
                IsBodyHtml = true,
            })
            {
                smtp.Send(mess);
            }

            return(RedirectToAction("Login"));
        }
Ejemplo n.º 21
0
        private void OptionsControl_Load(object sender, EventArgs e)
        {
            _CacheMessageFormat = CacheLabel.Text;
            var files = MainHelper.GetCreateCacheFolder().GetFiles("*.*", SearchOption.AllDirectories);
            var count = files.Count();
            var size  = SizeSuffix(files.Sum(x => x.Length), 1);

            CacheLabel.Text = string.Format(_CacheMessageFormat, count, size);
        }
Ejemplo n.º 22
0
 public void OnNavigatedFrom(NavigationParameters parameters)
 {
     MainHelper.WriteLog($"MainPage OnNavigatedFrom");
     if (parameters.CurrentParameters() != "")
     {
         MainHelper.WriteLog($"MainPage OnNavigatedFrom Parameter:\r\n{parameters.CurrentParameters()}");
     }
     MainHelper.WriteLog($"");
 }
Ejemplo n.º 23
0
        public ActionResult UploadCover(HttpPostedFileBase Photo)
        {
            User Us = (User)Session["user"];

            if (Photo == null)
            {
                TempData["Error"] = "აირჩიეთ ფოტო";
                return(RedirectToAction("Upload"));
            }
            var    file = Photo as HttpPostedFileBase;
            string name = MainHelper.Random32();
            int    size = file.ContentLength;

            var supportedTypes = new[] { "jpg", "jpeg", "png" };
            var fileExt        = System.IO.Path.GetExtension(file.FileName).Substring(1);


            if (!supportedTypes.Contains(fileExt))
            {
                TempData["Error"] = "ფაილი უნდა იყოს მხოლოდ ამ გაფართოებით .jpg.jpeg.png";
                return(RedirectToAction("Upload"));
            }
            if (size > 1024 * 1000)
            {
                TempData["Error"] = "მაქსიმუმ 1 mb";
                return(RedirectToAction("Upload"));
            }

            if (db.CoverPhotoes.Any(x => x.UserID == Us.Id))
            {
                var    Profile  = db.CoverPhotoes.Where(x => x.UserID == Us.Id).FirstOrDefault();
                string fullpath = Request.MapPath("/Content/Image/" + Profile.Photo);
                if (System.IO.File.Exists(fullpath))
                {
                    System.IO.File.Delete(fullpath);
                }
                db.CoverPhotoes.Remove(db.CoverPhotoes.Where(x => x.UserID == Us.Id).FirstOrDefault());
                db.SaveChanges();
            }



            using (var newimage = ScaleImage(Image.FromStream(Photo.InputStream, true, true), 600, 400))
            {
                string path = Server.MapPath("/Content/Image/" + name + ".png");

                newimage.Save(path, ImageFormat.Png);
            }
            db.CoverPhotoes.Add(new CoverPhoto()
            {
                UserID = Us.Id,
                Photo  = name + ".png"
            });
            db.SaveChanges();

            return(RedirectToAction("Index"));
        }
Ejemplo n.º 24
0
        public async Task <IActionResult> Contact(string _lang = "az")
        {
            ViewBag.Lang = _lang;
            MainHelper.SetLang(_httpContextAccessor, _lang);

            var map = await _context.StaticDataLangs.FirstOrDefaultAsync(p => p.Lang.Code.ToLower() == _lang);

            return(View(map));
        }
Ejemplo n.º 25
0
 public void OnNavigatingTo(NavigationParameters parameters)
 {
     MainHelper.WriteLog($"Page2 OnNavigatingTo");
     if (parameters.CurrentParameters() != "")
     {
         MainHelper.WriteLog($"Page2 OnNavigatingTo Parameter:\r\n{parameters.CurrentParameters()}");
     }
     MainHelper.WriteLog($"");
 }
Ejemplo n.º 26
0
    public static MainHelper getInstance()
    {
        if (shared == null)
        {
            shared = new MainHelper();
        }

        return(shared);
    }
Ejemplo n.º 27
0
        public JsonResult GetProjectCost(int projectId, int matherialId, int complectationId, Guid[] options)
        {
            var result  = MainHelper.FormatPrice(MainHelper.GetProjectCost(projectId, matherialId, complectationId));
            var result1 = MainHelper.FormatPrice(MainHelper.GetProjectCost(projectId, matherialId, 1, (complectationId == 1 ? options : null)));
            var result2 = MainHelper.FormatPrice(MainHelper.GetProjectCost(projectId, matherialId, 2, (complectationId == 2 ? options : null)));
            var result3 = MainHelper.FormatPrice(MainHelper.GetProjectCost(projectId, matherialId, 3, (complectationId == 3 ? options : null)));

            return(Json(new { cost = result, cost1 = result1, cost2 = result2, cost3 = result3 }));
        }
Ejemplo n.º 28
0
 /// <summary>
 /// Populate configuration and log menus
 /// </summary>
 private void PopulateMenus()
 {
     MainHelper.DirFiles("/conf", "*.conf", Nginx.cms);
     MainHelper.DirFiles("/mariadb", "my.ini", MariaDB.cms);
     MainHelper.DirFiles("/php", "php.ini", PHP.cms);
     MainHelper.DirFiles("/logs", "*.log", Nginx.lms);
     MainHelper.DirFiles("/mariadb/data", "*.log", MariaDB.lms);
     MainHelper.DirFiles("/php/logs", "*.log", PHP.lms);
 }
Ejemplo n.º 29
0
        public static BillBody SelectBodyOnId(string procName, int action, int id)
        {
            BillBody body = new BillBody();

            PrepareComponent();

            cmd.CommandText = procName;
            cmd.Parameters.Add(new SqlParameter("@action", action));
            cmd.Parameters.Add(new SqlParameter("@id", id));

            try
            {
                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }

                conn.Open();
                reader = cmd.ExecuteReader();

                while (reader.Read())
                {
                    body.Articl = reader.GetString(0);
                    body.UomID  = (int)reader.GetSqlInt32(1);
                    if (!reader.GetSqlMoney(3).IsNull)
                    {
                        body.Quantity = System.Convert.ToDecimal(reader.GetSqlMoney(3).ToString());
                    }
                    if (reader.GetString(4).Length > 0)
                    {
                        body.Sum = MainHelper.SqlStringIntoDecimal(reader.GetString(4));
                    }
                    if (reader.GetString(5).Length > 0)
                    {
                        body.Pdv = MainHelper.SqlStringIntoDecimal(reader.GetString(5));
                    }

                    body.Description = reader.GetString(6);
                    body.Id          = (int)reader.GetSqlInt32(7);
                    body.HeadId      = (int)reader.GetSqlInt32(8);
                }
            }
            catch (Exception ex)
            {
                conn.Close();
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                reader.Close();
                conn.Close();
            }


            return(body);
        }
Ejemplo n.º 30
0
        public ActionResult AddTour(TourModel model, HttpPostedFileBase Photo)
        {
            CheckConnection();
            string name = MainHelper.Random32();

            db.Tours.Add(new Tour()
            {
                TourDate   = model.TourDate,
                Price      = model.Price,
                Photo      = "/images/Tours/" + name + ".jpeg",
                Active     = false,
                CreateDate = DateTime.Now,
            });
            db.SaveChanges();
            using (var newimage = ScaleImage(Image.FromStream(Photo.InputStream, true, true), 1000, 1000))
            {
                string path = Server.MapPath("/images/Tours/" + name + ".jpeg");

                newimage.Save(path, ImageFormat.Jpeg);
            }
            var Id = db.Tours.Max(x => x.Id);

            db.TourTranslateds.Add(new TourTranslated()
            {
                TourID       = Id,
                LangCode     = model.LangEng,
                CategoryName = model.CategoryNameEng,
                Title        = model.TitleEng,
                Text         = model.TextEng,
                BigText      = model.BigTextEng,
            });

            db.TourTranslateds.Add(new TourTranslated()
            {
                TourID       = Id,
                LangCode     = model.LangRus,
                CategoryName = model.CategoryNameRus,
                Title        = model.TitleRus,
                Text         = model.TextRus,
                BigText      = model.BigTextRus,
            });

            db.TourTranslateds.Add(new TourTranslated()
            {
                TourID       = Id,
                LangCode     = model.LangGeo,
                CategoryName = model.CategoryNameGeo,
                Title        = model.TitleGeo,
                Text         = model.TextGeo,
                BigText      = model.BigTextGeo,
            });
            db.SaveChanges();

            TempData["Success"] = "წარმატებით დაემატა გთხოვთ დაამატოთ ტურის სლაიდერის ფოტოები";
            return(RedirectToAction("Tours"));
        }
Ejemplo n.º 31
0
 // Use this for initialization
 void Start()
 {
     gameObject.renderer.material.color = this.choosedColors[Random.Range(0, this.choosedColors.Length)];
     this.mhReference = GameObject.Find("MainHelper").GetComponent<MainHelper>();
 }
Ejemplo n.º 32
0
 // Use this for initialization
 void Start()
 {
     this.mhReference = GameObject.Find("MainHelper").GetComponent<MainHelper>();
 }
Ejemplo n.º 33
0
 public LabelTextHelper(MainForm _main, MainHelper _helper)
 {
     main = _main;
     helper = _helper;
 }