protected void ControlDataBind() { System.Data.DataTable dataSource = SystemPara.getSystemPara("CareerType"); foreach (System.Data.DataRow row in dataSource.Rows) { this.comType.Items.Add(new ListItem(row["Description"].ToString(), row["ID"].ToString())); } System.Data.DataTable EducationLevel = SystemPara.getSystemPara("EducationLevel"); foreach (System.Data.DataRow row in EducationLevel.Rows) { this.comQualification.Items.Add(new ListItem(row["Description"].ToString(), row["ID"].ToString())); } System.Data.DataTable Position = SystemPara.getSystemPara("Position"); foreach (System.Data.DataRow row in Position.Rows) { this.txtJobFunction.Items.Add(new ListItem(row["Description"].ToString(), row["ID"].ToString())); } System.Data.DataTable Division = SystemPara.getSystemPara("Division"); foreach (System.Data.DataRow row in Division.Rows) { this.txtDivision.Items.Add(new ListItem(row["Description"].ToString(), row["ID"].ToString())); } System.Data.DataTable Department = SystemPara.getSystemPara("Department"); foreach (System.Data.DataRow row in Department.Rows) { this.txtDepartment.Items.Add(new ListItem(row["Description"].ToString(), row["ID"].ToString())); } System.Data.DataTable EmploymentType = SystemPara.getSystemPara("EmploymentType"); foreach (System.Data.DataRow row in EmploymentType.Rows) { this.txtType.Items.Add(new ListItem(row["Description"].ToString(), row["ID"].ToString())); } }
/// <summary> /// 获取单个实例,通过键值获取 /// </summary> /// <param name="key"></param> /// <returns></returns> public SystemPara GetSingle(string key) { SystemPara curr = null; //从缓存中读取 List <SystemPara> list = WeiSha.Common.Cache <SystemPara> .Data.List; if (list == null) { list = this.Refresh(); } if (list == null) { return(null); } List <SystemPara> tm = (from l in list where l.Sys_Key == key select l).ToList <SystemPara>(); if (tm.Count > 0) { curr = tm[0]; } if (curr == null) { curr = Gateway.Default.From <SystemPara>().Where(SystemPara._.Sys_Key == key).ToFirst <SystemPara>(); } return(curr); }
protected void ControlDataBind() { int currentYear = DateTime.Now.Year; ddlIconExpiryYear.Items.Add(new ListItem("", "0")); ddlIconExpiryMonth.Items.Add(new ListItem("", "0")); ddlIconExpiryDay.Items.Add(new ListItem("", "0")); for (int i = currentYear - 10; i < currentYear + 10; i++) { ddlYear.Items.Add(new ListItem(i.ToString(), i.ToString())); ddlIconExpiryYear.Items.Add(new ListItem(i.ToString(), i.ToString())); } for (int i = 1; i <= 12; i++) { ddlMonth.Items.Add(new ListItem(i.ToString("00"), i.ToString("00"))); ddlIconExpiryMonth.Items.Add(new ListItem(i.ToString("00"), i.ToString("00"))); } for (int i = 1; i <= 31; i++) { ddlDay.Items.Add(new ListItem(i.ToString("00"), i.ToString("00"))); ddlIconExpiryDay.Items.Add(new ListItem(i.ToString("00"), i.ToString("00"))); } System.Data.DataTable dataSource = SystemPara.getSystemPara("NewsType"); foreach (System.Data.DataRow row in dataSource.Rows) { this.comType.Items.Add(new ListItem(row["Description"].ToString(), row["ID"].ToString())); } }
private void initTraining(int ID) { hdfID.Value = ID.ToString(); Training trainingHandler = new Training(); TrainingInfo trainingInfo = trainingHandler.getTraining(ID); txtVersionNo.InnerText = trainingInfo.VersionNo.ToString("N"); hdfVersionNo.Value = trainingInfo.VersionNo.ToString("N"); string[] serailNoArray = trainingInfo.SerialNo.Split('-'); txtSerialNo0.InnerText = serailNoArray[0] + "-" + serailNoArray[1]; txtSerialNo1.Value = serailNoArray[2]; txtSerialNo2.Value = serailNoArray[3]; txtName.Value = trainingInfo.Name; //comType.Value = trainingInfo.Type; bool isAbandoned = true; foreach (ListItem item in comType.Items) { if (item.Value == trainingInfo.Type.ToString()) { item.Selected = true; isAbandoned = false; break; } else { item.Selected = false; } } if (isAbandoned) { string description = SystemPara.getDescription(trainingInfo.Type); comType.Items.Add(new ListItem(description, trainingInfo.Type.ToString())); comType.Value = trainingInfo.Type.ToString(); } txtMaxAttendance.Value = trainingInfo.MaxAttendance.ToString(); chkOptionalAttendance.Checked = trainingInfo.OptionalAttendance; txtContactPerson.Value = trainingInfo.ContactPerson; txtDepartment.Value = trainingInfo.Department; txtDetails.Value = trainingInfo.Details; txtLocation.Value = trainingInfo.Location; txtPhoneNumber.Value = trainingInfo.PhoneNumber; txtEmail.Value = trainingInfo.Email; //txtFormPath.Value = trainingInfo.FormPath; //new icon if (trainingInfo.NewIconInfo != null) { txtIconExpiryDay.Value = trainingInfo.NewIconInfo.ExpiryDate.ToString(GlobalSetting.DateTimeFormat); } dateDeadline.Value = trainingInfo.Deadline.ToString(GlobalSetting.DateTimeFormat); }
protected void bindControl() { System.Data.DataTable dataSource = SystemPara.getSystemPara("LinkType"); foreach (System.Data.DataRow row in dataSource.Rows) { comType.Items.Add(new ListItem(row["Description"].ToString(), row["ID"].ToString())); } }
/// <summary> /// 当前参数是否存在(通过参数名判断) /// </summary> /// <param name="entity"></param> /// <returns>如果已经存在,则返回true</returns> public bool IsExists(SystemPara entity) { WhereClip wc = new WhereClip(); wc.And(SystemPara._.Sys_Key == entity.Sys_Key); int obj = Gateway.Default.Count <SystemPara>(wc && SystemPara._.Sys_Id != entity.Sys_Id); return(obj > 0); }
protected void ControlDataBind() { System.Data.DataTable EventType = SystemPara.getSystemPara("SuggestionType"); foreach (System.Data.DataRow row in EventType.Rows) { this.comSuggestionType.Items.Add(new ListItem(row["Description"].ToString(), row["ID"].ToString())); } }
protected void ControlDataBind() { System.Data.DataTable dt = SystemPara.getSystemParaType(); foreach (System.Data.DataRow row in dt.Rows) { txtSystemType.Items.Add(new ListItem(row["categorydesc"].ToString(), row["category"].ToString())); } }
private void ControlDataBind() { txtSerialNo0.Items.Add(new ListItem("All", "0")); System.Data.DataTable dt = SystemPara.getSystemPara("TrainingType", true); foreach (System.Data.DataRow row in dt.Rows) { txtSerialNo0.Items.Add(new ListItem(row["cDescription"].ToString(), row["cDescription"].ToString())); } }
/// <summary> /// 添加 /// </summary> /// <param name="entity">业务实体</param> public void Add(SystemPara entity) { if (IsExists(entity)) { throw new Exception("当前参数已经存在"); } Gateway.Default.Save <SystemPara>(entity); this.Refresh(); //重新构建系统参数的缓存 }
/// <summary> /// 根据键,获取值 /// </summary> /// <param name="key"></param> /// <returns></returns> public string GetValue(string key) { SystemPara curr = GetSingle(key); if (curr == null) { return(null); } return(!string.IsNullOrWhiteSpace(curr.Sys_Value) ? curr.Sys_Value.Trim() : curr.Sys_Default); }
private List <SystemPara> getVisonPara() { List <SystemPara> result = new List <SystemPara>(); //try { foreach (XmlNode p in Parameter.glb_Parameter.vision_machine_datas_list) { try { SystemPara para = new SystemPara(p.Name, p.InnerText, ""); para.Name = cnNames[p.Name]; string des = ""; if (cnDescription.ContainsKey(p.Name)) { cnDescription.TryGetValue(p.Name, out des); } para.Description = des; bool writeable = true; if (WriteableDict.ContainsKey(p.Name)) { WriteableDict.TryGetValue(p.Name, out writeable); } para.Writeable = writeable; if (p.InnerText.StartsWith("\"") && p.InnerText.EndsWith("\"")) { needQuote[p.Name] = true; para.Value = para.Value.Substring(1, para.Value.Length - 2); } if (des != "") { result.Add(para); } } catch (Exception e) { //SystemPara para = new SystemPara(p.Name, p.InnerText, ""); //para.Name = p.Name; //result.Add(para); } } } //catch (Exception e) //{ // Xceed.Wpf.Toolkit.MessageBox.Show("打开文档失败!\r\n" + e.Message); //} return(result); }
/// <summary> /// 修改 /// </summary> /// <param name="key">参数键</param> /// <param name="value">参数值</param> public void Save(string key, string value) { SystemPara Ps = Gateway.Default.From <SystemPara>().Where(SystemPara._.Sys_Key == key).ToFirst <SystemPara>(); //如果是一个新对象 if (Ps == null) { Ps = new SystemPara(); } Ps.Sys_Key = key; Ps.Sys_Value = value; Gateway.Default.Save <SystemPara>(Ps); this.Refresh(); //重新构建系统参数的缓存 }
/// <summary> /// 根据键,获取值 /// </summary> /// <param name="key">键值</param> /// <returns></returns> public WeiSha.Common.Param.Method.ConvertToAnyValue this[string key] { get { SystemPara curr = GetSingle(key); if (curr == null) { return(new WeiSha.Common.Param.Method.ConvertToAnyValue(null)); } string val = !string.IsNullOrWhiteSpace(curr.Sys_Value) ? curr.Sys_Value.Trim() : curr.Sys_Default; WeiSha.Common.Param.Method.ConvertToAnyValue p = new WeiSha.Common.Param.Method.ConvertToAnyValue(val); p.Unit = curr.Sys_Unit; return(p); } }
protected void Page_Load(object sender, EventArgs e) { string type = Request.QueryString["type"]; string from = Request.QueryString["from"]; string to = Request.QueryString["to"]; string[] typeIDArray = type.Split(','); string typeDesc = ""; if (type != "0") { foreach (string id in typeIDArray) { if (typeDesc == "") { typeDesc = SystemPara.getDescription(Convert.ToInt32(id)); } else { typeDesc = typeDesc + ", " + SystemPara.getDescription(Convert.ToInt32(id)); } } } DateTime fromDate = DateTime.MinValue; DateTime toDate = DateTime.MinValue; txtType.InnerText = typeDesc; DateTime.TryParseExact(from, "dd/MM/yyyy", new CultureInfo("en-US"), DateTimeStyles.None, out fromDate); DateTime.TryParseExact(to, "dd/MM/yyyy", new CultureInfo("en-US"), DateTimeStyles.None, out toDate); if (fromDate == DateTime.MinValue && toDate == DateTime.MinValue) { txtDateRange.InnerText = "ALL"; } else { txtDateRange.InnerText = (fromDate == DateTime.MinValue ? "" : fromDate.ToString("dd/MM/yyyy")) + " ~ " + (toDate == DateTime.MinValue ? "" : toDate.ToString("dd/MM/yyyy")); } reportStr = new Report().getSuggestionReport(type, fromDate, toDate, Session["LOGINID"].ToString(), Session["USERGROUP"].ToString()); }
private void ControlDataBind() { System.Data.DataTable dataSource = SystemPara.getSystemPara("TrainingType"); foreach (System.Data.DataRow row in dataSource.Rows) { this.comType.Items.Add(new ListItem(row["Description"].ToString(), row["ID"].ToString())); } formType = new System.Text.StringBuilder(); dataSource = SystemPara.getSystemPara("TrainingFormType"); foreach (System.Data.DataRow row in dataSource.Rows) { formType.Append(string.Format("<option value='{0}'>{1}</option>", row["ID"].ToString(), row["Description"].ToString())); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.setMaxLength(); this.ControlDataBind(); if (!string.IsNullOrEmpty(Request.QueryString["ID"])) { int ID = Convert.ToInt32(Request.QueryString["ID"]); this.mode = "Edit"; this.initCareer(ID); } else { this.mode = "New"; string disclaimer = SystemPara.getSystemPara("Disclaimer", false).Rows[0]["Description"].ToString(); txtDisclaimer.InnerText = disclaimer; } } }
protected void Page_Load(object sender, EventArgs e) { int ID = Convert.ToInt32(Request.QueryString["ID"]); trainingID.Value = ID.ToString(); CareerOpportunity careerOpportunityHandler = new CareerOpportunity(); CareerOpportunityInfo careerOpportunityInfo = careerOpportunityHandler.getCareerOpportunity(ID); txtCareerLevel.InnerText = careerOpportunityInfo.CareerLevel; txtQualification.InnerText = SystemPara.getDescription(careerOpportunityInfo.Qualification); txtDetails.InnerHtml = careerOpportunityInfo.Details; txtEmail.HRef = "mailto:" + careerOpportunityInfo.Email; txtEmail.InnerText = careerOpportunityInfo.Email; txtExp.InnerText = careerOpportunityInfo.Experience.ToString(); txtJobFunction.InnerText = SystemPara.getDescription(careerOpportunityInfo.JobFunction); txtDivision.InnerText = SystemPara.getDescription(careerOpportunityInfo.Division); txtDepartment.InnerText = SystemPara.getDescription(careerOpportunityInfo.Department); txtLocation.InnerText = careerOpportunityInfo.Location; //txtQualification.InnerText = SystemPara.getDescription(careerOpportunityInfo.Qualification); // txtSalary.InnerText = careerOpportunityInfo.Salary.ToString(); txtType.InnerText = SystemPara.getDescription(careerOpportunityInfo.EmploymentType); txtDisclaimer.InnerText = careerOpportunityInfo.Disclaimer; }
// 单个参数设置 public static ResultObj SetSystemSettingSingleParaService(SystemPara systemPara) { ResultObj resultObj = new ResultObj(); //var channel = new Channel(GrpcChannelAddress, ChannelCredentials.Insecure); //var client = new gRPCClient(channel); //ControlResult result = client.setSystemSettingPara(systemPara); //// 日志输出 //if (result.Result.Equals("1")) //{ // log.Info($"参数设置成功:{systemPara.ParaName},{systemPara.ParaValue}"); // resultObj.IsSuccess = true; //} //else //{ // log.Info($"参数设置失败:{systemPara.ParaName},{systemPara.ParaValue}"); // resultObj.IsSuccess = false; //} // 测试数据 resultObj.IsSuccess = true; return(resultObj); }
// 系统参数设置 public static void SetSystemSettingParaService(CmsSystemSetting obj) { var channel = new Channel(GrpcChannelAddress, ChannelCredentials.Insecure); var client = new gRPCClient(channel); foreach (PropertyInfo p in obj.GetType().GetProperties()) { object value = p.GetValue(obj); // 处理是否 if (value != null && p.PropertyType == typeof(string)) { if (value.ToString().Equals("是")) { value = 1; } else if (value.ToString().Equals("否")) { value = 0; } SystemPara systemPara = new SystemPara(); systemPara.ParaName = p.Name; systemPara.ParaValue = value.ToString(); ControlResult result = client.setSystemSettingPara(systemPara); // 日志输出 if (result.Result.Equals("1")) { log.Info($"参数设置成功:{systemPara.ParaName},{systemPara.ParaValue}"); } else { log.Info($"参数设置失败:{systemPara.ParaName},{systemPara.ParaValue}"); } } } }
public System.Text.StringBuilder getLatestCareerOpportunitiesStr(int total) { List <CareerOpportunityInfo> latestCareerOpportunityList = this.getLatestCareerOpportunities(0); System.Text.StringBuilder careerOpportunities = new System.Text.StringBuilder(); int lastDivision = 0; careerOpportunities.Append("<ul class='list'>"); int count = 0; foreach (CareerOpportunityInfo careerOppty in latestCareerOpportunityList) { if (count == total && total != 0) { break; } if (lastDivision == 0) { careerOpportunities.Append("<li><a>"); careerOpportunities.Append(SystemPara.getDescription(careerOppty.Division)); //careerOpportunities.Append(careerOppty.Division); careerOpportunities.Append("</a>"); careerOpportunities.Append("<ul class='margin20px'>"); lastDivision = careerOppty.Division; count++; } else if (lastDivision != 0 && lastDivision != careerOppty.Division) { careerOpportunities.Append("</ul>"); careerOpportunities.Append("</li>"); careerOpportunities.Append("<li><a>"); careerOpportunities.Append(SystemPara.getDescription(careerOppty.Division)); careerOpportunities.Append("</a>"); careerOpportunities.Append("<ul class='margin20px'>"); lastDivision = careerOppty.Division; count++; } if (careerOppty.NewIconInfo != null) { careerOpportunities.Append("<li class='file newIcon'><a href=ViewCareer.aspx?ID="); } else { careerOpportunities.Append("<li class='file'><a href=ViewCareer.aspx?ID="); } careerOpportunities.Append(careerOppty.ID.ToString()); careerOpportunities.Append(">"); careerOpportunities.Append(SystemPara.getDescription(careerOppty.JobFunction)); careerOpportunities.Append("</a>"); careerOpportunities.Append("</li>"); } careerOpportunities.Append("</ul>"); careerOpportunities.Append("</li>"); careerOpportunities.Append("</ul>"); return(careerOpportunities); }
public string getSuggestionReport(string type, DateTime from, DateTime to, string loginID, string userGroup) { bool blankFromDate = from == DateTime.MinValue; bool blankToDate = to == DateTime.MinValue; int eventTotal = 0; System.Text.StringBuilder strBuilder = new System.Text.StringBuilder(); string sql = "select " + "UserName \"User Name\", " + "Email, " + "Suggestion, " + "Convert(varchar,CreateDate, 103) + ' ' + " + "left(Convert(varchar,CreateDate, 114),5) \"Date & Time\" " + "from Suggestion " + "where Type in (" + type + ") " + (blankFromDate ? "" : "and cast(CreateDate As Date) >= @StartTime ") + (blankToDate ? "" : "and cast(CreateDate As Date) <= @EndTime "); Dictionary <string, object> dict = new Dictionary <string, object>(); dict.Add("@Category", GlobalSetting.ArticleCategory.Training); dict.Add("@LoginID", loginID); if (!blankFromDate) { dict.Add("@StartTime", from); } if (!blankToDate) { dict.Add("@EndTime", to); } dbAccess.open(); try { System.Data.DataTable dt = dbAccess.select(sql, dict); strBuilder.Append("<table class='ReportTable'>"); strBuilder.Append("<tr>"); foreach (System.Data.DataColumn col in dt.Columns) { if (col.ColumnName == "ID") { continue; } strBuilder.Append("<th>"); strBuilder.Append(col.ColumnName); strBuilder.Append("</th>"); } strBuilder.Append("</tr>"); foreach (System.Data.DataRow row in dt.Rows) { eventTotal++; strBuilder.Append("<tr>"); foreach (System.Data.DataColumn col in dt.Columns) { if (col.ColumnName == "ID") { continue; } strBuilder.Append("<td>"); if (col.ColumnName == "Type") { strBuilder.Append(SystemPara.getDescription(Convert.ToInt32(row[col.ColumnName]))); } else { strBuilder.Append(row[col.ColumnName].ToString()); } strBuilder.Append("</td>"); } strBuilder.Append("</tr>"); } strBuilder.Append("</table>"); strBuilder.Append("<br/><div><span>Suggestion Total: </span>" + eventTotal.ToString() + "<div>"); } catch { throw; } finally { dbAccess.close(); } return(strBuilder.ToString()); }
protected void Page_Load(object sender, EventArgs e) { initControl(); string serialNo = Request.QueryString["serialNo"]; string name = Request.QueryString["name"]; string from = Request.QueryString["from"]; string to = Request.QueryString["to"]; string type = Request.QueryString["type"]; string decision = Request.QueryString["decision"]; DateTime fromDate = DateTime.MinValue; DateTime toDate = DateTime.MinValue; string[] typeIDArray = type.Split(','); string[] decisionArray = decision.Split(','); string typeDesc = ""; string decisionDesc = ""; if (type != "0") { foreach (string id in typeIDArray) { if (typeDesc == "") { typeDesc = SystemPara.getDescription(Convert.ToInt32(id)); } else { typeDesc = typeDesc + ", " + SystemPara.getDescription(Convert.ToInt32(id)); } } } if (decision != "'0'") { foreach (string decisionItem in decisionArray) { if (decisionDesc == "") { decisionDesc = (decisionItem == "'NotAttend'" ? "Not Attend" : decisionItem.Replace("'", "")); } else { decisionDesc = decisionDesc + ", " + (decisionItem == "'NotAttend'" ? "Not Attend" : decisionItem.Replace("'", "")); } } } txtType.InnerText = typeDesc; txtDecision.InnerText = decisionDesc; if (string.IsNullOrEmpty(serialNo)) { txtSerialNo.InnerText = "ALL"; } else { txtSerialNo.InnerText = serialNo; } if (string.IsNullOrEmpty(name)) { txtName.InnerText = "ALL"; } else { txtName.InnerText = name; } DateTime.TryParseExact(from, "dd/MM/yyyy", new CultureInfo("en-US"), DateTimeStyles.None, out fromDate); DateTime.TryParseExact(to, "dd/MM/yyyy", new CultureInfo("en-US"), DateTimeStyles.None, out toDate); if (fromDate == DateTime.MinValue && toDate == DateTime.MinValue) { txtDateRange.InnerText = "ALL"; } else { txtDateRange.InnerText = (fromDate == DateTime.MinValue ? "" : fromDate.ToString("dd/MM/yyyy")) + " ~ " + (toDate == DateTime.MinValue ? "" : toDate.ToString("dd/MM/yyyy")); } reportStr = new Report().getEventReport(serialNo, type, decision, name, fromDate, toDate, Session["LOGINID"].ToString(), Session["USERGROUP"].ToString()); }
protected void initCareer(int ID) { hdfID.Value = ID.ToString(); CareerOpportunity careerOpportunity = new CareerOpportunity(); CareerOpportunityInfo careerOpportunityInfo = careerOpportunity.getCareerOpportunity(ID); txtVersionNo.InnerText = careerOpportunityInfo.VersionNo.ToString("N"); string[] serialNoArray = careerOpportunityInfo.SerialNo.Split('-'); txtSerialNo0.InnerText = serialNoArray[0] + "-" + serialNoArray[1]; txtSerialNo1.Value = serialNoArray[2]; txtSerialNo2.Value = serialNoArray[3]; //comType.Value = careerOpportunityInfo.Type; //new icon if (careerOpportunityInfo.NewIconInfo != null) { txtIconExpiryDay.Value = careerOpportunityInfo.NewIconInfo.ExpiryDate.ToString(GlobalSetting.DateTimeFormat); } bool isAbandoned = true; foreach (ListItem item in comType.Items) { if (item.Value == careerOpportunityInfo.Type.ToString()) { item.Selected = true; isAbandoned = false; break; } else { item.Selected = false; } } if (isAbandoned) { string description = SystemPara.getDescription(careerOpportunityInfo.Type); comType.Items.Add(new ListItem(description, careerOpportunityInfo.Type.ToString())); comType.Value = careerOpportunityInfo.Type.ToString(); } txtCareerLevel.Value = careerOpportunityInfo.CareerLevel; txtExp.Value = (careerOpportunityInfo.Experience + 100.001).ToString().Substring(1, 5); //comQualification.Value = careerOpportunityInfo.Qualification.ToString(); isAbandoned = true; foreach (ListItem item in comQualification.Items) { if (item.Value == careerOpportunityInfo.Qualification.ToString()) { item.Selected = true; isAbandoned = false; break; } else { item.Selected = false; } } if (isAbandoned) { string description = SystemPara.getDescription(careerOpportunityInfo.Qualification); comQualification.Items.Add(new ListItem(description, careerOpportunityInfo.Qualification.ToString())); comQualification.Value = careerOpportunityInfo.Qualification.ToString(); } /////---------------1 isAbandoned = true; foreach (ListItem item in txtJobFunction.Items) { if (item.Value == careerOpportunityInfo.JobFunction.ToString()) { item.Selected = true; isAbandoned = false; break; } else { item.Selected = false; } } if (isAbandoned) { string description = SystemPara.getDescription(careerOpportunityInfo.JobFunction); txtJobFunction.Items.Add(new ListItem(description, careerOpportunityInfo.JobFunction.ToString())); txtJobFunction.Value = careerOpportunityInfo.JobFunction.ToString(); } /////--------------- /////---------------2 isAbandoned = true; foreach (ListItem item in txtDivision.Items) { if (item.Value == careerOpportunityInfo.Division.ToString()) { item.Selected = true; isAbandoned = false; break; } else { item.Selected = false; } } if (isAbandoned) { string description = SystemPara.getDescription(careerOpportunityInfo.Division); txtDivision.Items.Add(new ListItem(description, careerOpportunityInfo.Division.ToString())); txtDivision.Value = careerOpportunityInfo.Division.ToString(); } /////--------------- /////---------------3 isAbandoned = true; foreach (ListItem item in txtDepartment.Items) { if (item.Value == careerOpportunityInfo.Department.ToString()) { item.Selected = true; isAbandoned = false; break; } else { item.Selected = false; } } if (isAbandoned) { string description = SystemPara.getDescription(careerOpportunityInfo.Department); txtDepartment.Items.Add(new ListItem(description, careerOpportunityInfo.Department.ToString())); txtDepartment.Value = careerOpportunityInfo.Department.ToString(); } /////--------------- /////---------------4 isAbandoned = true; foreach (ListItem item in txtType.Items) { if (item.Value == careerOpportunityInfo.EmploymentType.ToString()) { item.Selected = true; isAbandoned = false; break; } else { item.Selected = false; } } if (isAbandoned) { string description = SystemPara.getDescription(careerOpportunityInfo.EmploymentType); txtType.Items.Add(new ListItem(description, careerOpportunityInfo.EmploymentType.ToString())); txtType.Value = careerOpportunityInfo.EmploymentType.ToString(); } /////--------------- //txtJobFunction.Value = careerOpportunityInfo.JobFunction; //txtDivision.Value = careerOpportunityInfo.Division; //txtDepartment.Value = careerOpportunityInfo.Department; txtLocation.Value = careerOpportunityInfo.Location; //txtType.Value = careerOpportunityInfo.EmploymentType; txtEmail.Value = careerOpportunityInfo.Email; txtDetails.Value = careerOpportunityInfo.Details; txtDisclaimer.Value = careerOpportunityInfo.Disclaimer; }
// 自动处理二维码信息 public ResultObj AutoOperQrCode(string jsonStrData) { ResultObj resultObj = new ResultObj(); string msg = ""; string tempStr; try { // 序列化为JObject JObject jObject = JsonConvert.DeserializeObject <JObject>(jsonStrData); if (jObject == null) { tempStr = "序列化对象为空:" + jsonStrData; log.Info(tempStr); msg += tempStr + "\n"; resultObj.IsSuccess = false; resultObj.Msg = msg; return(resultObj); } // 解析工单数据 JObject jObjectWork = jObject.Value <JObject>("System"); if (jObjectWork == null) { tempStr = "序列化工单数据为空:" + jObject.Value <string>("System"); log.Info(tempStr); msg += tempStr + "\n"; resultObj.IsSuccess = false; resultObj.Msg = msg; return(resultObj); } // 接收到新的二维码,Web后台需在拿到二维码字符串后,清除此位 int RecvNewQrCode = jObjectWork.Value <int>("RecvNewQrCode"); tempStr = "RecvNewQrCode:" + RecvNewQrCode; log.Info(tempStr); msg += tempStr + "\n"; if (RecvNewQrCode == 1) { // 接收到的二维码 string QrCode = jObjectWork.Value <string>("QrCode"); tempStr = "QrCode为:" + QrCode; log.Info(tempStr); msg += tempStr + "\n"; // 获取操作等级 int operationLevel = QRCodeEncoder.GetOperationLevel(QrCode); // 通过Grpc修改参数 SystemPara systemPara = new SystemPara(); systemPara.ParaName = "OperationLevel"; systemPara.ParaValue = operationLevel.ToString(); // 操作等级,需由Web后台根据识别二维码的结果后设置此变量,0无 1拉油工单 2操作员 3管理员 ResultObj setParamsResult = StationControlService.SetSystemSettingSingleParaService(systemPara); if (setParamsResult.IsSuccess == false) { tempStr = "修改参数OperationLevel失败!"; log.Info(tempStr); msg += tempStr + "\n"; resultObj.IsSuccess = false; resultObj.Msg = msg; return(resultObj); } // 判断是否是工单二维码 if (QRCodeEncoder.IsWorkTicket(QrCode) == false) { tempStr = "工单二维码解析不正确:" + QrCode; log.Info(tempStr); msg += tempStr + "\n"; resultObj.IsSuccess = false; resultObj.Msg = msg; return(resultObj); } string SerialNumber = QrCode.Split(":")[1]; tempStr = "解析出的工单编号为:" + SerialNumber; log.Info(tempStr); msg += tempStr + "\n"; // 根据工单编号和工单状态查询工单 DbContextOptions <H4WebContext> dbContextOption = new DbContextOptions <H4WebContext>(); DbContextOptionsBuilder <H4WebContext> dbContextOptionBuilder = new DbContextOptionsBuilder <H4WebContext>(dbContextOption); H4WebContext _context = new H4WebContext(dbContextOptionBuilder.UseNpgsql(_configuration.GetConnectionString("PostgreSql")).Options); var obj = _context.WorkTicket.Where(p => p.SerialNumber.Equals(SerialNumber) && p.Status.Equals(WorkTicketStatus.待拉油.ToString())).FirstOrDefault(); if (obj == null) { tempStr = "满足条件的工单不存在(工单编号" + SerialNumber + ",状态待拉油)"; log.Info(tempStr); msg += tempStr + "\n"; resultObj.IsSuccess = false; resultObj.Msg = msg; return(resultObj); } // 通过Grpc修改参数 systemPara = new SystemPara(); systemPara.ParaName = "WorkTicketInfo"; systemPara.ParaValue = JsonConvert.SerializeObject(obj); // Web后台将工单信息写入PLC,此字符串,0~49位为工单编号,50~59为司机姓名,60~69为车牌号,70~90为联系方式 setParamsResult = StationControlService.SetSystemSettingSingleParaService(systemPara); if (setParamsResult.IsSuccess == false) { tempStr = "修改参数WorkTicketInfo失败!"; log.Info(tempStr); msg += tempStr + "\n"; resultObj.IsSuccess = false; resultObj.Msg = msg; return(resultObj); } // 通过Grpc修改参数 systemPara.ParaName = "WorkTicketDateTime"; systemPara.ParaValue = obj.LoadingBeginTime.ToString(); // 工单上的拉油时间 setParamsResult = StationControlService.SetSystemSettingSingleParaService(systemPara); if (setParamsResult.IsSuccess == false) { tempStr = "修改参数WorkTicketDateTime失败!"; log.Info(tempStr); msg += tempStr + "\n"; resultObj.IsSuccess = false; resultObj.Msg = msg; return(resultObj); } // 通过Grpc修改参数 systemPara.ParaName = "TankSelect"; systemPara.ParaValue = obj.OilPot.Equals("1#罐") ? "1" : "2"; // 工单上的拉油时间 setParamsResult = StationControlService.SetSystemSettingSingleParaService(systemPara); if (setParamsResult.IsSuccess == false) { tempStr = "修改参数TankSelect失败!"; log.Info(tempStr); msg += tempStr + "\n"; resultObj.IsSuccess = false; resultObj.Msg = msg; return(resultObj); } // 通过Grpc修改参数 systemPara.ParaName = "MaxOilCanLoad"; systemPara.ParaValue = obj.OilLoadedMax.ToString(); // 工单上的最大拉液量 setParamsResult = StationControlService.SetSystemSettingSingleParaService(systemPara); if (setParamsResult.IsSuccess == false) { tempStr = "修改参数MaxOilCanLoad失败!"; log.Info(tempStr); msg += tempStr + "\n"; resultObj.IsSuccess = false; resultObj.Msg = msg; return(resultObj); } // 通过Grpc修改参数 systemPara.ParaName = "SendWorkTicket"; systemPara.ParaValue = "1"; // 如识别到二维码为工单信息后,将工单信息给PLC,置此位为1,由PLC侧清除此痊 setParamsResult = StationControlService.SetSystemSettingSingleParaService(systemPara); if (setParamsResult.IsSuccess == false) { tempStr = "修改参数SendWorkTicket失败!"; log.Info(tempStr); msg += tempStr + "\n"; resultObj.IsSuccess = false; resultObj.Msg = msg; return(resultObj); } // 通过Grpc修改参数 systemPara.ParaName = "RecvNewQrCode"; systemPara.ParaValue = "0"; // 接收到新的二维码,Web后台需在拿到二维码字符串后,清除此位 setParamsResult = StationControlService.SetSystemSettingSingleParaService(systemPara); if (setParamsResult.IsSuccess == false) { tempStr = "修改参数RecvNewQrCode失败!"; log.Info(tempStr); msg += tempStr + "\n"; resultObj.IsSuccess = false; resultObj.Msg = msg; return(resultObj); } tempStr = "自动处理二维码信息完成。"; log.Info(tempStr); msg += tempStr + "\n"; resultObj.IsSuccess = true; resultObj.KeyInfo = obj.SerialNumber; resultObj.Msg = msg; return(resultObj); } else { tempStr = "没有新的二维码信息。"; log.Info(tempStr); msg += tempStr + "\n"; resultObj.IsSuccess = false; resultObj.Msg = msg; return(resultObj); } } catch (Exception e) { tempStr = "自动处理二维码发生异常:" + e.Message; log.Info(tempStr); msg += tempStr + "\n"; resultObj.IsSuccess = false; resultObj.Msg = msg; return(resultObj); } }
protected void initArticle(int ID) { hdfID.Value = ID.ToString(); News newsHandler = new News(); NewsInfo newInfo = newsHandler.getArticle(ID); txtVersionNo.InnerText = newInfo.VersionNo.ToString("N"); string[] serialNos = newInfo.SerialNo.Split('-'); txtSerialNo0.InnerText = serialNos[0] + "-" + serialNos[1]; txtSerialNo1.Value = serialNos[2]; txtSerialNo2.Value = serialNos[3]; // comType.Value = newInfo.Type; bool isAbandoned = true; foreach (ListItem item in comType.Items) { if (item.Value == newInfo.Type.ToString()) { item.Selected = true; isAbandoned = false; break; } else { item.Selected = false; } } if (isAbandoned) { string description = SystemPara.getDescription(newInfo.Type); comType.Items.Add(new ListItem(description, newInfo.Type.ToString())); comType.Value = newInfo.Type.ToString(); } txtTitle.Value = newInfo.Title; txtHeadline.Value = newInfo.Headline; txtSummary.Value = newInfo.Summary; txtMainBody.Value = newInfo.Content; ddlYear.SelectedIndex = -1; ddlMonth.SelectedIndex = -1; ddlDay.SelectedIndex = -1; foreach (ListItem item in ddlYear.Items) { if (item.Value == newInfo.EffectiveDate.Year.ToString()) { item.Selected = true; break; } } foreach (ListItem item in ddlMonth.Items) { if (item.Value == newInfo.EffectiveDate.Month.ToString("00")) { item.Selected = true; break; } } foreach (ListItem item in ddlDay.Items) { if (item.Value == newInfo.EffectiveDate.Day.ToString("00")) { item.Selected = true; break; } } if (newInfo.NewIconInfo != null) { ddlIconExpiryYear.SelectedIndex = -1; ddlIconExpiryMonth.SelectedIndex = -1; ddlIconExpiryDay.SelectedIndex = -1; foreach (ListItem item in ddlIconExpiryYear.Items) { if (item.Value == newInfo.NewIconInfo.ExpiryDate.Year.ToString()) { item.Selected = true; break; } } foreach (ListItem item in ddlIconExpiryMonth.Items) { if (item.Value == newInfo.NewIconInfo.ExpiryDate.Month.ToString("00")) { item.Selected = true; break; } } foreach (ListItem item in ddlIconExpiryDay.Items) { if (item.Value == newInfo.NewIconInfo.ExpiryDate.Day.ToString("00")) { item.Selected = true; break; } } } }
// 自动处理工单方法 public ResultObj AutoOperWorkTicket(string jsonStrData) { ResultObj resultObj = new ResultObj(); string msg = ""; string tempStr; try { // 序列化为JObject JObject jObject = JsonConvert.DeserializeObject <JObject>(jsonStrData); if (jObject == null) { tempStr = "序列化对象为空:" + jsonStrData; log.Info(tempStr); msg += tempStr + "\n"; resultObj.IsSuccess = false; resultObj.Msg = msg; return(resultObj); } // 解析工单数据 JObject jObjectWork = jObject.Value <JObject>("System"); if (jObjectWork == null) { tempStr = "序列化工单数据为空:" + jObject.Value <string>("System"); log.Info(tempStr); msg += tempStr + "\n"; resultObj.IsSuccess = false; resultObj.Msg = msg; return(resultObj); } // 拉油完成后,此变量会置1,需将拉油相关信息,如拉油时长、拉液量等保存后,清除此位 int AckTaskComplete = jObjectWork.Value <int>("AckTaskComplete"); tempStr = "AckTaskComplete的值为:" + AckTaskComplete; log.Info(tempStr); msg += tempStr + "\n"; if (AckTaskComplete == 1) { TimeSpan interval; // 实际开始拉油时间 DateTime StartLoadingTime = jObjectWork.Value <DateTime>("StartLoadingTime"); interval = DateTime.Now - StartLoadingTime; // 计算开始拉油时间和当前时间的时间差(天) if (interval.TotalDays > 1 || interval.TotalDays < 0) { tempStr = "实际开始拉油时间StartLoadingTime不合理:" + StartLoadingTime; log.Info(tempStr); msg += tempStr + "\n"; resultObj.IsSuccess = false; resultObj.Msg = msg; return(resultObj); } // 实际结束拉油时间 DateTime StopLoadingTime = jObjectWork.Value <DateTime>("StopLoadingTime"); interval = DateTime.Now - StopLoadingTime; // 计算结束拉油时间和当前时间的时间差(天) if (interval.TotalDays > 1 || interval.TotalDays < 0) { tempStr = "实际结束拉油时间StopLoadingTime不合理:" + StopLoadingTime; log.Info(tempStr); msg += tempStr + "\n"; resultObj.IsSuccess = false; resultObj.Msg = msg; return(resultObj); } // 开始时间和结束时间差计算(天) interval = StopLoadingTime - StartLoadingTime; if (interval.TotalDays > 1 || interval.TotalDays < 0) { tempStr = "实际开始拉油时间StartLoadingTime:" + StartLoadingTime + ",实际结束拉油时间StopLoadingTime:" + StopLoadingTime + "时间顺序不合理"; log.Info(tempStr); msg += tempStr + "\n"; resultObj.IsSuccess = false; resultObj.Msg = msg; return(resultObj); } // 实际拉液量 float OilLoaded = jObjectWork.Value <float>("OilLoaded"); if (OilLoaded <= 0) { tempStr = "实际拉液量不合理:" + OilLoaded; log.Info(tempStr); msg += tempStr + "\n"; resultObj.IsSuccess = false; resultObj.Msg = msg; return(resultObj); } // 接收到的二维码 string QrCode = jObjectWork.Value <string>("QrCode"); tempStr = "QrCode为:" + QrCode; log.Info(tempStr); msg += tempStr + "\n"; // 判断是否是工单二维码 if (QRCodeEncoder.IsWorkTicket(QrCode) == false) { tempStr = "工单二维码解析不正确:" + QrCode; log.Info(tempStr); msg += tempStr + "\n"; resultObj.IsSuccess = false; resultObj.Msg = msg; return(resultObj); } string SerialNumber = QrCode.Split(":")[1]; tempStr = "解析出的工单编号为:" + SerialNumber; log.Info(tempStr); msg += tempStr + "\n"; // 根据工单编号和工单状态查询工单 DbContextOptions <H4WebContext> dbContextOption = new DbContextOptions <H4WebContext>(); DbContextOptionsBuilder <H4WebContext> dbContextOptionBuilder = new DbContextOptionsBuilder <H4WebContext>(dbContextOption); H4WebContext _context = new H4WebContext(dbContextOptionBuilder.UseNpgsql(_configuration.GetConnectionString("PostgreSql")).Options); var obj = _context.WorkTicket.Where(p => p.SerialNumber.Equals(SerialNumber) && p.Status.Equals(WorkTicketStatus.待拉油.ToString())).FirstOrDefault(); if (obj == null) { tempStr = "满足条件的工单不存在(工单编号" + SerialNumber + ",状态待拉油)"; log.Info(tempStr); msg += tempStr + "\n"; resultObj.IsSuccess = false; resultObj.Msg = msg; return(resultObj); } // 如果工单存在则修改工单 obj.LoadingActualBeginTime = StartLoadingTime; obj.LoadingActualEndTime = StopLoadingTime; obj.OilLoaded = OilLoaded; obj.OilLoader = obj.DriverPhone; obj.Status = WorkTicketStatus.待卸油.ToString(); obj.Description = obj.Description + "\n【拉油】操作人:" + obj.DriverPhone + ",时间:" + DateTime.Now; obj.LastUpdateTime = DateTime.Now; obj.LastUpdateUser = obj.DriverPhone; _context.WorkTicket.Update(obj); _context.SaveChanges(); // 通过Grpc修改参数 SystemPara systemPara = new SystemPara(); systemPara.ParaName = "AckTaskComplete"; systemPara.ParaValue = "0"; // 拉油完成后,此变量会置1,需将拉油相关信息,如拉油时长、拉液量等保存后,清除此位 ResultObj setParamsResult = StationControlService.SetSystemSettingSingleParaService(systemPara); if (setParamsResult.IsSuccess == false) { tempStr = "修改参数AckTaskComplete失败!"; log.Info(tempStr); msg += tempStr + "\n"; resultObj.IsSuccess = false; resultObj.Msg = msg; return(resultObj); } tempStr = "自动处理工单成功。"; log.Info(tempStr); msg += tempStr + "\n"; resultObj.IsSuccess = true; resultObj.KeyInfo = obj.SerialNumber; resultObj.Msg = msg; return(resultObj); } else { tempStr = "不用处理工单。"; log.Info(tempStr); msg += tempStr + "\n"; resultObj.IsSuccess = false; resultObj.Msg = msg; return(resultObj); } } catch (Exception e) { tempStr = "自动处理工单发生异常:" + e.Message; log.Info(tempStr); msg += tempStr + "\n"; resultObj.IsSuccess = false; resultObj.Msg = msg; return(resultObj); } }
/// <summary> /// 删除 /// </summary> /// <param name="entity">业务实体</param> public void Delete(SystemPara entity) { Gateway.Default.Delete <SystemPara>(entity); this.Refresh(); //重新构建系统参数的缓存 }
protected void initTraining(int ID) { hdfID.Value = ID.ToString(); Event eventHandler = new Event(); EventInfo eventInfo = eventHandler.getEvent(ID); txtVersionNo.InnerText = eventInfo.VersionNo.ToString("N"); string[] serialNoArray = eventInfo.SerialNo.Split('-'); txtSerialNo0.InnerText = serialNoArray[0] + "-" + serialNoArray[1]; txtSerialNo1.Value = serialNoArray[2]; txtSerialNo2.Value = serialNoArray[3]; // comType.Value = eventInfo.Type; bool isAbandoned = true; foreach (ListItem item in comType.Items) { if (item.Value == eventInfo.Type.ToString()) { item.Selected = true; isAbandoned = false; break; } else { item.Selected = false; } } if (isAbandoned) { string description = SystemPara.getDescription(eventInfo.Type); comType.Items.Add(new ListItem(description, eventInfo.Type.ToString())); comType.Value = eventInfo.Type.ToString(); } txtName.Value = eventInfo.Name; txtContactPerson.Value = eventInfo.ContactPerson; txtDepartment.Value = eventInfo.Department; txtEventDetails.Value = eventInfo.EventDetails; txtLocation.Value = eventInfo.Location; txtPhoneNumber.Value = eventInfo.PhoneNumber; dateStartDate.Value = eventInfo.StartTime.ToString("dd/MM/yyyy"); dateStartTime.Value = eventInfo.StartTime.ToString("HH:mm"); dateEndTime.Value = eventInfo.EndTime.ToString("HH:mm"); dateDeadline.Value = eventInfo.Deadline.ToString("dd/MM/yyyy"); //new icon if (eventInfo.NewIconInfo != null) { txtIconExpiryDay.Value = eventInfo.NewIconInfo.ExpiryDate.ToString(GlobalSetting.DateTimeFormat); } this.isPublicHoliday = eventInfo.IsPublicHoliday(); if (isPublicHoliday) { dateStartTime.Value = ""; dateEndTime.Value = ""; dateDeadline.Value = ""; } }