//When a new entry is selected in the combobox. private void comboBox_ListOfDomains_SelectedIndexChanged(object sender, EventArgs e) { //depending on what is in the combobox, program tells what the UI should be. if (comboBox_ListOfDomains.Text == "(Create a new domain)") { label_EnterAName.Visible = true; textBox_EnterAName.Visible = true; button_RemoveSelectedDomain.Visible = false; button_SaveChangesToDomain.Text = "Save New Domain"; ClearAll(); } else { label_EnterAName.Visible = false; textBox_EnterAName.Visible = false; button_RemoveSelectedDomain.Visible = true; button_SaveChangesToDomain.Text = "Save Changes to Current Domain"; //I did it this way to avoid keeping track of a global indexer variable. Combobox index will always be the same as the generic list's. textBox_EnterAName.Text = ReadConfig.ReadDomainSetting()[comboBox_ListOfDomains.SelectedIndex - 1].UserAssignedName; textBox_Username.Text = ReadConfig.ReadDomainSetting()[comboBox_ListOfDomains.SelectedIndex - 1].Username; textBox_Password.Text = ReadConfig.ReadDomainSetting()[comboBox_ListOfDomains.SelectedIndex - 1].Password; textBox_Domain.Text = ReadConfig.ReadDomainSetting()[comboBox_ListOfDomains.SelectedIndex - 1].Domain; if (ReadConfig.ReadDomainSetting()[comboBox_ListOfDomains.SelectedIndex - 1].Enabled == "1") { checkBox1.Checked = true; } else { checkBox1.Checked = false; } } }
public JsonResult TimesheetReject(string[] DATA) { try { foreach (string i in DATA) { ActionItems res = JsonConvert.DeserializeObject <ActionItems>(i); NewEntryModel existing = DB.EmpTimeSheet.Find(res.TsID); if (existing != null) { existing.Status = Convert.ToInt64(ReadConfig.GetValue("StatusRejected")); existing.ApproveRejectComments = ""; existing.ApproveRejectStatus = "R"; existing.ApproveRejectUser = (long)Session[Constants.SessionEmpID]; existing.ApproveRejectDate = DateTime.Now; DB.EmpTimeSheet.Attach(existing); DB.Entry(existing).State = System.Data.Entity.EntityState.Modified; DB.SaveChanges(); } } } catch (Exception ex) { TempData["Error"] = ex.ToString(); LogHelper.ErrorLog(ex); } return(Json(new { data = true })); }
public IActionResult PostAbout(string wenti) { ReadConfig readConfig = new ReadConfig(); readConfig.Add($"问题:{readConfig.Count}号", $"{wenti} || Time:{DateTime.Now}"); return(Json("谢谢你的问题,我已经记下了,现在你可以关闭页面了")); }
public static IEnumerable <MasterLookUp> GrantList(long?empId = null) { ApplicationDBContext DB = new ApplicationDBContext(); try { if (empId.HasValue) { long grantId = Convert.ToInt64(ReadConfig.GetValue("TypeGrant")); DateTime lastDayOfMonth = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.DaysInMonth(DateTime.Now.Year, DateTime.Now.Month)); IEnumerable <MasterLookUp> Grants = (from x in DB.MasterData join z in DB.ProjectMaster on x.MstID equals z.ProjectGrant join y in DB.ProjectEmployee on z.ProjectID equals y.ProjectID where y.EmployeeID == empId.Value select new MasterLookUp { MstID = x.MstID, MstCode = x.MstCode + "-" + x.MstName }).Distinct().ToList(); return(Grants); } else { IEnumerable <MasterLookUp> Grants = DB.MasterData.AsEnumerable().Where(x => x.MstTypeID == Convert.ToInt64(ReadConfig.GetValue("TypeGrant"))).Select(x => new MasterLookUp { MstID = x.MstID, MstCode = x.MstCode + "-" + x.MstName }).ToList(); return(Grants); } } catch (Exception ex) { LogHelper.ErrorLog(ex); throw ex; } }
public void TestMethod1() { var filepath = @"E:\Github\zbw911\Dev.All\DevLibs\Framework\FileServer\Kt.Framework.FileServer.Test\TestLocalUploadFile.cs"; var x = new ReadConfig("TestLocalUploadFile.config"); IKey key = new LocalFileKey(); IUploadFile upload = new LocalUploadFile(key); var filekey = "1-2013-12-02-05e89032842c22cc4cb13f07e1173333.cs"; //var filekey = key.CreateFileKey(filepath); Console.WriteLine(filekey); var s = key.GetFileSavePath(filekey); Console.WriteLine(s); Console.WriteLine(Dev.Comm.JsonConvert.ToJsonStr(s)); var uploadedkey = upload.SaveFile(File.OpenRead(filepath), filekey); }
// Use this for initialization public void Init() { _conf = ManagerData.Instance.ReadConfig; this.floorMaterial = ManagerData.Instance.floorMaterial; this.fenceMaterial = ManagerData.Instance.fenceMaterial; this.createFloorMesh(); }
public SetDepositViewModel() { OpenSessionCommand = new RelayCommand(o => OpenSessionClick("OpenSessionCommandButton")); readConfig = new ReadConfig(); readDeposit = new ReadDepositResponse(); }
public JsonResult TimesheetApprove(string[] DATA) { try { foreach (var i in DATA) { var res = JsonConvert.DeserializeObject <ActionItemList>(i); var sequenceNubmer = DB.EmpTimeSheet.Find(res.TsID).SequenceNo; var records = DB.EmpTimeSheet.Where(x => x.SequenceNo == sequenceNubmer).ToList(); foreach (var existing in records) { if (existing != null) { // existing.InvolvePercent = 0; existing.Status = Convert.ToInt64(ReadConfig.GetValue("StatusApproved")); existing.ApproveRejectComments = ""; existing.ApproveRejectStatus = "A"; existing.ApproveRejectUser = (Int64)Session[Constants.SessionEmpID]; existing.ApproveRejectDate = DateTime.Now; DB.EmpTimeSheet.Attach(existing); DB.Entry(existing).State = System.Data.Entity.EntityState.Modified; } } DB.SaveChanges(); } } catch (Exception ex) { TempData["Error"] = ex.ToString(); LogHelper.ErrorLog(ex); } return(Json(new { data = true })); }
public BankData LoadData() { ReadConfig reg = new ReadConfig(); string JsonUrl = (reg.JsonUrl.Substring(0, reg.JsonUrl.Length - 1) == "\\") ? reg.JsonUrl : (reg.JsonUrl + "\\"); string JsonPath = string.Format(@"{0}{1}.json", JsonUrl, "Gw_BankUpHold"); return(BankUpHold(JsonPath)); }
public ReadLoginResponseViewModel() { readConfig = new ReadConfig(); readPosSession = new ReadPosSessionResponse(); GetLoginResponseCommand = new RelayCommand(GetLoginResponseClick); CloseWindowCommand = new RelayCommand(CloseWindow); SetDialogHostStatus("False"); }
public ReadConfigViewModel() { SaveConfigCommand = new RelayCommand(SaveConfigClick); CloseWindowCommand = new RelayCommand(CloseWindowClick); readConfig = new ReadConfig(); readPrinter = new ReadPrinter(); GetLocalIpAddresses(); }
public void TestDeletePath() { var skey = "1-2013-12-02-05e89032842c22cc4cb13f07e1173333.cs"; var x = new ReadConfig("TestLocalUploadFile.config"); IKey key = new LocalFileKey(); IUploadFile upload = new LocalUploadFile(key); upload.DeltePath(skey); }
public void TestFileUrl() { var skey = "1-2013-12-02-05e89032842c22cc4cb13f07e1173333.cs"; var x = new ReadConfig("TestLocalUploadFile.config"); IKey key = new LocalFileKey(); IUploadFile upload = new LocalUploadFile(key); var url = key.GetFileUrl(skey); }
public static async Task <bool> SendTimeSubmissionEmail(TimeSheetSubmissionEmailModel emailModel) { if (DB == null) { DB = new ApplicationDBContext(); } bool result = false; try { var templateCode = ConfigurationManager.AppSettings["TSEmailTemplateCode"].ToString(); SCTimeSheet_DAL.Models.EmailTemplates emailTemplate = DB.EmailTemplates.FirstOrDefault(x => x.EmailTemplateCode == templateCode); if (emailTemplate != null) { MailMessage mail = new MailMessage(); foreach (var item in emailModel.ManagerInfo) { mail.To.Add(new MailAddress(item.Email)); } string _mailId = ReadConfig.GetValue("SystemEmail"); string _mailPassword = ReadConfig.GetValue("MailPassword"); int _mailPort = Convert.ToInt32(ReadConfig.GetValue("MailPort")); string _mailHost = ReadConfig.GetValue("MailHost"); bool _enableSsl = Convert.ToBoolean(ReadConfig.GetValue("EnableSsl")); mail.From = new MailAddress(_mailId); mail.CC.Add(new MailAddress(_mailId)); mail.Subject = emailTemplate.EmailSubject; string Body = string.Format(emailTemplate.EmailBody, string.Join("/", emailModel.ManagerInfo.Select(x => Models.Common.GetName(x.EmpFirstName, x.EmpLastName, x.EmpMiddleName))), emailModel.EmpName, emailModel.SubmissionDates, emailModel.ProjectName); mail.Body = Body; mail.IsBodyHtml = true; using (SmtpClient smtp = new SmtpClient()) { NetworkCredential credential = new NetworkCredential { UserName = _mailId, Password = _mailPassword }; smtp.Credentials = credential; smtp.Host = _mailHost; smtp.Port = _mailPort; smtp.EnableSsl = _enableSsl; await smtp.SendMailAsync(mail); } result = true; } else { throw new Exception("Time Sheet Submission Email Template not found"); } } catch (Exception ex) { LogHelper.ErrorLog(ex); return(result); } return(result); }
public static RestClient GetUrl(string endpoint) { ReadConfig readConfig = new ReadConfig(); List <Config> _configList = readConfig.GetAllConfigs(); string endurl = _configList[0].server_url + endpoint; RestClient url = new RestClient(endurl); return(url); }
public void setOption() { ReadConfig.ReadFile(); VROption.ID = ReadConfig.user_config[finish_idx].ID; VROption.order = ReadConfig.user_config[finish_idx].order; VROption.startPoint = ReadConfig.user_config[finish_idx].startPoint; VROption.endPoint = ReadConfig.user_config[finish_idx].endPoint; VROption.condition = ReadConfig.user_config[finish_idx].condition; VROption.isTesting = ReadConfig.user_config[finish_idx].isTesting; }
public void TestLocalKey() { var x = new ReadConfig("TestLocalUploadFile.config"); IKey key = new LocalFileKey(); //var fkey = key.CreateFileKey("filename.cs"); var fkey = "1-2013-12-02-0a499429af636838f06bbc2af31b65e8.cs";// key.CreateFileKey("filename.cs"); TestValue(key, fkey); }
//PROGRAMMER METHODS //------------------------------------------------------------------------------------------------------------------- /// <summary> /// Clears and adds new data into the list of domains combobox. /// </summary> private void ComboBoxRefresh() { comboBox_ListOfDomains.Items.Clear(); //Clear combox completely. comboBox_ListOfDomains.Items.Add("(Create a new domain)"); //Add back the default value at position 0; //Loop through list and at all entries available to the combobox. for (int i = 0; i < ReadConfig.ReadDomainSetting().Count; i++) { comboBox_ListOfDomains.Items.Add(ReadConfig.ReadDomainSetting()[i].UserAssignedName); } }
/// <summary> /// 初始化 /// 包括 定时器的初始化 作业的初始化 配置的初始化 /// </summary> internal void Init() { #region 清空 if (mainTimer != null) { mainTimer.Stop(); mainTimer.Elapsed -= MainTimer_Elapsed; mainTimer.Dispose(); mainTimer = null; } mainTimer = new Timer { Interval = 1000, Enabled = false, }; if (taskModelList != null) { foreach (BaseJob item in taskModelList) { item.Dispose(); } } if (taskCollection != null) { foreach (Task item in taskCollection) { item.Dispose(); } } #endregion ReadConfig readConfig = new ReadConfig(); //判断是否有异常 if (readConfig.IsException) { return; } GlobalObject.RichTextLog.AppendTextByAsync("配置加载完成!", Color.Black); BaseJob model = null; //根据配置数量进行初始化作业 foreach (SourceConfig item in readConfig._SourceConfig) { foreach (TableConfig tableConfig in item.TableConfigList) { model = JobFactory.CreateJob(tableConfig); model.InitTask(); taskModelList.Add(model); } } GlobalObject.RichTextLog.AppendTextByAsync("任务初始化完成!", Color.Black); mainTimer.Elapsed += MainTimer_Elapsed; }
static void Main(string[] args) { string hostIp = string.Empty; string hostName = string.Empty; IPHostEntry ipHost = Dns.GetHostEntry(Environment.MachineName); if (ipHost.AddressList.Length > 0) { hostIp = ipHost.AddressList[0].ToString(); IPHostEntry ipHostName = Dns.GetHostEntry(hostIp); hostName = ipHostName.HostName; } OPC.SerialPortUtil.OPCUtil.OPC instance = OPC.SerialPortUtil.OPCUtil.OPC.GetInstance(new OPCSerialInfoModel() { DefaultGroupDeadBand = 0, DefaultGroupIsActive = true, IsActive = true, IsSubscribed = true, UpdateRate = 500, OpcServer = new OPCServer(), HostIp = hostIp, HostName = hostName, }); string opcServers = instance.GetOpcServers(); bool b = instance.ConnectServer(opcServers); opcDatas = instance.RecurBrowse(ReadConfig.GetStrArray(Configuration, "filter")); instance.SetGroupsAndItems(out _opcGroups, _groupName, out _opcGroup, out _opcItems, new GroupPropertiesModel() { DefaultGroupDeadBand = 0, DefaultGroupIsActive = true, IsActive = true, IsSubscribed = true, UpdateRate = 500, }); instance.SetServerHandle(opcDatas, _opcItems, _opcGroup, dic, serivceDic); instance.AddDataChangeEvent(_opcGroup, new OPC.SerialPortUtil.OPCUtil.OPC.ReadDataEventHandler(opcGroup_DataChange)); Thread.Sleep(10000); instance.SetGroupProperty(_opcGroup, new GroupPropertiesModel() { DefaultGroupDeadBand = 0, DefaultGroupIsActive = true, IsActive = true, IsSubscribed = true, UpdateRate = 1500, }); Thread.Sleep(10000); instance.RemoveDataChangeEvent(_opcGroup, new OPC.SerialPortUtil.OPCUtil.OPC.ReadDataEventHandler(opcGroup_DataChange)); instance.CloseConnect(); Console.Read(); }
public void CreateNoExtKey() { var x = new ReadConfig("TestLocalUploadFile.config"); IKey key = new LocalFileKey(); //var fkey = key.CreateFileKey("filename.cs"); var fkey = "1-2013-12-02-0a499429af636838f06bbc2af31b65e8";// key.CreateFileKey("filename.cs"); var strkey = key.CreateFileKey(fkey); Console.WriteLine(strkey); }
public bool CkeckPos() { ReadConfig reg = new ReadConfig(); string JsonUrl = (reg.JsonUrl.Substring(0, reg.JsonUrl.Length - 1) == "\\") ? reg.JsonUrl : (reg.JsonUrl + "\\"); string JsonPath = string.Format(@"{0}{1}.json", JsonUrl, "Gw_BankUpHold"); if (!File.Exists(JsonPath)) { return(false); } return(true); }
public Controller() { _rc = new ReadConfig(); string settingsFile = "cpn_data.xml"; _rc.SetFilename(settingsFile); if (!File.Exists(settingsFile)) { _rc.CreateXml(); } Config = _rc.ReadXml(); }
public void DelteTest() { var skey = "1-2013-12-02-0a499429af636838f06bbc2af31b65e8.cs"; ReadConfig config = new ReadConfig(); IKey key = new ShareImpl.ShareFileKey(); IUploadFile uploadfile = new ShareImpl.ShareUploadFile(key); uploadfile.DeleteFile(skey); }
public void Register() { var x = new ReadConfig(); //公用方法 this.Kernel.Bind <IKey>().To <ShareFileKey>(); this.Kernel.Bind <IUploadFile>().To <ShareUploadFile>(); //文档类型 this.Kernel.Bind <IDocFile>().To <DocFileUploader>(); //图片类型 this.Kernel.Bind <IImageFile>().To <ImageUploader>(); }
public void TestMethod1() { ReadConfig config = new ReadConfig(); IKey key = new ShareImpl.ShareFileKey(); IUploadFile uploadfile = new ShareImpl.ShareUploadFile(key); //var fkey = key.CreateFileKey("filename.cs"); var fkey = "1-2013-12-02-0a499429af636838f06bbc2af31b65e8.cs";// key.CreateFileKey("filename.cs"); var filepath = @"E:\Github\zbw911\Dev.All\DevLibs\Framework\FileServer\Kt.Framework.FileServer.Test\TestLocalUploadFile.cs"; var retkey = uploadfile.UpdateFile(File.OpenRead(filepath), fkey); }
/// <summary> /// Function Name :- FnCreateExtentReport /// Created By :- Pankaj Kumar /// Date of Creation :- 11-Apr-2020 /// </summary> public static void FnCreateExtentReport() { try { string strGlobalConfigFile = GeneralUtil.FnGetProjectFolder() + @"Automation_Accelarator\Config\Global.config"; ExtentHtmlReporter htmlReporter = FnSetConfigDetails(); extent = new ExtentReports(); extent.AttachReporter(htmlReporter); extent.AddSystemInfo("Environment", ReadConfig.FnReadTestEngineConfig(strGlobalConfigFile, "Environment")); extent.AddSystemInfo("User Name", GeneralUtil.FnGetHostName()); extent.AddSystemInfo("IP Address", GeneralUtil.FnGetIPAddress()); } catch (Exception e) { Console.WriteLine(e.StackTrace); } }
/// <summary> /// 读取配置好的界面控件数据 /// </summary> private void ReadParaConfig() { ReadConfig configPara = new ReadConfig("Config\\GrabberParaConfig.txt"); txtListUrl.Text = configPara.GetConfig("ListUrl"); txtUrl.Text = configPara.GetConfig("Url"); txtStartID.Text = configPara.GetConfig("StartID"); txtEndID.Text = configPara.GetConfig("EndID"); txtFilter.Text = configPara.GetConfig("Filter"); txtOppFilter.Text = configPara.GetConfig("OppFilter"); txtOutput.Text = configPara.GetConfig("Output"); txtContentLength.Text = configPara.GetConfig("ContentLength"); cbbEncoding.Text = configPara.GetConfig("Encoding"); }
// Use this for initialization void Start() { conf = GetComponent <ReadConfig>(); this.maxTime = rm.persons[0][rm.persons[0].Count - 1].time; foreach (var person in rm.persons) { MoveScript go = Instantiate(capsule, new Vector3(0f, 0f, 0f), this.transform.rotation).GetComponent <MoveScript>(); go.transform.parent = gameObject.transform; go.transform.localPosition = person.Value[0].position * conf.Length + new Vector3(0, 0.9f, 0); go.transform.localScale = new Vector3(0.5f, 0.9f, 0.5f); go.posistions = person.Value; go.cb = this; go.conf = conf; } }
public ActionResult SingleApprove(PendingListforApproval model) { try { //var existing = DB.NewEntry.FirstOrDefault(x => x.RefNo == model.RefNo); //if (existing != null) //{ if (Request.Form["Approve"] != null) { var selectedRec = DB.EmpTimeSheet.Where(x => x.SequenceNo == model.SequenceNo).ToList(); foreach (var item in selectedRec) { item.InvolvePercent = 0; item.Status = Convert.ToInt64(ReadConfig.GetValue("StatusApproved")); item.ApproveRejectComments = model.ApproveRejectComments; item.ApproveRejectStatus = "A"; item.ApproveRejectUser = (Int64)Session[Constants.SessionEmpID]; item.ApproveRejectDate = DateTime.Now; DB.EmpTimeSheet.Attach(item); DB.Entry(item).State = System.Data.Entity.EntityState.Modified; DB.SaveChanges(); } } else if (Request.Form["Reject"] != null) { var deletedRec = DB.EmpTimeSheet.Where(x => x.SequenceNo == model.SequenceNo).ToList(); foreach (var item in deletedRec) { item.Status = Convert.ToInt64(ReadConfig.GetValue("StatusRejected")); item.ApproveRejectComments = model.ApproveRejectComments; item.ApproveRejectStatus = "R"; item.ApproveRejectUser = (Int64)Session[Constants.SessionEmpID]; item.ApproveRejectDate = DateTime.Now; DB.EmpTimeSheet.Attach(item); DB.Entry(item).State = System.Data.Entity.EntityState.Modified; DB.SaveChanges(); } } // } } catch (Exception ex) { TempData["Error"] = ex.ToString(); LogHelper.ErrorLog(ex); } return(View("Index", model)); }
public override void Load() { string configfile = Kt.Framework.Common.HttpServerInfo.RELATIVE_ROOT_PATH + "ImageServer.config"; // TODO: 初始化为适当的值 ReadConfig x = new ReadConfig(configfile); Bind<Kt.Framework.FileServer.IUploadFile>().To<Kt.Framework.FileServer.ShareImpl.ShareUploadFile>(); Bind<Kt.Framework.FileServer.IKey>().To<Kt.Framework.FileServer.ImageFile.ImageFileKey>(); //Kt.Framework.FileServer.IKey key = Bind<Kt.Framework.FileServer.IImageFile>().To<Kt.Framework.FileServer.ImageFile.ImageUploader>(); //Kt.Framework.FileServer.IImageFile a = null; //a.SetCurrent( }