public async Task <IActionResult> Edit(int id, [Bind("ID,FName,LName,Email,Telno,Jobrole")] SInfo sInfo)
        {
            if (id != sInfo.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(sInfo);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SInfoExists(sInfo.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(sInfo));
        }
        public async Task <IActionResult> Create([Bind("ID,FName,LName,Email,Telno,Jobrole")] SInfo sInfo)
        {
            if (ModelState.IsValid)
            {
                _context.Add(sInfo);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(sInfo));
        }
예제 #3
0
        private void Vlozit_Click(object sender, RoutedEventArgs e)
        {
            Model.Cislo = CisloStlpu;
            var result = Model.Insert();

            FormularGenerator.GenerujSpravu(result, Model.ErrorMessage);
            if (result)
            {
                DataContext    = null;
                DataContext    = new SInfo();
                Obrazok.Source = null;
            }
        }
예제 #4
0
        //=========================================
        private bool IsValidForShow(out SInfo InfoIs, out string ErrMsgIs)
        {
            InfoIs   = new SInfo();
            ErrMsgIs = "";

            CXmlConfig xc = new CXmlConfig(CCommon.Const.ConfigXmlFullPath);

            InfoIs.FullPath = xc.GetSetting("FullPath", "");
            if (InfoIs.FullPath == "")
            {
                ErrMsgIs = "Config not saved.";
                return(false);
            }

            if (!File.Exists(InfoIs.FullPath))
            {
                ErrMsgIs = InfoIs.FullPath + " file not exists.";
                return(false);
            }


            return(true);
        }
예제 #5
0
        public static SInfo[] ParseRawInfo(List<string> list)
        {
            SInfo[] s = new SInfo[50];
            for (int i = 0; i < list.Count / 8; i++) //each server has 8 lines of info, so Count/8 gets the number of servers
            {
                s[i].name = list[2 + (8 * i)];
                s[i].totalplayers = list[3 + (8 * i)];
                string[] players = list[3 + (8 * i)].Split('/');
                s[i].players = Convert.ToInt32(players[0]);
                s[i].maxplayers = Convert.ToInt32(players[1]);
                s[i].ip = list[6 + (8 * i)];
                s[i].map = list[7 + (8 * i)];

            }

            return s;
        }
예제 #6
0
        private bool IsValid(out SInfo InfoIs, out string ErrMsgIs)
        {
            InfoIs   = new SInfo();
            ErrMsgIs = "";

            DataTable dt = GetTable();

            InfoIs.Name = txtName.Text.Trim();
            if (InfoIs.Name == "")
            {
                ErrMsgIs = "Name not entered.";
                return(false);
            }

            InfoIs.RootFolderSrc = txtRootFolderSrc.Text.Trim();
            if (InfoIs.RootFolderSrc == "")
            {
                ErrMsgIs = "Source Folder not entered.";
                return(false);
            }
            if (!Directory.Exists(InfoIs.RootFolderSrc))
            {
                ErrMsgIs = "Source Folder: " + InfoIs.RootFolderSrc + " is not exists.";
                return(false);
            }

            InfoIs.aRootFolderDest = txtRootFolderDest.Text.Trim().Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
            foreach (string RootFolderDest in InfoIs.aRootFolderDest)
            {
                if (RootFolderDest != "")
                {
                    if (!Directory.Exists(RootFolderDest))
                    {
                        ErrMsgIs = "Destination Folder: " + RootFolderDest + " is not exists.";
                        return(false);
                    }
                }
            }

            if (txtFtpHost.Text.Trim() != "")
            {
                InfoIs.FtpInfo            = new CFtpInfoSync();
                InfoIs.FtpInfo.Host       = txtFtpHost.Text.Trim();
                InfoIs.FtpInfo.Folder     = txtFtpFolder.Text.Trim();
                InfoIs.FtpInfo.Port       = Convert.ToInt32(nudFtpPort.Value);
                InfoIs.FtpInfo.UsePassive = chkFtpUsePassive.Checked;
                InfoIs.FtpInfo.UserId     = txtFtpId.Text.Trim();
                InfoIs.FtpInfo.Password   = txtFtpPassword.Text.Trim();
            }

            if ((InfoIs.aRootFolderDest.Length == 0) && (InfoIs.FtpInfo == null))
            {
                ErrMsgIs = "Both of Destination Folder and FTP Info is empty.";
                return(false);
            }
            else if ((InfoIs.aRootFolderDest.Length != 0) && (InfoIs.FtpInfo != null))
            {
                ErrMsgIs = "Both of Destination Folder and FTP Info is not empty.";
                return(false);
            }

            InfoIs.IntervalMinutes        = Convert.ToInt32(nudIntervalMinutes.Value);
            InfoIs.SyncType               = CEnum.GetValueByName <SyncTypes>((string)cboSyncType.SelectedValue);
            InfoIs.MinifyJs               = chkMinifyJs.Checked;
            InfoIs.EmptyFolderHasNoFile   = chkEmptyFolderHasNoFile.Checked;
            InfoIs.aFullPathReferencingJs = txtFullPathReferencingJs.Text.Trim().Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
            InfoIs.aJsFullPathRefered     = txtJsFullPathRefered.Text.Trim().Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
            InfoIs.DateTimeAfter          = dtpDateTimeAfter.Value;
            InfoIs.DisallowedExt          = txtDisallowedExt.Text.Trim();
            InfoIs.AllowedOnlyExt         = txtAllowedOnlyExt.Text.Trim();
            InfoIs.DisallowedFolder       = txtDisallowedFolder.Text.Trim();
            InfoIs.AllowedOnlyFolder      = txtAllowedOnlyFolder.Text.Trim();

            InfoIs.LogFolder = txtLogFolder.Text.Trim();
            if (InfoIs.LogFolder == "")
            {
                ErrMsgIs = "Log Folder not entered.";
                return(false);
            }
            if (!Directory.Exists(InfoIs.LogFolder))
            {
                ErrMsgIs = "Log Folder: " + InfoIs.LogFolder + " is not exists.";
                return(false);
            }

            return(true);
        }