Пример #1
0
 // Use this for initialization
 void Start()
 {
     targetTex            = Extentions.CreateRenderTexture(256, 256);
     targetTex.filterMode = FilterMode.Point;
     rt            = Extentions.CreateRenderTexture(256, 256);
     rt.filterMode = FilterMode.Point;
 }
Пример #2
0
        public bool Insert(IConnectionHandler connectionHandler, IConnectionHandler filemanagerconnectionHandler, FormStructure formPostModel)
        {
            var fileTransactionalFacade = FileManagerComponent.Instance.FileTransactionalFacade(filemanagerconnectionHandler);

            foreach (var source in formPostModel.GetFormControl.Where(x => x.Key.Contains(typeof(FileUpload).Name)).ToList())
            {
                if (source.Value != null && !Equals(source.Value, "") && source.Value.GetType() == typeof(HttpPostedFileWrapper))
                {
                    formPostModel.GetFormControl[source.Key] = fileTransactionalFacade.Insert((HttpPostedFileBase)source.Value).ToString();
                }
            }
            var formData = new FormData
            {
                RefId       = formPostModel.RefId,
                StructureId = formPostModel.Id,
                ObjectName  = formPostModel.ObjectName,
                Data        = Extentions.GetFormData(formPostModel.GetFormControl)
            };

            formData.CurrentUICultureName = formPostModel.CurrentUICultureName;
            if (!this.Insert(connectionHandler, formData))
            {
                throw new Exception("خطایی در ذخیره اطلاعات فرم وجود دارد");
            }
            return(true);
        }
Пример #3
0
 public FormData GetWithoutGridFormData(IConnectionHandler connectionHandler, FormStructure formStructure, string refId, string objname, string culture)
 {
     if (!string.IsNullOrEmpty(refId))
     {
         var controls  = formStructure.Controls.Where(x => x.GetType().Name != typeof(ControlFactory.Controls.Grid).Name && string.IsNullOrEmpty(((Control)x).GridId)).ToList();
         var formDatas = new FormDataBO().Where(connectionHandler, x => x.RefId.ToLower() == refId.ToLower() && x.ObjectName.ToLower() == objname.ToLower() && x.StructureId == formStructure.Id);
         if (formDatas == null || !formDatas.Any())
         {
             return(null);
         }
         new FormDataBO().GetLanuageContent(connectionHandler, culture, formDatas);
         FormData setformData = null;
         foreach (var formData in formDatas)
         {
             var list = Extentions.GetControlData(formData.Data);
             foreach (var control in controls)
             {
                 if (!list.ContainsKey(((Control)control).Id))
                 {
                     continue;
                 }
                 if (!formData.GetFormControl.ContainsKey(((Control)control).Id))
                 {
                     formData.GetFormControl.Add(((Control)control).Id, list[((Control)control).Id]);
                 }
                 setformData = formData;
             }
             if (setformData != null)
             {
                 return(setformData);
             }
         }
     }
     return(null);
 }
Пример #4
0
        public ActionResult SendResumeForJob(int jobPostId)
        {
            try
            {
                if (jobPostId > 0)
                {
                    var request = new JobRequest
                    {
                        Created       = DateTime.Now,
                        CreatedBy     = User.Identity.Name,
                        DateOfRequest = DateTime.Now,
                        IsRequested   = true,
                        JobPostId     = jobPostId,
                        Modified      = DateTime.Now,
                        ModifiedBy    = User.Identity.Name,
                        PartyId       = User.Identity.GetPartyId().SafeInt(),
                        RequestStatus = (int)JobRequestStatus.Requested,
                        UserName      = Extentions.GetUserName(User.Identity)
                    };
                    JobRequestService.Save(request);

                    SuccessApiResponse.Result = request;
                    return(Json(SuccessApiResponse, JsonRequestBehavior.AllowGet));
                }
                return(Json(ErrorApiResponse, JsonRequestBehavior.AllowGet));
            }
            catch (Exception e)
            {
                return(Json(ErrorApiResponse, JsonRequestBehavior.AllowGet));
            }
        }
Пример #5
0
        public void Init()
        {
            var extracts = TestInitializer.Iqtools.Extracts.Where(x => Extentions.IsSameAs(x.DocketId, "HTS"));
            var cleaner  = TestInitializer.ServiceProvider.GetService <ICleanHtsExtracts>();

            cleaner.Clean(extracts.Select(x => x.Id).ToList());

            var extractsMySql = TestInitializer.KenyaEmr.Extracts.Where(x => x.DocketId.IsSameAs("HTS"));
            var cleanerMySql  = TestInitializer.ServiceProviderMysql.GetService <ICleanHtsExtracts>();

            cleanerMySql.Clean(extractsMySql.Select(x => x.Id).ToList());

            _extractsContext      = TestInitializer.ServiceProvider.GetService <ExtractsContext>();
            _extractsContextMySql = TestInitializer.ServiceProviderMysql.GetService <ExtractsContext>();

            var tempHtsClientExtracts = Builder <TempHTSClientExtract> .CreateListOfSize(2).Build().ToList();

            tempHtsClientExtracts[0].EncounterId = (int?)DateTime.Now.Ticks;
            tempHtsClientExtracts[1].EncounterId = (int?)DateTime.Now.Ticks;

            var tempHtsClientPartnerExtracts = Builder <TempHTSClientPartnerExtract> .CreateListOfSize(2).Build().ToList();

            var tempHtsClientLinkageExtracts = Builder <TempHTSClientLinkageExtract> .CreateListOfSize(2).Build().ToList();

            _extractsContext.AddRange(tempHtsClientExtracts);
            _extractsContext.AddRange(tempHtsClientPartnerExtracts);
            _extractsContext.AddRange(tempHtsClientLinkageExtracts);
            _extractsContext.SaveChanges();

            _extractsContextMySql.AddRange(tempHtsClientExtracts);
            _extractsContextMySql.AddRange(tempHtsClientPartnerExtracts);
            _extractsContextMySql.AddRange(tempHtsClientLinkageExtracts);
            _extractsContextMySql.SaveChanges();
        }
Пример #6
0
        private void Cmb_SelectedIndexChanged(object sender, EventArgs e)
        {
            ComboBox       cmb         = sender as ComboBox;
            int            category_id = Convert.ToInt32((cmb.SelectedItem as ComboboxItem).Value);
            Control        nextCtl     = cmb.Parent.GetNextControl(cmb, true);
            Panel          pnl         = nextCtl.Parent.GetNextControl(nextCtl, true) as Panel;
            List <Quation> newQuations = this.quations.Where(q => q.Category_id == category_id).ToList();

            pnl.Controls.Clear();
            int top = 0;

            foreach (Quation item in newQuations)
            {
                Button btn = new Button();
                btn.Width                 = pnl.Width - 18;
                btn.Height                = pnl.Height;
                btn.Top                   = top;
                btn.FlatStyle             = FlatStyle.Flat;
                btn.BackgroundImageLayout = ImageLayout.Stretch;
                using (FileStream s = new FileStream(Extentions.GetPath() + "\\Quations_Images\\" + item.Image, FileMode.Open))
                {
                    btn.BackgroundImage = Image.FromStream(s);
                }
                pnl.Controls.Add(btn);
                btn.Click += Btn_Click;
                btn.Name   = item.Id.ToString();
                top       += pnl.Height;
            }

            this.markImage(pnl);
        }
Пример #7
0
 public ActionResult Edit(string newsgroupid, NewsGroupViewModel viewModel)
 {
     try
     {
         // TODO: Add update logic here
         Guid g = Guid.Parse(newsgroupid);
         if (ModelState.IsValid)
         {
             AccountViewModel account = Session["Account"] as AccountViewModel;
             viewModel.Id          = g;
             viewModel.Description = viewModel.Description ?? String.Empty;
             viewModel.ModifyDate  = DateTime.Now;
             viewModel.Modifier    = account.UserName;
             viewModel.Url         = Extentions.ToUnsignLinkString(viewModel.NameGroup);
             _iNewsGroupService.UpdateNewsGroup(viewModel);
             return(RedirectToAction("Index"));
         }
         else
         {
             return(View(viewModel));
         }
     }
     catch
     {
         return(View());
     }
 }
Пример #8
0
 public ActionResult Create(NewsGroupViewModel viewModel)
 {
     try
     {
         // TODO: Add insert logic here
         if (ModelState.IsValid)
         {
             AccountViewModel account = Session["Account"] as AccountViewModel;
             viewModel.Description = viewModel.Description ?? String.Empty;
             viewModel.Creator     = account.UserName;
             viewModel.CreatedDate = DateTime.Now;
             viewModel.Modifier    = account.UserName;
             viewModel.ModifyDate  = DateTime.Now;
             viewModel.Url         = Extentions.ToUnsignLinkString(viewModel.NameGroup);
             _iNewsGroupService.InsertNewsGroup(viewModel);
             return(RedirectToAction("Index"));
         }
         else
         {
             return(View(viewModel));
         }
     }
     catch
     {
         return(View());
     }
 }
Пример #9
0
        public ActionResult View(Guid Id)
        {
            var decryptVariables = Extentions.DecryptVariables(Id);

            GetValue(decryptVariables);
            return(View(decryptVariables));
        }
Пример #10
0
        public ActionResult SwapListItemControl(string jsonvalue, string Id, string type)
        {
            var list           = Extentions.DeSerializeListItem(Utils.ConvertHtmlToString(jsonvalue.Decompress()));
            var firstOrDefault = list.FirstOrDefault(organizationIp => organizationIp.Value.Equals(Id));

            if (firstOrDefault == null)
            {
                return(Content(""));
            }
            switch (type)
            {
            case "Up":
                var orDefaultdown = list.OrderByDescending(x => x.Order).FirstOrDefault(control => control.Order < firstOrDefault.Order);
                if (orDefaultdown == null)
                {
                    return(Json(new { Result = false, Value = "" }, JsonRequestBehavior.AllowGet));
                }
                var orderdown = firstOrDefault.Order;
                firstOrDefault.Order = orDefaultdown.Order;
                orDefaultdown.Order  = orderdown;
                break;

            case "Down":
                var orDefault = list.OrderBy(x => x.Order).FirstOrDefault(control => control.Order > firstOrDefault.Order);
                if (orDefault == null)
                {
                    return(Json(new { Result = false, Value = "" }, JsonRequestBehavior.AllowGet));
                }
                var order = (firstOrDefault).Order;
                firstOrDefault.Order = orDefault.Order;
                orDefault.Order      = order;
                break;
            }
            return(Json(new { Result = true, Value = list.SerializeListItem().Compress() }, JsonRequestBehavior.AllowGet));
        }
Пример #11
0
 public override void Activate(object sender, MouseEventArgs e)
 {
     if (ActiveStatus)
     {
         Image.Image = Extentions.GetImage($"{ Neighbors.Count(i => i is Mine)}.png");
     }
 }
Пример #12
0
        public IActionResult Test([FromBody] List <SorguParametre> sorgu)
        {
            var testdata = new List <Ownr> {
                new Ownr {
                    Name = "abc", Qty = 2
                },
                new Ownr {
                    Name = "abcd", Qty = 11
                },
                new Ownr {
                    Name = "xyz", Qty = 40
                },
                new Ownr {
                    Name = "ok", Qty = 5
                },
            };

            Expression <Func <Ownr, bool> > func = null;

            foreach (var item in sorgu)
            {
                func = Extentions.strToFunc <Ownr>(item.Key, item.Query, item.Value, func);
            }

            var result = testdata.Where(func.ExpressionToFunc()).ToList();

            return(View(result));
        }
Пример #13
0
 public async Task <Stream> OpenReadAsync(string url)
 {
     using (var wd = new WebDownload())
     {
         return(await wd.OpenReadTaskAsync(Extentions.HandleWeirdFormat(url)));
     }
 }
Пример #14
0
        public ActionResult GetCompareValidator(string Id, string jsonvalue)
        {
            var requiredFieldValidator = new CompareValidator();

            if (!string.IsNullOrEmpty(Id))
            {
                var list           = Extentions.DeSerialize(Utils.ConvertHtmlToString(jsonvalue.Decompress()));
                var firstOrDefault = list.FindControl(Id);
                if (firstOrDefault != null)
                {
                    requiredFieldValidator = (CompareValidator)firstOrDefault;
                }
            }
            ViewBag.Id                  = Id;
            ViewBag.jsonvalue           = jsonvalue;
            ViewBag.ValidationDataTypes = new SelectList(
                EnumUtils.ConvertEnumToIEnumerableInLocalization <ValidationDataType>().Select(
                    keyValuePair =>
                    new KeyValuePair <byte, string>((byte)keyValuePair.Key.ToEnum <ValidationDataType>(),
                                                    keyValuePair.Value)), "Key", "Value");
            ViewBag.ValidationOperators = new SelectList(
                EnumUtils.ConvertEnumToIEnumerableInLocalization <ValidationOperator>().Select(
                    keyValuePair =>
                    new KeyValuePair <byte, string>((byte)keyValuePair.Key.ToEnum <ValidationOperator>(),
                                                    keyValuePair.Value)), "Key", "Value");
            return(PartialView("PVCompareValidator", requiredFieldValidator));
        }
Пример #15
0
        public async Task SaveAsync()
        {
            try
            {
                var res = await Extentions.PostToApi <StatesBussines, WebStates>(this, Url);

                if (res.ResponseStatus != ResponseStatus.Success)
                {
                    var temp = new TempBussines()
                    {
                        ObjectGuid = Guid,
                        Type       = EnTemp.States
                    };
                    await temp.SaveAsync();

                    return;
                }
                var bu = res.Data;
                if (bu == null)
                {
                    return;
                }
                await TempBussines.UpdateEntityAsync(EnTemp.States, bu.Guid, ServerStatus.Delivered, DateTime.Now);
            }
            catch (Exception ex)
            {
                WebErrorLog.ErrorInstence.StartErrorLog(ex);
            }
        }
Пример #16
0
        public ActionResult DetailView(Guid Id)
        {
            Session.Remove(Constants.TransactionDiscountAttach);
            var decryptVariables = Extentions.DecryptVariables(Id);

            return(View(decryptVariables));
        }
Пример #17
0
        public IActionResult Post([FromBody] PassCardModel model)
        {
            int userId = Extentions.GetUserId(this.User);

            if (userId == -1)
            {
                return(BadRequest(new { message = NO_USER_MSG }));
            }

            PassCard passCard = new PassCard()
            {
                UserId      = userId,
                Name        = model.Name,
                Username    = model.Username,
                Password    = model.Password,
                Description = model.Description
            };

            passCard.Id = _passwordManager.AddPassword(passCard);

            if (passCard.Id <= 0)
            {
                return(BadRequest(new { message = NOT_ADDED_MSG }));
            }

            return(Ok(passCard));
        }
Пример #18
0
        public FileResult GetCaptchaImage([FromServices] ISixLaborsCaptchaModule sixLaborsCaptcha)
        {
            string key     = Extentions.GetUniqueKey(6);
            var    imgText = sixLaborsCaptcha.Generate(key);

            return(File(imgText, "Image/Png"));
        }
Пример #19
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            int    category_id = AddQuation.getCatId(this.cmbInfoCategory.Text);
            string answer      = this.txtInfoAnswer.Text;
            string sql         = "UPDATE Quations SET answer = '" + answer + "', category_id = " + category_id;

            if (ofd.FileName != "")
            {
                string imageName = DateTime.Now.ToString("yyyyMMddHHssmm") + ofd.SafeFileName;
                Extentions.ImageUpload(ofd, imageName, "Quations_Images");
                Extentions.DeleteFile(this.seleced.Image, "Quations_Images");
                sql += ", image = '" + imageName + "' WHERE id = " + this.seleced.Id;
            }
            else
            {
                sql += " WHERE id = " + this.seleced.Id;
            }

            SQLiteCommand com = new SQLiteCommand(sql, con);

            con.Open();
            com.ExecuteNonQuery();
            con.Close();
            //this.fillPanel(this.getAllQuations());
            int id = AddQuation.getCatId(this.cmbCategory.Text);

            this.fillPanel(this.getAllQuations(null, id));
            this.grpInfo.Visible = false;
        }
Пример #20
0
        private static Dictionary <string, byte[]> GetCompressedScriptingDlls(string solutionPath)
        {
            var bins = Path.Combine(solutionPath, "SimulatedServer", "bin", "x64", "Release");  //x64 first

            if (!Directory.Exists(bins))
            {
                bins = Path.Combine(solutionPath, "SimulatedServer", "bin", "Release");  //fallback to x86
            }
            if (!Directory.Exists(bins))
            {
                return(new Dictionary <string, byte[]>(0));
            }

            var sharedDlls = new List <string>
            {
                "CommonObjects",
                "DebugService",
                "Backtest",
                "Scripting",
                "Xceed.Wpf.Toolkit"
            };

            var result = new Dictionary <string, byte[]>();

            foreach (var dll in Directory.GetFiles(bins, "*.dll", SearchOption.TopDirectoryOnly))
            {
                if (!sharedDlls.Contains(Path.GetFileNameWithoutExtension(dll)))
                {
                    result.Add(Path.GetFileName(dll), Extentions.Compress(File.ReadAllBytes(dll)));
                }
            }
            return(result);
        }
Пример #21
0
        private static Dictionary <string, byte[]> GetCompressedSignalDataFiles(string signalDataPath)
        {
            if (!Directory.Exists(signalDataPath))
            {
                return(new Dictionary <string, byte[]>(0));
            }

            var path   = signalDataPath;
            var result = new Dictionary <string, byte[]>();

            for (int i = 4; i > 1; i--)  //scan signal, strategy and portfolio directory levels
            {
                foreach (var file in Directory.GetFiles(path))
                {
                    //do not upload backtest results back to server
                    if (Path.GetFileName(file) == "Backtest Results.xml")
                    {
                        continue;
                    }

                    var levels = file.Split(Path.DirectorySeparatorChar);
                    levels = levels.Skip(levels.Length - i).ToArray();  //path relative to portfolio
                    result.Add(String.Join("\\", levels), Extentions.Compress(File.ReadAllBytes(file)));
                }
                path = Directory.GetParent(path).FullName;
            }
            return(result);
        }
        public GeobaseEngineCombined(string fileName)
        {
            var stopwatchAll = Stopwatch.StartNew();

            // init sizes
            HeaderLengh    = Extentions.GetBytesLength(typeof(GeobaseHeaderDirrect));
            RangesLengh    = Extentions.GetBytesLength(typeof(GeobaseIpRangeDirrect));
            LocationLengh  = Extentions.GetBytesLength(typeof(GeobaseLocationDirrect));
            CityIndexLengh = Extentions.GetBytesLength(typeof(GeobaseCityIndexDirrect));

            CityOffsetInLocation = Extentions.GetBytesLength(typeof(GeobaseLocationDirrect), "Country")
                                   + Extentions.GetBytesLength(typeof(GeobaseLocationDirrect), "Region")
                                   + Extentions.GetBytesLength(typeof(GeobaseLocationDirrect), "Postal");

            LocationCityBytesLenght = Extentions.GetBytesLength(typeof(GeobaseLocationDirrect), "City");

            // init data
            Bytes = File.ReadAllBytes(fileName);

            Header = ByteHelper.BytesToStruct <GeobaseHeaderMarshal>(ByteHelper.GetBytes(Bytes, 0, HeaderLengh));
            var cityIndexesOffsets = ByteHelper.BytesToStruct <GeobaseLocationCityIndexesCombined>(ByteHelper.GetBytes(Bytes, (int)CitiesFromTo.Item1, (int)(CitiesFromTo.Item2 - CitiesFromTo.Item1)));

            _cityIndexPrepared = new int[Records];
            for (int i = 0; i < Records; i++)
            {
                _cityIndexPrepared[i] = (int)(cityIndexesOffsets.CityIndexes[i].LocationOffset / LocationLengh);
            }

            stopwatchAll.Stop();

            Debug.WriteLine("GeobaseEngineCombined, DB loading time: " + stopwatchAll.Elapsed.TotalMilliseconds + " ms");
        }
Пример #23
0
        public ActionResult GeneratListItemHtml(string jsonvalue)
        {
            var list = Extentions.DeSerializeListItem(Utils.ConvertHtmlToString(jsonvalue.Decompress()));

            ViewBag.jsonvalue = jsonvalue;
            return(PartialView("PartialViewListItemModify", list));
        }
        private void UpdateEnableness()
        {
            Extentions.EnableControls(cbJobEnabled.Checked &&
                                      (ScheduleType)cbScheduleType.SelectedValue == ScheduleType.One_time,
                                      dtDateStartOneTime, dtTimeStartOneTime);

            Extentions.EnableControls(cbJobEnabled.Checked &&
                                      (ScheduleType)cbScheduleType.SelectedValue == ScheduleType.Recurring,
                                      cbFrequencyType, cbFrequencyInterval,
                                      rbDailyFreqOccursEvery, rbDailyFreqOccursOnce, dtDateDurationStart, rbEndDate, rbNoEndDate, dtDateDurationEnd,
                                      daysOfWeekPanel, dayOfMonthPanel);

            Extentions.EnableControls(cbJobEnabled.Checked && rbDailyFreqOccursOnce.Checked &&
                                      (ScheduleType)cbScheduleType.SelectedValue == ScheduleType.Recurring,
                                      dtTimeOccursOnly);

            Extentions.EnableControls(cbJobEnabled.Checked &&
                                      (ScheduleType)cbScheduleType.SelectedValue == ScheduleType.Recurring &&
                                      rbDailyFreqOccursEvery.Checked,
                                      cbOccursEvery, cbOccursEveryType, dtDaylyEveryStart, dtDaylyEveryEnd);

            Extentions.EnableControls(cbJobEnabled.Checked &&
                                      (ScheduleType)cbScheduleType.SelectedValue == ScheduleType.Recurring &&
                                      rbEndDate.Checked,
                                      dtDateDurationEnd);

            refreshEmailNotificationControlsState();
        }
Пример #25
0
        public void PreviewElementStart(List <CustomFileSystemCover> files)
        {
            string fileName = "";
            bool   b        = true;
            int    i        = 0;

            while ((files.Count > i) && b)
            {
                if (files[i].FileSystemElement.GetType() == typeof(FileInfo))
                {
                    b        = false;
                    fileName = files[i].FileSystemElement.FullName;
                }
                i++;
            }

            if (string.IsNullOrEmpty(fileName))
            {
                return;
            }

            string ext = System.IO.Path.GetExtension(fileName).ToLower();

            Extentions exts = Extentions.Load();

            if (exts.Keys.Contains(ext))
            {
                var c = from entry in exts
                        where (entry.Key == ext)
                        select entry.Value;



                var previewKind = (PreviewKind)c.First();


                //PreviewKind previewKind = exts.First( .Values[ext];

                switch (previewKind)
                {
                case PreviewKind.Media:
                    MediaStartPreview(fileName);
                    break;

                //case PreviewKind.Web:
                //    WebStartPreview(fileName);
                //    break;
                default:

                    //MessageBox.Show("not");
                    break;
                }
            }
            else
            {
                TextStartPreview(fileName);
            }

            SetCurrentFile(fileName);
        }
        private void SetValue()
        {
            try
            {
                switch (_textboxFlag)
                {
                case TextboxFlag.First:
                    SetHeightValue();
                    break;

                case TextboxFlag.Second:
                    SetWidthValue();
                    break;

                case TextboxFlag.Third:
                    SetAngleValue();
                    break;

                case TextboxFlag.Forth:
                    SetTranslateXValue();
                    break;

                case TextboxFlag.Fifth:
                    SetTranslateYValue();
                    break;
                }
                _textChanged = false;
            }
            catch (Exception ex)
            {
                App.Log.Error(ex.ToString());
                Extentions.ShowMessageBox("无效的输入!");
            }
        }
Пример #27
0
        private void btnRegister_Click(object sender, EventArgs e)
        {
            if (this.isNotEmpty())
            {
                string name      = this.txtName.Text;
                string surname   = this.txtSurname.Text;
                string username  = this.txtUsername.Text;
                string email     = this.txtEmail.Text;
                string password  = this.txtPassword.Text;
                int    gender    = this.ckbMale.Checked ? 1 : 0;
                string imageName = null;

                if (file.SafeFileName != "")
                {
                    imageName = DateTime.Now.ToString("yyyyMMddHHssmm") + file.SafeFileName;
                    Extentions.ImageUpload(file, imageName, "Uploads");
                }

                string sql = "INSERT INTO Students(name, surname, username, email, password, gender, image) VALUES('" + name + "', '" + surname + "', '" + username + "', '" + email + "', '" + password + "', " + gender + ", '" + imageName + "')";
                using (SQLiteConnection con = new SQLiteConnection(Login.connection))
                {
                    con.Open();
                    using (SQLiteCommand com = new SQLiteCommand(sql, con))
                    {
                        com.ExecuteNonQuery();
                    }
                }
                btnRegister.Enabled = false;
                cleaner();
                this.lblSuccess.Text = "Registrasiya uğurla başa çatdı";
            }
        }
Пример #28
0
        public IActionResult Put(int id, [FromBody] PassCardModel model)
        {
            int userId = Extentions.GetUserId(this.User);

            if (userId == -1)
            {
                return(BadRequest(new { message = NO_USER_MSG }));
            }

            PassCard passCard = _passwordManager.GetPassword(userId, id);

            if (passCard == null)
            {
                return(BadRequest(new { message = NO_PASS_MSG }));
            }

            passCard.Name        = model.Name;
            passCard.Username    = model.Username;
            passCard.Password    = model.Password;
            passCard.Description = model.Description;

            _passwordManager.UpdatePassword(passCard);

            return(Ok(passCard));
        }
Пример #29
0
 public IEnumerable <string> Search(FormStructure formStructure)
 {
     try
     {
         var outlist = new List <string>();
         if (formStructure == null)
         {
             return(outlist);
         }
         var list       = new FormDataBO().Where(this.ConnectionHandler, x => x.StructureId == formStructure.Id);
         var dictionary = formStructure.GetFormControl;
         foreach (var model in list)
         {
             var deSerialize = Extentions.GetControlData(model.Data);
             foreach (var key in dictionary.Keys)
             {
                 if (!deSerialize.ContainsKey(key))
                 {
                     continue;
                 }
                 var value       = dictionary[key];
                 var sourcevalue = deSerialize[key];
                 if (string.IsNullOrEmpty(sourcevalue.ToString()) || string.IsNullOrEmpty(value.ToString()))
                 {
                     continue;
                 }
                 if (key.Contains("TextBox"))
                 {
                     if (sourcevalue.ToString().ToLower().Contains(value.ToString().ToLower()))
                     {
                         if (outlist.Any(x => x == model.RefId))
                         {
                             continue;
                         }
                         outlist.Add(model.RefId);
                     }
                 }
                 else if (sourcevalue.ToString() == value.ToString())
                 {
                     if (outlist.Any(x => x == model.RefId))
                     {
                         continue;
                     }
                     outlist.Add(model.RefId);
                 }
             }
         }
         return(outlist);
     }
     catch (KnownException ex)
     {
         Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
         throw new KnownException(ex.Message, ex);
     }
     catch (Exception ex)
     {
         Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace);
         throw new KnownException(ex.Message, ex);
     }
 }
Пример #30
0
        public ActionResult View(Guid Id, FormCollection collection)
        {
            var decryptVariables = Extentions.DecryptVariables(Id);

            try
            {
                var tr = new Transaction();
                this.RadynTryUpdateModel(tr, collection);
                tr.PayTypeId = (byte)collection["PayTypeId"].ToEnum <Enums.PayType>();
                if (!string.IsNullOrEmpty(collection["PayDate"]))
                {
                    tr.PayDate = DateTime.Parse(DateTimeUtil.ShamsiDateToGregorianDate(collection["PayDate"]).ToString("yyyy-MM-dd ") + collection["PayTime"]);
                }
                HttpPostedFileBase DocScanId = null;
                if (Session["DocScanId"] != null)
                {
                    DocScanId = (HttpPostedFileBase)Session["DocScanId"];
                    Session.Remove("DocScanId");
                }
                if (tr.PayTypeId.Equals((byte)Enums.PayType.Documnet))
                {
                    var documnetPay = PaymentComponenets.Instance.TransactionFacade.DocumnetPay(decryptVariables.Id, tr, DocScanId);
                    if (documnetPay != null)
                    {
                        ShowMessage(Resources.Payment.PaySuccessful, Resources.Common.MessaageTitle, messageIcon: MessageIcon.Succeed);
                        return(Redirect("~" + documnetPay.CallBackUrl));
                    }
                    ShowMessage(Resources.Common.ErrorInInsert, Resources.Common.MessaageTitle, messageIcon: MessageIcon.Error);
                    return(View(decryptVariables));
                }
                if (string.IsNullOrEmpty(collection["bankId"]))
                {
                    ShowMessage(Resources.Payment.PleaseSelectBank, Resources.Common.MessaageTitle,
                                messageIcon: MessageIcon.Error);
                    return(View(decryptVariables));
                }
                tr.OnlineBankId = (Byte)collection["bankId"].ToEnum <Radyn.PaymentGateway.Tools.Enums.Bank>();
                string withGateway;
                if (string.IsNullOrEmpty(decryptVariables.TerminalId))
                {
                    withGateway =
                        Radyn.PaymentGateway.PaymentGatewayComponenets.Instance.GeneralFacade.OnlinePay(
                            decryptVariables.Id, tr, Request.Url.Authority + Radyn.Web.Mvc.UI.Application.CurrentApplicationPath);
                }
                else
                {
                    withGateway =
                        Radyn.PaymentGateway.PaymentGatewayComponenets.Instance.GeneralFacade.OnlinePay(
                            decryptVariables.Id, tr, Request.Url.Authority + Radyn.Web.Mvc.UI.Application.CurrentApplicationPath,
                            decryptVariables.MerchantId, decryptVariables.TerminalId, decryptVariables.TerminalUserName, decryptVariables.TerminalPassword, decryptVariables.CertificatePath, decryptVariables.CertificatePassword, decryptVariables.MerchantPublicKey, decryptVariables.MerchantPrivateKey);
                }
                return(Redirect(withGateway));
            }
            catch (Exception exception)
            {
                ShowExceptionMessage(exception);
                return(View(decryptVariables));
            }
        }