Пример #1
0
 public async Task <IActionResult> Check(CheckInput request)
 {
     return(await _dispatcher.DispatchAsync(request));
 }
        public List <PlatformInfo> GetPlatformInformations()
        {
            FileTypes ft = FORIS.Interbilling.NTS.Mediation.Configurations.Configuration.GetNotCashedConfiguration <FileTypes>();
            MediationServiceConfiguration ms = FORIS.Interbilling.NTS.Mediation.Configurations.Configuration.GetNotCashedConfiguration <MediationServiceConfiguration>();
            CheckInput ci   = FORIS.Interbilling.NTS.Mediation.Configurations.Configuration.GetNotCashedConfiguration <CheckInput>();
            var        dir  = ms.InputDirectories;
            var        dir2 = ms.ArchiveDirectories;

            DataTable dtFileTypes = new DataTable();

            dtFileTypes.Columns.Add("FileTypeID");
            dtFileTypes.Columns.Add("FileTypeName");
            dtFileTypes.Columns.Add("Directory");
            dtFileTypes.Columns.Add("FileFilter");
            dtFileTypes.Columns.Add("DirectoryIzlazni");
            dtFileTypes.Columns.Add("DirectoryIzvorni");
            dtFileTypes.Columns.Add("IP");
            dtFileTypes.Columns.Add("Port");
            dtFileTypes.Columns.Add("Username");
            dtFileTypes.Columns.Add("Password");
            dtFileTypes.Columns.Add("TimeSpan");

            var fileTypeList = ft.FileTypesList;

            List <PlatformInfo> list = new List <PlatformInfo>(); //

            foreach (var fileType in fileTypeList)
            {
                PlatformInfo obj = new PlatformInfo();
                obj.PlatformId = fileType.FileTypeID;
                obj.Platform   = fileType.FileTypeName;

                if (ci.Fajlovi.Exists(p => p.FileType == fileType.FileTypeName))
                {
                    obj.IncomingInterval = ci.Fajlovi.Find(p => p.FileType == fileType.FileTypeName).TimeSpan;
                }


                foreach (var d in dir)
                {
                    if (d.FileType == fileType.FileTypeName)
                    {
                        obj.InputFilePath   = d.Directory;
                        obj.InputFileFormat = d.FileFilter;
                    }
                }
                foreach (var d2 in dir2)
                {
                    if (d2.FileType == fileType.FileTypeName)
                    {
                        obj.OutputFileDirectory = d2.DirectoryIzlazni;

                        obj.OriginFileDirectory = d2.DirectoryIzvorni;
                        obj.FTPServer           = d2.IP;
                        obj.Port     = d2.Port;
                        obj.Username = d2.Username;
                        obj.Password = d2.Password;
                    }
                }

                list.Add(obj);
            }
            return(list);
        }
        public void AddPlatformInformation(PlatformInfo obj)
        {
            FileTypes ft = FORIS.Interbilling.NTS.Mediation.Configurations.Configuration.GetNotCashedConfiguration <FileTypes>();
            MediationServiceConfiguration ms = FORIS.Interbilling.NTS.Mediation.Configurations.Configuration.GetNotCashedConfiguration <MediationServiceConfiguration>();
            CheckInput ci = FORIS.Interbilling.NTS.Mediation.Configurations.Configuration.GetNotCashedConfiguration <CheckInput>();

            FileType     newFileType = new FileType();
            MedDirectory medIz       = new MedDirectory();
            MedDirectory medArh      = new MedDirectory();
            Fajl         fajl        = new Fajl();
            //TODO PORT I INTERVAL MORAJU BITI INT
            var inputDir  = ms.InputDirectories;
            var arhiveDir = ms.ArchiveDirectories;
            var files     = ci.Fajlovi;

            newFileType.FileTypeID   = obj.PlatformId;
            newFileType.FileTypeName = obj.Platform;
            medIz.Directory          = obj.InputFilePath;
            medIz.FileFilter         = obj.InputFileFormat;
            medIz.FileType           = obj.Platform;

            medArh.DirectoryIzlazni = obj.OutputFileDirectory;
            medArh.DirectoryIzvorni = obj.OriginFileDirectory;
            medArh.IP       = obj.FTPServer;
            medArh.Port     = obj.Port;
            medArh.Username = obj.Username;
            medArh.Password = obj.Password;
            medArh.FileType = obj.Platform;

            fajl.FileType = obj.Platform;
            fajl.TimeSpan = obj.IncomingInterval;

            ft.FileTypesList.Add(newFileType);

            Array.Resize(ref inputDir, inputDir.Length + 1);
            inputDir[inputDir.Length - 1] = medIz;
            Array.Resize(ref arhiveDir, arhiveDir.Length + 1);
            arhiveDir[arhiveDir.Length - 1] = medArh;
            files.Add(fajl);
            ms.InputDirectories   = inputDir;
            ms.ArchiveDirectories = arhiveDir;


            string logString = "FileTypeID: " + newFileType.FileTypeID + "|" +
                               "FileTypeName: " + newFileType.FileTypeName + "|" +
                               "Directory:" + medIz.Directory + "|" +
                               "FileFilter:" + medIz.FileFilter + "|" +
                               "DirectoryIzlazni:" + medArh.DirectoryIzlazni + "|" +
                               "DirectoryIzvorni: " + medArh.DirectoryIzvorni + "|" +
                               "IP:" + medArh.IP + "|" +
                               "Port:" + medArh.Port + "|" +
                               "Username:"******"|" +
                               "Password: "******"|" +
                               "TimeSpan: " + fajl.TimeSpan;

            WriteLog("INSERT", "MED Configuration", "FileTypes", WindowsIdentity.GetCurrent().Name, logString, "");

            FORIS.Interbilling.NTS.Mediation.Configurations.Configuration.SaveConfiguration(ft.GetType(), ft);
            FORIS.Interbilling.NTS.Mediation.Configurations.Configuration.SaveConfiguration(ft.GetType(), ms);
            FORIS.Interbilling.NTS.Mediation.Configurations.Configuration.SaveConfiguration(ft.GetType(), ci);

            try
            {
                NtsMed.InsertFileSource(int.Parse(newFileType.FileTypeID), newFileType.FileTypeName);
            }
            catch (Exception ex)
            {
                FORIS.Interbilling.NTS.Mediation.Logger.LogError(ex.ToString());
            }
        }
Пример #4
0
 void Update()
 {
     CheckInput.checkTapOrMouseDown(goToTown);
 }
Пример #5
0
 static void Main(string[] args)
 {
     Console.WriteLine(CheckInput.CheckStr("23"));
 }
Пример #6
0
 private void NumberValidationTextBox(object sender, TextCompositionEventArgs e)
 {
     CheckInput.numberOnly(e);
 }
Пример #7
0
        private void btnCommit_Click(object sender, EventArgs e) //提交添加或者修改
        {
            //判断输入
            if (string.IsNullOrWhiteSpace(txtName.Text))
            {
                MessageBox.Show("姓名不允许为空!", "系统消息:", MessageBoxButtons.OK, MessageBoxIcon.Information);
                txtName.Focus();
                return;
            }
            if (CheckInput.IsChinese(txtName.Text))
            {
                MessageBox.Show("姓名必须为中文!", "系统消息:", MessageBoxButtons.OK, MessageBoxIcon.Information);
                txtName.Focus();
                return;
            }
            if (string.IsNullOrWhiteSpace(txtMobile.Text))
            {
                MessageBox.Show("号码不允许为空!", "系统消息:", MessageBoxButtons.OK, MessageBoxIcon.Information);
                txtMobile.Focus();
                return;
            }
            if (CheckInput.IsMobile(txtMobile.Text.Trim()))
            {
                MessageBox.Show("号码必须为11位数字!", "系统消息:", MessageBoxButtons.OK, MessageBoxIcon.Information);
                txtMobile.Focus();
                return;
            }

            Person objPerson = new Person()
            {
                PersonID     = Convert.ToInt32(txtNum.Text.Trim()),
                PersonName   = txtName.Text,
                PersonMobile = txtMobile.Text.Trim(),
            };

            switch (actionFlag)
            {
            case 1:
                objPersonService.AddPerson(objPerson, Program.objListPerson);

                dgvPerson.DataSource = null;
                dgvPerson.DataSource = Program.objListPerson;

                txtNum.Text = dgvPerson.Rows[dgvPerson.Rows.Count - 1].Cells[0].Value.ToString();
                txtNum.Text = dgvPerson.Rows[dgvPerson.Rows.Count - 1].Cells[1].Value.ToString();
                txtNum.Text = dgvPerson.Rows[dgvPerson.Rows.Count - 1].Cells[2].Value.ToString();

                lbTotal.Text = (int.Parse(lbTotal.Text) + 1).ToString();

                EnableButton();
                MessageBox.Show("添加成功!", "系统消息:", MessageBoxButtons.OK, MessageBoxIcon.Information);
                break;

            case 2:
                objPersonService.UpdatePerson(objPerson, Program.objListPerson);

                dgvPerson.DataSource = null;
                dgvPerson.DataSource = Program.objListPerson;

                EnableButton();
                MessageBox.Show("修改成功!", "系统消息:", MessageBoxButtons.OK, MessageBoxIcon.Information);
                break;

            default:
                break;
            }
        }
Пример #8
0
 // Update is called once per frame
 void Update()
 {
     CheckInput.checkTapOrMouseDown((Collider2D hitCollider) => {
         StartCoroutine(itemSelected(hitCollider));
     });
 }
Пример #9
0
        //Method
        public void Display()
        {
            bool isDone = false;

            while (!isDone)
            {
                double currentBalance       = VendingMachine.CurrentBalance;
                string currentBalanceString = currentBalance.ToString("c");
                Console.Clear();
                Console.WriteLine("(1) Feed Money");
                Console.WriteLine("(2) Select Product");
                Console.WriteLine("(3) Finish Transaction");
                Console.WriteLine($"Current Money Provided: {currentBalanceString}");
                string   message         = "";
                DateTime currentDateTime = DateTime.Now;

                int userInput = CheckInput.PickAnIntegerInRange(3);


                if (userInput == 1)
                {
                    bool doneAddingMoney = false;

                    while (!doneAddingMoney)
                    {
                        Console.Clear();
                        Console.WriteLine("Enter Dollar Amount or Enter (q) to Quit to Purchase Menu");
                        Console.WriteLine("Machine only accepts the following bills: $1, $2, $5, $10, $20");
                        double oldBalance = VendingMachine.CurrentBalance;
                        Console.WriteLine($"Current Money Provided: {oldBalance.ToString("c")}");
                        string moneyToAddString = Console.ReadLine();

                        //int dollarsAdded = CheckInput.PickAnInteger("Machine only accepts the following bills: $1, $2, $5, $10, $20");

                        if (moneyToAddString.ToLower() == "q")
                        {
                            doneAddingMoney = true;
                        }
                        else
                        {
                            try
                            {
                                double moneyToAddDouble = CheckInput.StringToDouble(moneyToAddString, "INVALID INPUT...");
                                if (moneyToAddDouble >= 1)
                                {
                                    VendingMachine.AddMoney(moneyToAddDouble);
                                }
                            }
                            catch (Exception e)
                            {
                                Console.WriteLine(e.Message + " press any key to try again");
                                Console.ReadKey();
                            }
                        }
                    }
                }
                else if (userInput == 2)
                {
                    //Display Item List
                    Console.Clear();
                    Console.WriteLine("{0, -10}{1, -30}{2, -20}{3, -20}", "Location", "Product Name", "Price", "Quantity");
                    Console.WriteLine("--------------------------------------------------------------------------------");
                    foreach (KeyValuePair <string, Slot> slot in VendingMachine.SlotDictionary)
                    {
                        Console.WriteLine("{0, -10}{1, -30}{2, -20}{3, -20}",
                                          slot.Value.Location, //location
                                          slot.Value.SlotItem.Name,
                                          slot.Value.SlotItem.Price.ToString("c"),
                                          slot.Value.Qty);
                    }


                    //Buy item
                    Console.WriteLine("Enter Product Location");
                    string location = Console.ReadLine();
                    location = location.ToUpper();
                    bool   areNoExceptions = true;
                    string oldBalance      = VendingMachine.CurrentBalance.ToString("c");
                    try
                    {
                        message = message + VendingMachine.BuyItemInSlot(location) + "\n";
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine("ERROR:" + e.Message);
                        areNoExceptions = false;
                        Console.WriteLine("Press any key to return to purchase menu.");
                        Console.ReadKey();
                    }
                    if (areNoExceptions)
                    {
                        string newBalance   = VendingMachine.CurrentBalance.ToString("c");
                        string purchaseName = VendingMachine.SlotDictionary[location].SlotItem.Name;
                        string feedMoneyLog = $"{currentDateTime.ToString()} {location} {purchaseName}: {oldBalance}     {newBalance}";
                        string eatMessage   = VendingMachine.SlotDictionary[location].SlotItem.EatMessage;
                        PurchasedItemEatMessages.Add(eatMessage);
                    }
                }
                else if (userInput == 3)
                {
                    string oldBalance       = VendingMachine.CurrentBalance.ToString();
                    double oldBalanceDouble = VendingMachine.CurrentBalance;
                    Inventory.UpdateInventory(VendingMachine.ItemsSold, VendingMachine.SlotDictionary);
                    string change = VendingMachine.GetChange();

                    string newBalance = VendingMachine.CurrentBalance.ToString();
                    VendingMachine.WriteLog();


                    Console.WriteLine($"Your Change: {change}");
                    Console.WriteLine();
                    foreach (string item in PurchasedItemEatMessages)
                    {
                        Console.WriteLine(item);
                    }
                    PurchasedItemEatMessages = new List <string>();
                    Console.WriteLine();
                    Console.WriteLine("press any key to return to main menu");
                    Console.ReadKey();

                    isDone = true;
                }
            }
        }
        public void ProcessRequest(HttpContext context)
        {
            context.Response.Buffer          = true;
            context.Response.ExpiresAbsolute = DateTime.Now.AddDays(-1);
            context.Response.AddHeader("pragma", "no-cache");
            context.Response.AddHeader("cache-control", "");
            context.Response.CacheControl = "no-cache";
            context.Response.ContentType  = "text/plain";

            StringBuilder error     = new StringBuilder();
            string        userName  = StringClass.EncodeString(context.Request.Form["txtEmail"].Trim());
            string        userPwd   = context.Request.Form["txtPwd"];
            string        userCPwd  = context.Request.Form["txtCPwd"];
            string        checkCode = context.Request.Form["txtUserVal"];

            if (!CheckInput.CheckEmail(userName))
            {
                error.Append("The email format is incorrect, Please check!<br>");
            }
            if (userPwd.Length < 6)
            {
                error.Append("The password should not be less than 6 digits.!<br>");
            }
            else
            {
                if (userPwd != userCPwd)
                {
                    error.Append("Repeated password is different from the previous!<br>");
                }
            }
            if (checkCode != context.Session["ValidateCode"].ToString())
            {
                error.Append("Wrong Validation Code!");
            }
            string userID = Guid.NewGuid().ToString().ToLower();

            if (error.ToString() == "")
            {
                Model.t_rol_user model = new Model.t_rol_user();
                model.ID          = userID;
                model.Username    = userName;
                model.Password    = StringClass.EncryptPassword(userPwd, StringClass.PasswordFormat.MD5_32);
                model.IsValid     = 1;
                model.CreatedDate = DateTime.Now;

                // Get the RoleID by RoleName. For normal User
                DataSet Ds = roleBll.GetRoleIDByRoleName("User");
                if (Ds.Tables[0].Rows.Count == 0)
                {
                    WindowClass.WindowBack("Failed to get User's Role ID!");
                }
                else
                {
                    model.RoleID = Ds.Tables[0].Rows[0]["ID"].ToString();
                }

                error.Append((new BLL.t_rol_user()).RegisterUser(model));
            }

            if (error.ToString() != "")
            {
                context.Response.Write(error.ToString());
                return;
            }
            else
            {
                Model.t_rol_user model = new Model.t_rol_user();
                model = userBll.GetModel(userID);
                if (model != null)
                {
                    context.Session["User"] = model;
                    model = null;
                    context.Response.Write("<script language='javascript'>window.location.href='/../Views/index.aspx';</script>");
                }
                else
                {
                    WindowClass.WindowBack("Failed to get User model!");
                    context.Response.Write("<script language='javascript'>window.location.href='/../Views/User/Login.aspx';</script>");
                }
            }
        }