static void Main(String[] args) { // 14. Cara menginstansiasi kelas baru PublicClass publicClass = new PublicClass(); // 15. Cara memanggil method dengan parameter publicClass.setPrivateInt(13); // 16. Cara memanggil method dan mendapatkan return value-nya System.Console.WriteLine("[13] publicClass.getPrivateInt() = " + publicClass.getPrivateInt()); // 17. Cara mengubah isi atribut publik dari luar kelas publicClass.publicString = "World!"; // 18. Cara mendapatkan isi atribut publik dari luar kelas System.Console.WriteLine("[World!] publicClass.publicString = " + publicClass.publicString); // 19. Cara mengisi nilai atribut statik PublicClass.staticInt = 10; // 20. Cara mendapatkan nilai atribut statik System.Console.WriteLine("[10] PublicClass.staticInt = " + PublicClass.staticInt); // 21. Cara mendapatkan nilai konstanta System.Console.WriteLine("[3.14] PublicClass.PI = " + PublicClass.PI); // 22. Cara menginstansiasi kelas dengan turunannya PublicClass publicSubClass = new PublicSubClass(); publicSubClass.setPrivateInt(13); // 23. Memastikan method overriding bekerja System.Console.WriteLine("[26] publicSubClass.getPrivateInt() = " + publicSubClass.getPrivateInt()); }
public void TestFormat() { Assert.ExpectAsserts(1); PublicClass testee = new PublicClass(); string s = testee.Format(0); Assert.AreEqual(s, "0", "Expected '0' for result."); }
public void Fill_TrlRoute_PointWise() { try { DataTable dt = new DataTable(); dt = RouteConn.getdata(CommandType.Text, "select distinct a.Id,a.Route_Name,a.Route_Level,b.Type_ID from route_data a left join route_data1 b on a.id=b.ID where Route_Level='" + CmbLevel.Text.Trim().ToString() + "' and databasename='" + PublicClass.User_DataBase + "' "); DataTable dtt = new DataTable(); dtt = RouteConn.getdata(CommandType.Text, "select distinct a.Id ,a.Route_Name from route_data a left join route_data1 b on a.id=b.ID where Route_Level='" + CmbLevel.Text.Trim().ToString() + "' and databasename='" + PublicClass.User_DataBase + "' "); foreach (DataRow drr in dtt.Rows) { TreeListNode node = null; node = trlRoute11.AppendNode(new object[] { Convert.ToString(drr["Id"]), Convert.ToString(drr["Route_Name"]), "Route" }, node); trlRoute11.SetFocusedNode(node); foreach (DataRow dr in dt.Select("Id ='" + Convert.ToString(drr["Id"]).Trim() + "' ")) { Insert_Point(PublicClass.DefVal(Convert.ToString(dr["Type_ID"]), "0")); } } } catch { } }
private void SendEmail(string strName, string strpw, string strid, string coname) { PublicClass pc = new PublicClass(); string Subject = "登录密码"; //读取HTML模板,即发送的页面 string strPath = System.Web.HttpContext.Current.Server.MapPath("~/email_fetchpw.htm"); //读取文件,“System.Text.Encoding.Default”可以解决中文乱码问题 StreamReader sr = new StreamReader(strPath, System.Text.Encoding.Default); StringBuilder body = new StringBuilder(); body.Append(sr.ReadToEnd()); sr.Close(); //关闭文件流 body = body.Replace("<%customname%>", strName); //替换指定内容,通常为需要变动的内容 body = body.Replace("<%password%>", strpw); body = body.Replace("<%customid%>", strid); body = body.Replace("<%coname%>", coname); body = body.Replace("<%date%>", DateTime.Now.ToShortDateString()); //pc.SendSMTPEMail("smtp.sina.com", "*****@*****.**", "lyx_password", this.TextBox1.Text, "标题", "内容"); pc.SendsettingEMail(this.TextBox1.Text, Subject, body.ToString().Trim()); }
private void tsbtn借阅登记_Click(object sender, EventArgs e) { if (ArchivesInfo.Count > 0 && this.dgvTempBorrow.Rows.Count > 0) { if (Exist(ArchivesInfo)) { BorrowInput borrowinput = new BorrowInput(); borrowinput.DeptID = DeptID; borrowinput.ArchivesInfo = ArchivesInfo; borrowinput.ShowDialog(); if (borrowinput.DialogResult == DialogResult.OK) { this.PrintForm = borrowinput.PrintForm; //清空待借信息 ArchivesInfo.Clear(); PublicClass.setBorrowToClient(UserID, ArchivesInfo); this.DialogResult = DialogResult.OK; //this.Close(); } } } }
//显示所有节点 private void tsmi所有节点_Click(object sender, EventArgs e) { if (!tsmi所有节点.Checked) { tsmi所有节点.Checked = true; tsmi部分节点.Checked = false; chkShowType.Checked = false; ShowType = 1; //显示所以节点 PublicClass.setTreeViewCss(UserID, ShowType); //储存配置 //刷新节点 cjda.BoundTopClass(tview, TopClassID); if (tview.Nodes.Count > 0) { TreeNode node = tview.Nodes[0]; cjda.Init(node, splitContainer1, out flag, ref tmpForm, DeptID); node.Expand(); } lblName.Text = flag; tview.Focus(); } }
void dgvFile_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) { string columnName = dgvFile.Columns[e.ColumnIndex].Name; //设置时间格式 if (columnName == "归档时间") { if (e.Value != null) { string oldValue = e.Value.ToString(); e.Value = PublicClass.getDateTime(oldValue); } } //设置存放地址格式 if (columnName == "柜架号") { if (e.Value != null) { string oldValue = e.Value.ToString(); e.Value = PublicClass.getAddress(oldValue); } } }
private void cmdPrn_Click(object sender, EventArgs e) { DialogResult drt = MessageBox.Show("是否确认打印?", "提示", MessageBoxButtons.YesNo); if (drt == DialogResult.No) { return; } //if (StationName == "ATPU-U800") //{ // PublicClass.PrintTmFz1(txtLsh.Text.Trim().ToUpper(), txtSo.Text.Trim().ToUpper(), txtYh.Text, txtYHH.Text, txtJx.Text.Trim().ToUpper(), 2); //} //else if (StationName == "ATPU-F10") //{ // PublicClass.PrintTmWSx(txtLsh.Text.Trim().ToUpper(), txtSo.Text.Trim().ToUpper(), txtYh.Text, txtYHH.Text, txtJx.Text.Trim().ToUpper(), 2); //} //else PublicClass.PrintWTmFzSg(txtLsh.Text.Trim().ToUpper(), txtSo.Text.Trim().ToUpper(), txtYh.Text, txtYHH.Text, txtJx.Text.Trim().ToUpper(), 2, txtPlan.Text.Trim().ToUpper()); if (LoginInfo.StationInfo.STATION_NAME == "ATPU-U800" || LoginInfo.StationInfo.STATION_NAME == "EFZSXTM") { PrntHg(txtLsh.Text.Trim().ToUpper(), txtSo.Text.Trim().ToUpper()); } }
public static bool AddPrjInfo(string TypeCode, string UserCode, string RecordDate, PMModel PIM, string podepom) { TypeCode = PublicClass.CheckString(TypeCode); int num = int.Parse(publicDbOpClass.QuaryMaxid("PT_PrjInfo", "i_XH")) + 1; string str2 = (" begin " + " insert into PT_PrjInfo (TypeCode,i_xh,UserCode,RecordDate,IsValid ,i_childNum,PrjCode,PrjGuid,PrjName,StartDate,EndDate," + "ComputeClass,RationClass,PrjCost,ContractSum,Duration,QualityClass,Area,PrjKindClass,PrjPlace,Remark1,FileName,FileURL,") + "Owner,Counsellor,Designer,Inspector,PrjInfo,PrjState,OwnerCode,MarketInfoGuid,Rank,BudgetWay,ContractWay,PayCondition,TenderWay,PayWay," + "KeyPart,WorkUnit,LinkMan,PrjManager,BuildingType,TotalHouseNum,BuildingArea,UsegrounArea,UndergroundArea,PrjFundInfo,OtherStatement,xmgroup,Podepom"; object obj2 = str2 + " ) values ('" + TypeCode + "'," + num.ToString() + ",'" + UserCode + "','" + RecordDate + "','1',0,"; object obj3 = string.Concat(new object[] { obj2, " '", PIM.PrjCode, "','", PIM.PrjGuid, "','", PIM.PrjName, "','", PIM.StartDate, "', " }); string str3 = string.Concat(new object[] { obj3, " '", PIM.EndDate, "','", PIM.ComputeClass, "','", PIM.RationClass, "', " }); string str4 = str3 + " '" + PIM.PrjCost + "','" + PIM.ContractSum + "','" + PIM.Duration + "', "; string str5 = str4 + " '" + PIM.QualityClass + "','" + PIM.Area + "','" + PIM.PrjKindClass + "', "; string str6 = str5 + " '" + PIM.PrjPlace + "','" + PIM.Remark + "','" + PIM.FileName + "','" + PIM.FileURL + "' ,"; object obj4 = str6 + " '" + PIM.Owner + "','" + PIM.Counsellor + "','" + PIM.Designer + "',"; string str7 = string.Concat(new object[] { obj4, " '", PIM.Inspector, "','", PIM.PrjInfo, "','", PIM.PrjState, "','", PIM.OwnerCode, "','", Guid.Empty, "'," }); string str8 = str7 + " '" + PIM.Rank + "','" + PIM.BudgetWay + "','" + PIM.ContractWay + "',"; string str9 = str8 + " '" + PIM.PayCondition + "','" + PIM.TenderWay + "','" + PIM.PayWay + "',"; string str10 = str9 + " '" + PIM.KeyPart + "','" + PIM.WorkUnit + "','" + PIM.LinkMan + "',"; string str11 = str10 + " '" + PIM.PrjManager + "','" + PIM.BuildingType + "','" + PIM.TotalHouseNum + "',"; string str12 = str11 + " '" + PIM.BuildingArea + "','" + PIM.UsegrounArea + "','" + PIM.UndergroundArea + "',"; object obj5 = (str12 + " '" + PIM.PrjFundInfo + "','" + PIM.OtherStatement + "','" + PIM.Xmgroup + "','" + podepom + "'") + "\t)"; string str13 = string.Concat(new object[] { obj5, " INSERT INTO PT_PrjInfo_ZTB_Detail(PrjGuid,IsTender,SetUpFlowState) VALUES('", PIM.PrjGuid, "', '0', '1')" }); return(publicDbOpClass.NonQuerySqlString((str13 + " update PT_PrjInfo set i_childNum = (select count(1) from PT_PrjInfo where (TypeCode like '" + TypeCode.Substring(0, TypeCode.Length - 5) + "%') and (len(TypeCode)= " + TypeCode.Length.ToString() + ")) where TypeCode = '" + TypeCode.Substring(0, TypeCode.Length - 5) + "'") + " end")); }
private void btnprint_Click(object sender, EventArgs e) { if (model.Text == "") { MessageBox.Show("请选择要打印的模板", "提示"); return; } if (txtlsh.Text.Trim() == "") { MessageBox.Show("请输入流水号", "提示"); return; } if (txtso.Text.Trim() == "") { MessageBox.Show("请输入SO", "提示"); return; } if (txtscrq.Text.Trim() == "") { MessageBox.Show("请输入生产日期", "提示"); return; } switch (model.Text) { case "DFCV": PublicClass.printDFCVE1(txtlsh.Text.Trim(), txtso.Text.Trim(), txtkhh.Text.Trim(), txtscrq.Text.Trim()); break; case "DFCP": PublicClass.printDFCP1(txtlsh.Text.Trim(), txtso.Text.Trim(), txtkhh.Text.Trim(), txtscrq.Text.Trim()); break; case "DFAC": PublicClass.printDFAC1(txtlsh.Text.Trim(), txtso.Text.Trim(), txtkhh.Text.Trim(), txtscrq.Text.Trim()); break; } }
public Sensor() { InitializeComponent(); fillcmbName(); fillcmbmanu(); fillcmbType(); fillcmbUnit(); PublicClass.SeteUserSettings(ref addition, ref deletion, ref modification, ref Preivew, ref uidd, "Sensors"); if (addition == false && modification == false) { btnSave.Enabled = false; btnNew.Enabled = false; } else { btnSave.Enabled = true; btnNew.Enabled = true; } if (addition == false) { btnNew.Enabled = false; } else { btnNew.Enabled = true; } if (deletion) { btnCancel.Enabled = true; } else { btnCancel.Enabled = false; } }
protected void Page_Load(object sender, EventArgs e) { HttpCookie usercookie = Request.Cookies["nowloginuser"]; string url = PublicClass.CheckLogin(usercookie, "main"); if (url != "") { Response.Write(url); return; } if (!IsPostBack) { string action = Request["action"]; string sjid = Request["sjid"]; if (action != null && sjid != null) { int id = int.Parse(sjid); if (action.Equals("delete")) { //删除服务器上面对应试卷的所有图片 foreach (DataRow row in TbImagesManager.GetImagesBySjid(id).Rows) { string path = Server.MapPath("images/" + row["Tpian"].ToString()); if (File.Exists(path)) { File.Delete(path); } } TbImagesManager.DeleteImageBySjid(id); TbQuestionTypesManager.DeleteQuestionTypesBySjid(id); TbTestPaperManager.DeleteTestpaperBySjid(id); } } GetAllTestPaperInfo(); } }
/// <summary> /// 键盘输入事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void txtICCardType_Value_KeyPress(object sender, KeyPressEventArgs e) { //阻止从键盘输入键 e.Handled = true; if ((e.KeyChar >= '0' && e.KeyChar <= '9') || (e.KeyChar == (char)8)) { if ((e.KeyChar == (char)8)) { e.Handled = false; return; } else { int len = this.txtICCardType_Value.Text.Length; if (len < 10) { if (len == 0 && e.KeyChar != '0') { e.Handled = false; return; } //else if (len == 0) //{ // MessageBox.Show("地感PLC值不能以0开头!"); return; //} e.Handled = false; return; } else { PublicClass.ShowToolTip(ToolTipIcon.Info, "提示", "IC卡类型值最多只能输入10位数字!", txtICCardType_Value, this); } } } else { PublicClass.ShowToolTip(ToolTipIcon.Info, "提示", "IC卡类型值只能输入数字!", txtICCardType_Value, this); } }
protected void ctrlInitOnline_RmesDataChanged(object obj, Rmes.WinForm.Base.RMESEventArgs e) { if (e.MessageHead == null) { return; } if (e.MessageHead == "ONLINE") { //上线完成 自动刷下一个 打印条码 string sn = e.MessageBody.ToString(); PlanSnEntity ent = PlanSnFactory.GetBySnPline(sn, PlineCode1); //获取sn信息 product = ProductInfoFactory.GetByCompanyCodeSNSingle(CompanyCode, sn); //获取sn信息 if (product == null) { return; } //if (check1.Checked) PublicClass.PrintTmFzSx(sn, product.PLAN_SO, product.CUSTOMER_NAME, "", product.PRODUCT_MODEL, 1); //timer1.Enabled = true; //timer1.Start(); //timer1_Tick(timer1, new EventArgs()); } }
/// <summary> /// 查重方法 /// </summary> /// <returns></returns> private bool btnCheckupdate() { bool rbool = true; try { string BusinessType_Name = this.txtBusinessType_Name.Text.ToString(); //判断名称是否已存在 Expression <Func <BusinessType, bool> > funviewFVNInfo = n => n.BusinessType_Name == BusinessType_Name && n.BusinessType_Name != this.dgvBusinessType.SelectedRows[0].Cells["BusinessType_Name"].Value.ToString(); if (BusinessTypeDAL.QueryView(funviewFVNInfo).Count() > 0) { PublicClass.ShowToolTip(ToolTipIcon.Info, "提示", "该业务类型名称已存在", txtBusinessType_Name, this); this.txtBusinessType_Name.Focus(); rbool = false;; } return(rbool); } catch { CommonalityEntity.WriteTextLog("地感管理 btnCheck()"); rbool = false; } return(rbool); }
public static int Record = 0; //定义当前符号查询的记录总数,初始化为0 protected void Page_Load(object sender, EventArgs e) { HttpCookie usercookie = Request.Cookies["nowloginuser"]; string url = PublicClass.CheckLogin(usercookie, "main"); if (url != "") { Response.Write(url); return; } if (!IsPostBack) { string lsid = Request["LsID"]; if (lsid != null) { int yhid = TbUserManager.GetTeacherUserYhID(int.Parse(lsid)); //根据教师编号LsID得到对应的用户编号 TbTeacherManager.DeleteTeacherInfo(int.Parse(lsid)); //根据教师编号LsID删除对应教师信息 TbUserManager.DeleteUserByYhID(yhid); //根据用户编号删除教师对应的用户信息 } GetPageInfo(); GetSpeciality(); } }
//单元格值的格式设置 private void dgvDetails_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) { #region 格式设置 string columnName = dgvDetails.Columns[e.ColumnIndex].Name; //设置时间格式 if (columnName == "开工时间") { if (e.Value != null) { string oldValue = e.Value.ToString(); e.Value = PublicClass.getDateTime(oldValue); } } if (columnName == "竣工时间") { if (e.Value != null) { string oldValue = e.Value.ToString(); e.Value = PublicClass.getDateTime(oldValue); } } #endregion }
public static DataTable subjectList = new DataTable(); //定义一个Table表格,初始化为null. protected void Page_Load(object sender, EventArgs e) { HttpCookie usercookie = Request.Cookies["nowloginuser"]; string url = PublicClass.CheckLogin(usercookie, "main"); if (url != "") { Response.Write(url); return; } string Sub_Sc = Request["Sub_Sc"]; if (!IsPostBack) { ZyName.Items.Clear(); List <TbSpeciality> TbSpeciality = TbSpecialityManager.GetAllSpecialityList(); ZyName.DataSource = TbSpeciality; ZyName.DataTextField = "ZyName"; ZyName.DataValueField = "ZyID"; ZyName.DataBind(); ZyName.Items.Insert(0, new ListItem("请选择..", "0")); if (Sub_Sc != null) { int count = TbTestPaperManager.GetAllTestPaperIsExist(int.Parse(Sub_Sc)); if (count <= 0) { TbSubjectManager.Dele_Sub(int.Parse(Sub_Sc)); } else { Page.RegisterStartupScript("", "<script>alert('请先删除试卷信息!!')</script>"); } } Load_Subject(); //调用方法实现数据加载。 } }
/// <summary> /// 查重方法 /// </summary> /// <returns></returns> private bool btnCheck() { bool rbool = true; try { string name = this.txtCustomerInfo_Name.Text; //判断名称是否已存在 Expression <Func <CustomerInfo, bool> > funviewCustomerInfo1 = n => n.CustomerInfo_Name == name && n.CustomerInfo_Name != this.dgvCustomerInfo.SelectedRows[0].Cells["CustomerInfo_Name"].Value.ToString(); if (CustomerInfoDAL.Query(funviewCustomerInfo1).Count() > 0) { PublicClass.ShowToolTip(ToolTipIcon.Info, "提示", "该公司名称已存在已存在", txtCustomerInfo_Name, this); txtCustomerInfo_Name.Focus(); rbool = false; } return(rbool); } catch { CommonalityEntity.WriteTextLog("人员信息管理 btnCheck()"); rbool = false; } return(rbool); }
/// <summary> /// 查重方法 /// </summary> /// <returns></returns> private bool btnCheckupdate() { bool rbool = true; try { string PositionName = this.cbxPositionName.Text.ToString(); int lenth = cbxDrivewayName.Text.Trim().Length; string DrivewayName = cbxDrivewayName.Text.Trim().Substring(0, 4); string DrivewayType = cbxDrivewayName.Text.Trim().Substring(lenth - 1, 1); string name = this.txtFVN_Name.Text.Trim(); int value = int.Parse(this.txtFVN_Value.Text.Trim()); //判断名称是否已存在 Expression <Func <View_FVN_Driveway_Position, bool> > funviewFVNInfo = n => n.Position_Name == PositionName && n.Driveway_Name == DrivewayName && n.FVN_Name == name && n.FVN_Name != this.dgvFVN.SelectedRows[0].Cells["FVN_Name"].Value.ToString(); if (FVNDAL.QueryView(funviewFVNInfo).Count() > 0) { PublicClass.ShowToolTip(ToolTipIcon.Info, "提示", "该地感名称已存在", txtFVN_Name, this); this.txtFVN_Name.Focus(); rbool = false;; } Expression <Func <View_FVN_Driveway_Position, bool> > funviewFVNInfo1 = n => n.Position_Name == PositionName && n.Driveway_Name == DrivewayName && n.FVN_Value == value && n.FVN_Value != int.Parse(this.dgvFVN.SelectedRows[0].Cells["FVN_Value"].Value.ToString()); if (FVNDAL.QueryView(funviewFVNInfo1).Count() > 0) { PublicClass.ShowToolTip(ToolTipIcon.Info, "提示", "该地感值已存在", txtFVN_Value, this); this.txtFVN_Value.Focus(); rbool = false;; } return(rbool); } catch { CommonalityEntity.WriteTextLog("地感管理 btnCheck()"); rbool = false; } return(rbool); }
public async Task <IActionResult> ModifyPwd([Bind("UserName,UserPwd,ComfirmPwd")] MoRegisterUser moRegisterUser) { if (ModelState.IsValid) { var user = _db.ToUserInfo.Where(b => b.Id == _MyUserInfo.Id).SingleOrDefault(); if (user == null) { this.MsgBox("修改失败,请稍后重试"); return(View(moRegisterUser)); } user.UserPwd = PublicClass._Md5(moRegisterUser.UserPwd.Trim()); var result = await _db.SaveChangesAsync(); if (result > 0) { HttpContext.Session.Set <MoUserInfo>(HttpContext.Session.SessionKey(), _MyUserInfo); this.MsgBox("修改成功!"); } else { this.MsgBox("修改失败,请稍后重试!"); } } return(View(moRegisterUser)); }
/// <summary> /// 检查更新 /// </summary> /// <returns></returns> private bool CheckUpdateApp() { try { Int32 dwFlag = new Int32(); string autoUpdatePath = Application.StartupPath + @"\ComputerExam.Update.exe"; if (!InternetGetConnectedState(ref dwFlag, 0)) { return(false); } if (!PublicClass.CheckForUpdate()) { return(false); } if (!File.Exists(autoUpdatePath)) { return(false); } Process.Start(autoUpdatePath); Environment.Exit(0); } catch (WebException) { LogHelper.WriteLog(typeof(frmLogin), "当前更新服务不可用,请联系管理员。"); return(false); } catch (Exception ex) { LogHelper.WriteLog(typeof(frmLogin), ex); return(false); } return(true); }
private static void Main() { Console.WriteLine(new Inside.InternalInsideClass()); Console.WriteLine(new InternalClass()); var pub = new PublicClass(); Console.WriteLine(pub); pub.PublicMethod(); pub.InternalMethod(); //pub.ProtectedMethod(); //pub.PrivateMethod(); Console.WriteLine(new PublicClass.PublicNestedClass()); //Console.WriteLine(new PublicClass.ProtectedNestedClass()); //Console.WriteLine(new PublicClass.PrivateNestedClass()); Console.WriteLine(new SubClass()); var sub = new Sub("test"); Console.WriteLine(sub.Name); sub.BaseVirtualMethod(); Console.WriteLine(sub.Name); }
/// <summary> /// 查重方法 /// </summary> /// <returns></returns> private bool btnCheckupdate() { bool rbool = true; try { string PositionName = this.cbxPositionName.Text.ToString(); int lenth = cbxDrivewayName.Text.Trim().Length; string DrivewayName = cbxDrivewayName.Text.Trim().Substring(0, 4); string DrivewayType = cbxDrivewayName.Text.Trim().Substring(lenth - 1, 1); string CameraName = this.txtCamera_Name.Text.Trim(); string CameraCardAdd = this.txtCamera_CardAdd.Text.Trim(); //判断名称是否已存在 Expression <Func <View_Camera_Driveway_Position, bool> > funviewCamera = n => n.Position_Name == PositionName && n.Driveway_Name == DrivewayName && n.Camera_Name == CameraName && n.Camera_Name != this.dgvCamera.SelectedRows[0].Cells["Camera_Name"].Value.ToString(); if (CameraDAL.QueryView(funviewCamera).Count() > 0) { PublicClass.ShowToolTip(ToolTipIcon.Info, "提示", "该摄像头名称已存在", txtCamera_Name, this); txtCamera_Name.Focus(); rbool = false;; } Expression <Func <View_Camera_Driveway_Position, bool> > funviewCamera1 = n => n.Position_Name == PositionName && n.Driveway_Name == DrivewayName && n.Camera_AddCard == CameraCardAdd && n.Camera_AddCard != this.dgvCamera.SelectedRows[0].Cells["Camera_AddCard"].Value.ToString(); if (CameraDAL.QueryView(funviewCamera1).Count() > 0) { PublicClass.ShowToolTip(ToolTipIcon.Info, "提示", "该摄像头地址码已存在", txtCamera_CardAdd, this); txtCamera_CardAdd.Focus(); rbool = false;; } return(rbool); } catch { CommonalityEntity.WriteTextLog("摄像头管理 btnCheck()"); rbool = false; } return(rbool); }
public void IntialTree() { try { this.trvMenu.Nodes.Clear(); oSessionInfo = PublicClass.GetUseInfo(Session); if (oSessionInfo.Validate()) { //IList lst = GetMenu(); //TreeNode oRootNode = CreateTreeNode(oSessionInfo.ListMenus); //if (oRootNode != null) //{ //this.trvMenu.Nodes.Add(oRootNode); //} Hashtable ht = CreateTreeNode(oSessionInfo.ListMenus); TreeNode oNode = null; foreach (string sKey in ht.Keys) { oNode = ht[sKey] as TreeNode; if (oNode != null && oNode.Parent == null) { this.trvMenu.Nodes.Add(oNode); } } } else { throw new Exception("Session 丢失"); } // trvMenu.Attributes.Add("onclick", "return ClickNode(event);"); } catch (Exception ex) { } }
public async Task <IActionResult> DownloadProblemList(string content, DateTime?startTime, DateTime?endTime, int pageIndex = 1, int pageSize = 10000) { string activityNo = this.GetActivityNo(); var(dataList, total) = await _operatApplication.ProblemList(activityNo, content, startTime, endTime, pageIndex, pageSize); if (!dataList.Any()) { return(BadRequest("没有可导出的数据")); } string excelName = $@"客服问题汇总-{DateTime.Now.ToString("yyyyMMddHHmmss")}.xls"; var columns = new Dictionary <string, string>() { { "nickName", "昵称" }, { "tel", "手机号" }, { "createdTime", "提交时间" }, { "content", "提交问题" } }; var fs = PublicClass.GetByteToExportExcel(dataList.ToList(), columns, new List <string>()); return(File(fs, "application/vnd.android.package-archive", excelName)); }
public static void Main(String[] args) { // 14. Cara menginstansiasi kelas baru PublicClass publicClass = new PublicClass(); // 15. Cara memanggil method dengan parameter // Memanggil method berparameter yakni "public void setPrivateInt(int privateInt)" // Dengan masukan angka 13 publicClass.SetPrivateInt(13); // 16. Cara memanggil method dan mendapatkan return value-nya Console.WriteLine("[13] publicClass.GetPrivateInt() = " + publicClass.GetPrivateInt()); // 17. Cara mengubah isi atribut publik dari luar kelas publicClass.publicString = "World!"; // 18. Cara mendapatkan isi atribut publik dari luar kelas Console.WriteLine("[World!] publicClass.publicString = " + publicClass.publicString); // 19. Cara mengisi nilai atribut statik PublicClass.staticInt = 10; // 20. Cara mendapatkan nilai atribut statik Console.WriteLine("[10] PublicClass.staticInt = " + PublicClass.staticInt); // 21. Cara mendapatkan nilai konstanta Console.WriteLine("[3.14] PublicClass.PI = " + PublicClass.PI); // 22. Cara menginstansiasi kelas dengan turunannya PublicClass publicSubClass = new PublicSubClass(); publicSubClass.SetPrivateInt(13); // 23. Memastikan method overriding bekerja Console.WriteLine("[26] publicSubClass.GetPrivateInt() = {0}", publicSubClass.GetPrivateInt()); }
/// <summary> /// 查重方法 /// </summary> /// <returns></returns> private bool btnCheck() { bool rbool = true; try { if (LinQBaseDao.Query("select * from CarAttribute where CarAttribute_Name='" + this.txtCarAttribute_Name.Text.ToString() + "'").Tables[0].Rows.Count > 0) { PublicClass.ShowToolTip(ToolTipIcon.Info, "提示", "该车辆属性名称已存在", txtCarAttribute_Name, this); this.txtCarAttribute_Name.Focus(); rbool = false;; } else { return(rbool); } } catch { CommonalityEntity.WriteTextLog("地感管理 btnCheck()"); rbool = false; } return(rbool); }
protected void Button1_Click(object sender, EventArgs e) { dm.Title = TextTitle.Text.Trim(); dm.Text = FCKeditor1.Value; PublicClass p = new PublicClass(); dm.Date_Send = p.GetDate(); dm.Id_Admin = 1; dm.Show_Page = CheckBox1.Checked.ToString(); if (LblHidden.ToolTip.Length > 0) { dm.Id = decimal.Parse(LblHidden.ToolTip); ac.Update(dm); } else { dm.Row_View = ac.SelectMaxRowview(); ac.Insert(dm); } FillGrid(); Cancel(); }
public int getLegend(string Query) { int i = 0; try { DataTable dtt = new DataTable(); dtt = DbClass.getdata(CommandType.Text, "select distinct alarm_id from v_AllRecord where " + Query + " and Alarm_ID <> '' "); if (dtt.Rows.Count > 0) { string ids = "pd." + Query; foreach (DataRow dr in dtt.Rows) { i = objUserControl.checkValueForFlagGenerate(ids, PublicClass.DefVal(Convert.ToString(dr["alarm_id"]), "0"), i); } } else { PublicClass.AlarmName = null; } } catch { } return(i); }
public string asr(string prompt) { DataTable dt_params = new DataTable(); dt_params.Columns.Add("prompt", typeof(string)); dt_params.Columns.Add("max_waiting_ms", typeof(int)); dt_params.Columns.Add("retry", typeof(int)); dt_params.Columns.Add("mode", typeof(int)); dt_params.Columns.Add("disable_asr", typeof(object)); DataRow dr_params = dt_params.NewRow(); dr_params["prompt"] = prompt; dr_params["max_waiting_ms"] = "5000"; dr_params["retry"] = "0"; dr_params["mode"] = "0"; dr_params["disable_asr"] = "false"; dt_params.Rows.Add(dr_params); DataTable dt = new DataTable(); dt.Columns.Add("action", typeof(string)); dt.Columns.Add("flowdata", typeof(string)); dt.Columns.Add("params", typeof(object)); DataRow dr = dt.NewRow(); dr["action"] = "asr"; dr["flowdata"] = flowdata; dr["params"] = json.ToJson(dt_params); dt.Rows.Add(dr); string str = json.ToJson(dt); Response.Write(str); PublicClass.SetLogs(null, "asr:" + str);//提交日志; return(str); }
public string bridge(string number, string callerid, string gateway, string prompt, string background) { DataTable dt_params = new DataTable(); dt_params.Columns.Add("number", typeof(string)); dt_params.Columns.Add("callerid", typeof(string)); dt_params.Columns.Add("gateway", typeof(string)); dt_params.Columns.Add("prompt", typeof(string)); dt_params.Columns.Add("background", typeof(string)); DataRow dr_params = dt_params.NewRow(); dr_params["number"] = number; dr_params["callerid"] = callerid; dr_params["gateway"] = gateway; dr_params["prompt"] = prompt; dr_params["background"] = background; dt_params.Rows.Add(dr_params); DataTable dt = new DataTable(); dt.Columns.Add("action", typeof(string)); dt.Columns.Add("flowdata", typeof(string)); dt.Columns.Add("params", typeof(object)); DataRow dr = dt.NewRow(); dr["action"] = "bridge"; dr["flowdata"] = flowdata; dr["params"] = json.ToJson(dt_params); dt.Rows.Add(dr); string str = json.ToJson(dt); Response.Write(str); PublicClass.SetLogs(null, "bridge:" + str);//提交日志; return(str); }
private void AddType(IHTMLDiv parent, CompilationType type, Action<string> UpdateLocation) { var div = new IHTMLDiv().AttachTo(parent); div.style.marginTop = "0.1em"; div.style.fontFamily = ScriptCoreLib.JavaScript.DOM.IStyle.FontFamilyEnum.Verdana; div.style.whiteSpace = ScriptCoreLib.JavaScript.DOM.IStyle.WhiteSpaceEnum.nowrap; var i = default(IHTMLImage); if (type.IsInterface) { i = new PublicInterface(); } else { i = new PublicClass(); } i.AttachTo(div); i.style.verticalAlign = "middle"; i.style.marginRight = "0.5em"; var s = new IHTMLAnchor { innerText = type.Name, title = "" + type.MetadataToken }.AttachTo(div); if (!string.IsNullOrEmpty(type.HTMLElement)) { var c = new IHTMLCode(); Action<string, JSColor> Write = (Text, Color) => { var cs = new IHTMLSpan { innerText = Text }; cs.style.color = Color; cs.AttachTo(c); }; Write("<", JSColor.Blue); Write(type.HTMLElement, JSColor.FromRGB(0xa0, 0, 0)); Write("/>", JSColor.Blue); //c.style.marginLeft = "1em"; c.style.Float = ScriptCoreLib.JavaScript.DOM.IStyle.FloatEnum.right; c.AttachTo(s); } s.href = "#"; s.style.textDecoration = "none"; s.style.color = JSColor.System.WindowText; Action onclick = delegate { }; s.onclick += e => { e.PreventDefault(); s.focus(); if (TouchTypeSelected != null) TouchTypeSelected(type); UpdateLocation(type.FullName + " - " + type.Summary + " - HTML:" + type.HTMLElement); onclick(); }; s.onfocus += delegate { s.style.backgroundColor = JSColor.System.Highlight; s.style.color = JSColor.System.HighlightText; }; s.onblur += delegate { s.style.backgroundColor = JSColor.None; s.style.color = JSColor.System.WindowText; }; onclick = delegate { var children = new IHTMLDiv().AttachTo(div); children.style.paddingLeft = "1em"; Func<IHTMLDiv> Group = () => new IHTMLDiv().AttachTo(children); var Groups = new { Nested = Group(), Constructors = Group(), Methods = Group(), Events = Group(), Fields = Group(), Properties = Group(), }; type.GetNestedTypes().ForEach( (Current, Next) => { AddType(Groups.Nested, Current, UpdateLocation); ScriptCoreLib.Shared.Avalon.Extensions.AvalonSharedExtensions.AtDelay( 50, Next ); } ); type.GetConstructors().ForEach( (Current, Next) => { AddTypeConstructor(Groups.Constructors, Current, UpdateLocation); ScriptCoreLib.Shared.Avalon.Extensions.AvalonSharedExtensions.AtDelay( 50, Next ); } ); var HiddenMethods = new List<int>(); Action<CompilationMethod> AddIfAny = SourceMethod => { if (SourceMethod == null) return; HiddenMethods.Add(SourceMethod.MetadataToken); }; Action AfterEvents = delegate { type.GetMethods().ForEach( (Current, Next) => { if (!HiddenMethods.Contains(Current.MetadataToken)) { AddTypeMethod(Groups.Methods, Current, UpdateLocation); } ScriptCoreLib.Shared.Avalon.Extensions.AvalonSharedExtensions.AtDelay( 50, Next ); } ); }; Action AfterProperties = delegate { type.GetEvents().ForEach( (Current, Next) => { AddIfAny(Current.GetAddMethod()); AddIfAny(Current.GetRemoveMethod()); AddTypeEvent(Groups.Events, Current, UpdateLocation); ScriptCoreLib.Shared.Avalon.Extensions.AvalonSharedExtensions.AtDelay( 50, Next ); } )(AfterEvents); }; type.GetProperties().ForEach( (Current, Next) => { AddIfAny(Current.GetSetMethod()); AddIfAny(Current.GetGetMethod()); AddTypeProperty(Groups.Properties, Current, UpdateLocation); ScriptCoreLib.Shared.Avalon.Extensions.AvalonSharedExtensions.AtDelay( 50, Next ); } )(AfterProperties); type.GetFields().ForEach( (Current, Next) => { AddTypeField(Groups.Fields, Current, UpdateLocation); ScriptCoreLib.Shared.Avalon.Extensions.AvalonSharedExtensions.AtDelay( 50, Next ); } ); var NextClickHide = default(Action); var NextClickShow = default(Action); NextClickHide = delegate { children.Hide(); onclick = NextClickShow; }; NextClickShow = delegate { children.Show(); onclick = NextClickHide; }; onclick = NextClickHide; }; }