PracticeClass() { this.MyStr = new MyString(ToLower); this.MyStr = new MyString(ToUpper); /* this.MyStr = ToLower; this.MyStr += ToUpper; */ }
public void function() { //utworzenie obiektu delegata MyString myDel; //register method to be called by delegate myDel = new MyString(PrintLower); //register second method myDel += new MyString(PrintUpper); //call delegate myDel("My Name is Violetta."); // Console.ReadLine(); }
protected void Page_Load(object sender, EventArgs e) { m_bRemember = false; string szTerm = Request["term"]; Response.CacheControl = "no-cache"; DEPTREQ vrGet = new DEPTREQ(); UNIDEPT[] vtDept; vrGet.dwKind = (uint)ConfigConst.GCDeptKind; //vrGet.dwGetType = (uint)DEPTREQ.DWGETTYPE.DEPTGET_BYNAME; vrGet.szName = szTerm; if (szTerm == "") { //vrGet.dwGetType = (uint)DEPTREQ.DWGETTYPE.DEPTGET_BYALL; //vrGet.szGetKey = szTerm; } vrGet.szReqExtInfo.dwNeedLines = 10; //最多10条 if (m_Request.Account.DeptGet(vrGet, out vtDept) == REQUESTCODE.EXECUTE_SUCCESS && vtDept != null) { MyString szOut = new MyString(); szOut += "["; szOut += "{\"id\":\"" + "0" + "\",\"label\": \"" + "全部" + "\"},"; for (int i = 0; i < vtDept.Length; i++) { szOut += "{\"id\":\"" + vtDept[i].dwID + "\",\"label\": \"" + vtDept[i].szName + "\"}"; if (i < vtDept.Length - 1) { szOut += ","; } } szOut += "]"; Response.Write(szOut); } else { Response.Write("[ ]"); } }
protected void Page_Load(object sender, EventArgs e) { { REPORTREQ vrParameter = new REPORTREQ(); USERSTAT[] vrResult; GetPageCtrlValue(out vrParameter.szReqExtInfo); if (!IsPostBack) { dwStartDate.Value = DateTime.Now.AddDays(-30).ToString("yyyy-MM-dd"); dwEndDate.Value = DateTime.Now.ToString("yyyy-MM-dd"); } vrParameter.dwStartDate = DateToUint(dwStartDate.Value); vrParameter.dwEndDate = DateToUint(dwEndDate.Value); if (m_Request.Report.GetUserStat(vrParameter, out vrResult) == REQUESTCODE.EXECUTE_SUCCESS) { UpdatePageCtrl(m_Request.Report); for (int i = 0; i < vrResult.Length; i++) { m_szOut += "<tr>"; m_szOut += "<td data-id=" + vrResult[i].dwAccNo.ToString() + ">" + vrResult[i].szPID + "</td>"; UNIACCOUNT accinfo; m_szOut += "<td>" + vrResult[i].szTrueName + "</td>"; if (GetAccByAccno(vrResult[i].dwAccNo.ToString(), out accinfo)) { m_szOut += "<td>" + accinfo.szClassName.ToString() + "</td>"; } else { m_szOut += "<td></td>"; } m_szOut += "<td>" + vrResult[i].szDeptName.ToString() + "</td>"; m_szOut += "<td>" + vrResult[i].dwUseTimes.ToString() + "</td>"; uint uUseTime = (uint)vrResult[i].dwUseTime; m_szOut += "<td>" + uUseTime / 60 + "小时" + uUseTime % 60 + "分钟" + "</td>"; m_szOut += "</tr>"; } } } PutBackValue(); }
public override int GetHashCode() { int hash = 1; if (MyDouble != 0D) { hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(MyDouble); } if (MyFloat != 0F) { hash ^= pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(MyFloat); } if (MyInt32 != 0) { hash ^= MyInt32.GetHashCode(); } if (MyUint32 != 0) { hash ^= MyUint32.GetHashCode(); } if (MyUint64 != 0UL) { hash ^= MyUint64.GetHashCode(); } if (MyBool != false) { hash ^= MyBool.GetHashCode(); } if (MyString.Length != 0) { hash ^= MyString.GetHashCode(); } if (MyBytes.Length != 0) { hash ^= MyBytes.GetHashCode(); } hash ^= myStringList_.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public static void Main(string[] args) { Console.WriteLine("hello world"); MyString s1 = new MyString("hello"); Console.WriteLine("s1.GetLength(): " + s1.GetLength()); Console.WriteLine(); MyLetterString s2 = new MyLetterString("world"); Console.WriteLine("s2.GetLength(): " + s2.GetLength()); Console.WriteLine("s2.GetValue(): " + s2.GetValue()); Console.WriteLine("s2.Shift()..."); s2.Shift(); Console.WriteLine("s2.GetValue(): " + s2.GetValue()); }
protected void Page_Load(object sender, EventArgs e) { m_bRemember = false; string szTerm = Request["term"]; string szKind = Request["kind"]; string szLab = Request["labid"]; Response.CacheControl = "no-cache"; ROOMREQ vrGet = new ROOMREQ(); UNIROOM[] vtRes; vrGet.szRoomName = szTerm; vrGet.szReqExtInfo.dwNeedLines = 10; //最多10条 if (szKind != null && szKind != "") { vrGet.dwInClassKind = Parse(szKind); } if (szLab != null && szLab != "") { vrGet.dwLabID = Parse(szLab); } if (m_Request.Device.RoomGet(vrGet, out vtRes) == REQUESTCODE.EXECUTE_SUCCESS && vtRes != null) { MyString szOut = new MyString(); szOut += "["; for (int i = 0; i < vtRes.Length; i++) { szOut += "{\"id\":\"" + vtRes[i].dwRoomID + "\",\"label\": \"" + vtRes[i].szRoomName + "\",\"labid\": \"" + vtRes[i].dwLabID.ToString() + "\"}"; if (i < vtRes.Length - 1) { szOut += ","; } } szOut += "]"; Response.Write(szOut); } else { Response.Write("[ ]"); } }
protected void Page_Load(object sender, EventArgs e) { REQUESTCODE uResponse = REQUESTCODE.EXECUTE_FAIL; SFROLEINFOREQ vrPar = new SFROLEINFOREQ(); GetHTTPObj(out vrPar); vrPar.dwAuthType = (uint)SYSFUNCRULE.DWAUTHTYPE.AUTHBY_USER; if (vrPar.dwStatus == null || ((uint)vrPar.dwStatus) == 0) { vrPar.dwStatus = (uint)ADMINCHECK.DWCHECKSTAT.CHECKSTAT_CANDO; } GetPageCtrlValue(out vrPar.szReqExtInfo); SFROLEINFO[] vtRes; uResponse = m_Request.System.SFRoleGet(vrPar, out vtRes); if (uResponse == REQUESTCODE.EXECUTE_SUCCESS && vtRes != null && vtRes.Length > 0) { for (int i = 0; i < vtRes.Length; i++) { m_szOut += "<tr>"; m_szOut += "<td class=\"1\" data-id=" + vtRes[i].dwApplyID.ToString() + ">" + vtRes[i].szTrueName + "(" + vtRes[i].szPID + ")" + "</td>"; m_szOut += "<td>" + vtRes[i].szDeptName + "</td>"; m_szOut += "<td>" + vtRes[i].szHandPhone + "</td>"; m_szOut += "<td>" + vtRes[i].szTutorName + "</td>"; m_szOut += "<td>" + Get1970Date(vtRes[i].dwApplyTime) + "</td>"; m_szOut += "<td>" + (vtRes[i].szLabName) + "</td>"; m_szOut += "<td>" + GetJustName((vtRes[i].dwStatus), "Reserve_Status") + "</td>"; m_szOut += "<td>" + Get1970Date(vtRes[i].dwCheckTime) + "</td>"; string szOp = ""; //if (((uint)vtRes[i].dwStatus & ((uint)ADMINCHECK.DWCHECKSTAT.CHECKSTAT_CANDO)) > 0) { szOp = "OPTD"; } // else { // szOp = "OPTD OPTD2"; } m_szOut += "<td><div class='" + szOp + "'></div></td>"; m_szOut += "</tr>"; } UpdatePageCtrl(m_Request.System); } PutBackValue(); }
// Sets string. Checks if it is not null or empty. public static void SetString(MyString myStr, string propertyName) { var property = myStr.GetType().GetProperty(propertyName); while (true) { Console.WriteLine("Введите переменную " + propertyName + ":"); ValueToCheck = Console.ReadLine(); if (!String.IsNullOrEmpty(ValueToCheck)) { property.SetValue(myStr, ValueToCheck); break; } else { Console.WriteLine("Строка не должна быть пустой!"); } } }
protected void Page_Load(object sender, EventArgs e) { if (Request["delID"] != null) { DelDevKind(Request["delID"]); } DEVKINDREQ vrParameter = new DEVKINDREQ(); if (Request["szKindName"] != null && Request["szKindName"] != "") { vrParameter.szKindName = Request["szKindName"].ToString().Trim(); } UNIDEVKIND[] vrResult; GetPageCtrlValue(out vrParameter.szReqExtInfo); if (m_Request.Device.DevKindGet(vrParameter, out vrResult) == REQUESTCODE.EXECUTE_SUCCESS) { for (int i = 0; i < vrResult.Length; i++) { m_szOut += "<tr>"; m_szOut += "<td data-id=" + vrResult[i].dwKindID.ToString() + ">" + vrResult[i].szKindName + "</td>"; /* * m_szOut += "<td>" + vrResult[i].dwUsableNum + "</td>"; * * m_szOut += "<td>" + vrResult[i].dwMinUsers + "</td>"; * m_szOut += "<td>" + vrResult[i].dwMaxUsers + "</td>"; */ m_szOut += "<td>" + vrResult[i].dwTotalNum + "</td>"; m_szOut += "<td>" + vrResult[i].dwUsableNum + "</td>"; m_szOut += "<td>" + vrResult[i].szModel + "</td>"; m_szOut += "<td>" + vrResult[i].szSpecification + "</td>"; m_szOut += "<td>" + vrResult[i].dwNationCode + "</td>"; m_szOut += "<td>" + vrResult[i].szProducer + "</td>"; m_szOut += "<td>" + GetJustName(vrResult[i].dwProperty, "DevKind_dwProperty") + "</td>"; m_szOut += "<td><div class='OPTD'></div></td>"; m_szOut += "</tr>"; } UpdatePageCtrl(m_Request.Device); } PutBackValue(); }
protected void Page_Load(object sender, EventArgs e) { m_bRemember = false; string szTerm = Request["term"]; string szKind = Request["kind"]; string szAll = Request["InAll"];//szAll=false不包含全部 Response.CacheControl = "no-cache"; DEVKINDREQ vrGetCls = new DEVKINDREQ(); UNIDEVKIND[] vtCls; vrGetCls.szKindName = szTerm; vrGetCls.szReqExtInfo.dwNeedLines = 10; //最多10条 if (szKind != null && szKind != "") { vrGetCls.dwClassKind = Parse(szKind); } if (m_Request.Device.DevKindGet(vrGetCls, out vtCls) == REQUESTCODE.EXECUTE_SUCCESS && vtCls != null) { MyString szOut = new MyString(); szOut += "["; if (szAll == null || szAll == "") { szOut += "{\"id\":\"" + "0" + "\",\"label\": \"" + "全部" + "\"},"; } for (int i = 0; i < vtCls.Length; i++) { szOut += "{\"id\":\"" + vtCls[i].dwKindID + "\",\"label\": \"" + vtCls[i].szKindName + "\",\"dwClassKind\": \"" + vtCls[i].dwClassKind + "\",\"szSpecification\": \"" + vtCls[i].szSpecification + "\",\"szModel\": \"" + vtCls[i].szModel + "\"}"; if (i < vtCls.Length - 1) { szOut += ","; } } szOut += "]"; Response.Write(szOut); } else { Response.Write("[ ]"); } }
// Sets symbol. Must be exactly one symbol. public static void SetSymbol(MyString myStr, string propertyName) { var property = myStr.GetType().GetProperty(propertyName); while (true) { Console.WriteLine("Введите переменную " + propertyName + ":"); ValueToCheck = Console.ReadLine(); if (ValueToCheck.Length == 1) { property.SetValue(myStr, ValueToCheck[0]); break; } else { Console.WriteLine("Должен быть один символ!"); } } }
static void Main(string[] args) { MyString str1 = new MyString(new char[] { 'H', 'e', 'l', 'l', 'o', ' ', '\0' }); MyString str2 = new MyString(new char[] { 'W', 'o', 'r', 'l', 'd', '!', ' ', '\0' }); MyString str3 = new MyString(new char[] { 'M', 'y', ' ', 'n', 'a', 'm', 'e', ' ', 'i', 's', ' ', 'R', 'o', 'm', 'a', ',', 'i', 'a', 'm', ' ', '1', '8', ' ', 'y', 'e', 'a', 'r', 's', ',', 'o', 'l', 'd', ' ', '\0' }); MyString[] mas = new MyString[] { str1, str2 }; Text first_text = new Text(mas, 2); //створення тексту Console.WriteLine("Текст:"); first_text.Print(); //виведення тексту Console.WriteLine(); first_text.PlusString(str3); //додавання рядка до тексту Console.WriteLine("Текст пiсля додавання рядка: "); first_text.Print(); //виведення тексту Console.WriteLine(); Console.WriteLine("Загальна кiлькiсть символiв у текстi :"); Console.WriteLine(first_text.Size_Text()); //загальна кількість символів у тексті Console.WriteLine("Вiдсоток символiв - цифр у текстi :"); Console.WriteLine(first_text.DigitsProcent(first_text.Size_Text())); //відсоток символів - цифр у тексті Console.WriteLine("Поточний текст : "); first_text.Print(); Console.WriteLine(); Console.WriteLine("Найбiльший рядок у текстi :"); first_text.BigStr().Print(); //знаходження найбільшого рядка тексту і виведення на екран Console.WriteLine(); Console.WriteLine("Текст пiсля видалення заданого рядка :"); first_text.StringDel(2); // видалення заданого рядка тексту first_text.Print(); Console.WriteLine(); Console.WriteLine("Текст пiсля повного очищення :"); first_text.DelText(); // очищення тексту first_text.Print(); Console.ReadKey(); }
static void Main(string[] args) { LLVM.InitializeAllTargets(); LLVM.InitializeAllTargetMCs(); LLVM.InitializeAllTargetInfos(); LLVM.InitializeAllAsmPrinters(); ModuleRef mod = LLVM.ModuleCreateWithName("LLVMSharpIntro"); TypeRef[] param_types = { LLVM.Int32Type(), LLVM.Int32Type() }; TypeRef ret_type = LLVM.FunctionType(LLVM.Int32Type(), param_types, false); ValueRef sum = LLVM.AddFunction(mod, "sum", ret_type); BasicBlockRef entry = LLVM.AppendBasicBlock(sum, "entry"); BuilderRef builder = LLVM.CreateBuilder(); LLVM.PositionBuilderAtEnd(builder, entry); ValueRef tmp = LLVM.BuildAdd(builder, LLVM.GetParam(sum, 0), LLVM.GetParam(sum, 1), "tmp"); LLVM.BuildRet(builder, tmp); MyString the_error = new MyString(); LLVM.VerifyModule(mod, VerifierFailureAction.AbortProcessAction, the_error); //LLVM.DisposeMessage(error); ExecutionEngineRef engine; MCJITCompilerOptions options = new MCJITCompilerOptions(); var optionsSize = (4 * sizeof(int)) + IntPtr.Size; // LLVMMCJITCompilerOptions has 4 ints and a pointer LLVM.InitializeMCJITCompilerOptions(options, (uint)optionsSize); LLVM.CreateMCJITCompilerForModule(out engine, mod, options, (uint)optionsSize, the_error); var ptr = LLVM.GetPointerToGlobal(engine, sum); IntPtr p = (IntPtr)ptr; Add addMethod = (Add)Marshal.GetDelegateForFunctionPointer(p, typeof(Add)); int result = addMethod(10, 10); Console.WriteLine("Result of sum is: " + result); if (LLVM.WriteBitcodeToFile(mod, "sum.bc") != 0) { Console.WriteLine("error writing bitcode to file, skipping"); } LLVM.DumpModule(mod); LLVM.DisposeBuilder(builder); LLVM.DisposeExecutionEngine(engine); }
public static void AddField(this DatatableBag datatableBag, string fieldName) { // Add a new column MyString newColName = new MyString(); newColName.VarName = fieldName; // datatableBag.ColumnNameList.Add(newColName); datatableBag.ColumnNameList.Insert(int.Parse(fieldName), newColName); // Add a col value to each record foreach (FieldsList row in datatableBag.RecordList) { // FieldsList newCol = new FieldsList(); MyString newColValue = new MyString(); newColValue.VarName = "0"; row.Fields.Add(newColValue); row.Fields.Insert(int.Parse(fieldName), newColValue); } }
protected void Page_Load(object sender, EventArgs e) { if (Request["room"] != null) { m_szOpts += "机房号:" + Request["room"]; } DEVREQ vrParameter = new DEVREQ(); UNIDEVICE[] vrResult; vrParameter.dwProperty = (uint)(UNIDEVKIND.DWPROPERTY.DEVPROP_EXCLUSIVE | UNIDEVKIND.DWPROPERTY.DEVPROP_SHARE); GetPageCtrlValue(out vrParameter.szReqExtInfo); if (m_Request.Device.Get(vrParameter, out vrResult) == REQUESTCODE.EXECUTE_SUCCESS) { for (int i = 0; i < vrResult.Length; i++) { m_szOut += "<tr>"; m_szOut += "<td data-id=" + vrResult[i].dwDevID.ToString() + ">" + vrResult[i].dwDevSN + "</td>"; m_szOut += "<td class='lnkDevice' data-id='" + vrResult[i].dwDevID + "'>" + vrResult[i].szPCName.ToString() + "</td>"; m_szOut += "<td>" + vrResult[i].szIP.ToString() + "</td>"; m_szOut += "<td >" + vrResult[i].szKindName + "</td>"; m_szOut += "<td >" + vrResult[i].szModel + "</td>"; m_szOut += "<td >" + vrResult[i].szSpecification + "</td>"; m_szOut += "<td class='lnkRoom' data-id='" + vrResult[i].dwRoomID + "'>" + vrResult[i].szRoomName + "</td>"; m_szOut += "<td class='lnkLab' data-id='" + vrResult[i].dwLabID + "'>" + vrResult[i].szLabName + "</td>"; if (vrResult[i].DevUse != null && vrResult[i].DevUse.Length > 0) { m_szOut += "<td>" + vrResult[i].DevUse[0].szTrueName + "</td>"; } else { m_szOut += "<td></td>"; } m_szOut += "<td>" + vrResult[i].dwDevStat + "</td>"; m_szOut += "<td><div class='OPTD'></div></td>"; m_szOut += "</tr>"; } UpdatePageCtrl(m_Request.Device); } PutBackValue(); }
public ActionResult Edit(Product row) { Product product = db.Products.Find(row.Id); if (ModelState.IsValid) { try { product.Name = row.Name; product.CategoryId = row.CategoryId; product.ManufacturerId = row.ManufacturerId; product.Slug = MyString.GenerateSlug(row.Name); product.Detail = row.Detail; product.MetaKey = row.MetaKey; product.MetaDescription = row.MetaDescription; product.Number = row.Number; product.Price = row.Price; product.PriceSale = row.PriceSale; product.Updated_At = DateTime.Now; product.Updated_By = 0; if (row.Files != null) { string file_name = Path.GetFileNameWithoutExtension(row.Files.FileName); string file_extension = Path.GetExtension(row.Files.FileName); file_name = file_name + "-" + DateTime.Now.ToString("yyyy-MM-dd") + file_extension; string path_upload = Path.Combine(Server.MapPath("~/Public/Images"), file_name); row.Files.SaveAs(path_upload); product.Images = file_name; } db.Entry(product).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } catch { ModelState.AddModelError("", "Sửa thất bại"); } } ViewBag.CategoriesID = new SelectList(db.Categories.Where(m => m.Status == true).ToList(), "Id", "Name", 0); ViewBag.ManufacturerID = new SelectList(db.Manufacturers.ToList(), "Id", "Name", 0); return(View("Edit", product)); }
public SearchInvoice(String q, string teamIDStr, string myIDStr) { int teamID = Convert.ToInt32(teamIDStr); int myID = Convert.ToInt32(myIDStr); Items = new List <ItemOption>(); var mi = new MyInvoice(); List <Sales_JobMasterList_Invoice> items = mi.GetInvoicesBySalesID(myID); try { string[] search = q.Split(' '); if (items.Count == 0) { return; } foreach (Sales_JobMasterList_Invoice item in items) { string namevalue = item.invoiceNo + "V" + item.Revision.ToString() + "-" + item.Title; if (!MyString.IsContainsAny(namevalue, search)) { continue; } var st = new ItemOption { Name = namevalue, SelectedID = Convert.ToString(item.invoiceID), Value = namevalue }; Items.Add(st); } } catch (Exception ex) { string exp = ex.ToString(); //Setup a breakpoint here to verify any exceptions raised. } }
protected void Page_Load(object sender, EventArgs e) { m_bRemember = false; string szTerm = Request["term"]; string szCode = Request["Code"]; Response.CacheControl = "no-cache"; COURSEREQ vrGetCls = new COURSEREQ(); UNICOURSE[] vtCls; if (szTerm != null && szTerm != "") { vrGetCls.szCourseName = szTerm; } if (szCode != null && szCode != "") { vrGetCls.szCourseCode = szCode; } vrGetCls.szReqExtInfo.dwNeedLines = 10; //最多10条 if (m_Request.Reserve.GetCourse(vrGetCls, out vtCls) == REQUESTCODE.EXECUTE_SUCCESS && vtCls != null) { MyString szOut = new MyString(); szOut += "["; for (int i = 0; i < vtCls.Length; i++) { szOut += "{\"id\":\"" + vtCls[i].dwCourseID + "\",\"label\": \"" + vtCls[i].szCourseName + "\",\"testhour\": \"" + vtCls[i].dwTestHour + "\",\"code\": \"" + vtCls[i].szCourseCode + "\"}"; if (i < vtCls.Length - 1) { szOut += ","; } } szOut += "]"; Response.Write(szOut); } else { Response.Write("[ ]"); } }
protected void Page_Load(object sender, EventArgs e) { ACCREQ vrParameter = new ACCREQ(); UNIACCOUNT[] vrResult; GetHTTPObj(out vrParameter); GetPageCtrlValue(out vrParameter.szReqExtInfo); if (m_Request.Account.Get(vrParameter, out vrResult) == REQUESTCODE.EXECUTE_SUCCESS) { for (int i = 0; i < vrResult.Length; i++) { m_szOut += "<tr>"; m_szOut += "<td data-id='" + vrResult[i].dwAccNo.ToString() + "'>" + vrResult[i].szLogonName + "</td>"; m_szOut += "<td>" + vrResult[i].szTrueName + "</td>"; m_szOut += "<td>" + GetJustNameEqual((uint)vrResult[i].dwSex, "ACCNO_sex") + "</td>"; uint uIdent = (uint)vrResult[i].dwIdent; if ((uIdent & (uint)UNIACCOUNT.DWIDENT.EXTIDENT_INNER) > 0) { uIdent = uIdent - (uint)UNIACCOUNT.DWIDENT.EXTIDENT_INNER; } else if ((uIdent & (uint)UNIACCOUNT.DWIDENT.EXTIDENT_OUTER) > 0) { uIdent = uIdent - (uint)UNIACCOUNT.DWIDENT.EXTIDENT_OUTER; } else if ((uIdent & (uint)UNIACCOUNT.DWIDENT.EXTIDENT_MANAGER) > 0) { uIdent = uIdent - (uint)UNIACCOUNT.DWIDENT.EXTIDENT_MANAGER; } m_szOut += "<td>" + GetJustNameEqual(uIdent, "ACCNO_IDENT") + "</td>"; m_szOut += "<td>" + vrResult[i].szClassName + "</td>"; m_szOut += "<td>" + vrResult[i].szDeptName + "</td>"; m_szOut += "<td>" + vrResult[i].szTutorName + "</td>"; m_szOut += "<td>" + vrResult[i].szHandPhone + "</td>"; m_szOut += "<td>" + vrResult[i].szEmail + "</td>"; m_szOut += "<td>" + vrResult[i].szMemo + "</td>"; m_szOut += "<td><div class='OPTD'></div></td>"; m_szOut += "</tr>"; } UpdatePageCtrl(m_Request.Account); } PutBackValue(); }
protected void Page_Load(object sender, EventArgs e) { m_bRemember = false; string kind = Request["kind"]; string name = Request["term"]; Response.CacheControl = "no-cache"; COMPANYREQ vrGet = new COMPANYREQ(); UNICOMPANY[] vtCls; if (name != null && name != "") { vrGet.szComName = name; } if (kind != null && kind != "" && kind != "0") { vrGet.dwComKind = Parse(kind); } vrGet.szReqExtInfo.dwNeedLines = 15; //最多10条 if (m_Request.Assert.GetCompany(vrGet, out vtCls) == REQUESTCODE.EXECUTE_SUCCESS && vtCls != null) { MyString szOut = new MyString(); szOut += "["; for (int i = 0; i < vtCls.Length; i++) { szOut += "{\"id\":\"" + vtCls[i].dwComID + "\",\"label\": \"" + vtCls[i].szComName + "\"}"; if (i < vtCls.Length - 1) { szOut += ","; } } szOut += "]"; Response.Write(szOut); } else { Response.Write("[ ]"); } }
protected void Page_Load(object sender, EventArgs e) { m_bRemember = false; string szTerm = Request["term"]; if (szTerm == null) { szTerm = ""; } Response.CacheControl = "no-cache"; TESTPLANREQ vrGetCls = new TESTPLANREQ(); UNITESTPLAN[] vtCls; vrGetCls.dwGetType = (uint)TESTPLANREQ.DWGETTYPE.TESTPLANGET_BYALL; vrGetCls.dwYearTerm = 20131401; //vrGetCls.dwGetType = (uint)TESTPLANREQ.DWGETTYPE.TESTPLANGET_BYNAME; //vrGetCls.szGetKey = szTerm; vrGetCls.szReqExtInfo.dwNeedLines = 10; //最多10条 if (m_Request.Reserve.GetTestPlan(vrGetCls, out vtCls) == REQUESTCODE.EXECUTE_SUCCESS && vtCls != null) { MyString szOut = new MyString(); szOut += "["; for (int i = 0; i < vtCls.Length; i++) { szOut += "{\"id\":\"" + vtCls[i].dwTestPlanID + "\",\"label\": \"" + vtCls[i].szTestPlanName + "\"}"; if (i < vtCls.Length - 1) { szOut += ","; } } szOut += "]"; Response.Write(szOut); } else { Response.Write("[ ]"); } }
protected void Page_Load(object sender, EventArgs e) { REQUESTCODE uResponse = REQUESTCODE.EXECUTE_FAIL; DEVCHGREQ vrParameter = new DEVCHGREQ(); uint uYearTerm = 20131401; if ((((ADMINLOGINRES)Session["LoginResult"]).dwManRole & (uint)ADMINLOGINRES.DWMANROLE.MANROLE_LEADER) > 0) { bLeader = true; } DEVCHG vrResult; vrParameter.dwYearTerm = uYearTerm; vrParameter.dwReportStat = (uint)DEVLIST.DWREPORTSTAT.REPORTSTAT_DEPLOY; uResponse = m_Request.Report.GetDevChg(vrParameter, out vrResult); if (uResponse == REQUESTCODE.EXECUTE_SUCCESS && vrResult.dwYearTerm != null) { for (int i = 0; i < 1; i++) { m_szOut += "<tr>"; m_szOut += "<td>" + ConfigConst.GCSchoolCode.ToString() + "</td>"; m_szOut += "<td>" + vrResult.dwBDevNum.ToString() + "</td>"; m_szOut += "<td>" + ((uint)vrResult.dwBMoney) + "</td>"; m_szOut += "<td>" + vrResult.dwBBigDevNum.ToString() + "</td>"; m_szOut += "<td>" + ((uint)vrResult.dwBBigMoney) + "</td>"; m_szOut += "<td>" + vrResult.dwIncDevNum.ToString() + "</td>"; m_szOut += "<td>" + ((uint)vrResult.dwIncMoney) + "</td>"; m_szOut += "<td>" + vrResult.dwDecDevNum.ToString() + "</td>"; m_szOut += "<td>" + ((uint)vrResult.dwDecMoney) + "</td>"; m_szOut += "<td>" + vrResult.dwEDevNum.ToString() + "</td>"; m_szOut += "<td>" + ((uint)vrResult.dwEMoney) + "</td>"; m_szOut += "<td>" + vrResult.dwEBigDevNum.ToString() + "</td>"; m_szOut += "<td>" + ((uint)vrResult.dwEBigMoney) + "</td>"; m_szOut += "</tr>"; } } UpdatePageCtrl(m_Request.Report); PutBackValue(); }
protected void Page_Load(object sender, EventArgs e) { UNICAMPUS[] camp = GetAllCampus(); if (camp != null && camp.Length > 0) { m_szCamp += "<option value='0'>" + "全部" + "</option>"; for (int i = 0; i < camp.Length; i++) { m_szCamp += "<option value='" + camp[i].dwCampusID + "'"; m_szCamp += ">" + camp[i].szCampusName + "</option>"; } } if (Request["delID"] != null) { DelLab(Request["delID"]); } BUILDINGREQ vrParameter = new BUILDINGREQ(); GetHTTPObj(out vrParameter); if (vrParameter.szCampusIDs != null && vrParameter.szCampusIDs.ToString() == "0") { vrParameter.szCampusIDs = null; } UNIBUILDING[] vrResult; GetPageCtrlValue(out vrParameter.szReqExtInfo); if (m_Request.Device.BuildingGet(vrParameter, out vrResult) == REQUESTCODE.EXECUTE_SUCCESS) { UpdatePageCtrl(m_Request.Device); for (int i = 0; i < vrResult.Length; i++) { m_szOut += "<tr>"; m_szOut += "<td data-id=\"" + vrResult[i].dwBuildingID.ToString() + "\">" + vrResult[i].szBuildingNo + "</td>"; m_szOut += "<td>" + vrResult[i].szBuildingName.ToString() + "</td>"; m_szOut += "<td>" + vrResult[i].szCampusName.ToString() + "</td>"; m_szOut += "<td><div class='OPTD'></div></td>"; m_szOut += "</tr>"; } } PutBackValue(); }
static void Main(string[] args) { var aString = new MyString() { Description = "desc", Id = 1, Name = "Ja", Status = "st", Value = "Val" }; var myStrings = new List <MyString>() { aString }; foreach (MyString myString in myStrings) { //The Name of the Item with the Id 1 is Ja. It's Description is desc. It has the Value val and the Status st. var outputStringVal = myString.ToString(); // } }
public override EReturn Load(Nini.Config.IConfig config) { base.Load(config); //Nini.Config.IConfig config = GetConfig(source, "Zrada"); if (config != null) { string s = config.GetString("Stin"); string[] stin = s.Split(','); List<MyString> mujList = new List<MyString>(); foreach (string ss in stin) { MyString ms = new MyString(); ms.String = ss; mujList.Add(ms); } Stin = mujList; return EReturn.NoError; } else return EReturn.Error; }
static void menuInit(MyText menu) { MyString menuHead = new MyString("Main menu:"), menu1 = new MyString("1 - Add a string to the text"), menu2 = new MyString("2 - Remove a string from the text"), menu3 = new MyString("3 - Clear text"), menu4 = new MyString("4 - Make the first letters of all words in the text uppercase "), menu5 = new MyString("5 - Get the \"key string\" of a string of text"), menu6 = new MyString("6 - Get the number of strings of a given length"), menu0 = new MyString("0 - Exit"); menu.AddString(menuHead, -1); menu.AddString(menu1, -1); menu.AddString(menu2, -1); menu.AddString(menu3, -1); menu.AddString(menu4, -1); menu.AddString(menu5, -1); menu.AddString(menu6, -1); menu.AddString(menu0, -1); }
public static MyString operator +(MyString a, MyString b) { int NewStrLength = a.Length + b.Length; int k = 0; MyString temp = new MyString { mystr = new char[NewStrLength] }; for (int i = 0; i < a.Length; i++) { temp[i] = a[i]; } for (int j = a.Length; j < NewStrLength; j++) { temp[j] = b[k]; k++; } return(temp); }
public static MyString operator +(MyString str1, MyString str2)//todo ты строки только складываешь? а как же сравнение строк (==, !=)? Поиск подстроки в строке? Замена подстроки в строке? Напиши хотя бы эти методы, но я тебя не ограничиваю :) { char[] s1 = str1.StrVal; char[] s2 = str2.StrVal; char[] s = new char[(s1.Length + s2.Length)]; for (int i = 0; i < s1.Length; i++) { s[i] = s1[i]; } for (int i = 0; i < s2.Length; i++) { s[s1.Length + i] = s2[i]; } MyString newstr = new MyString(s); return(newstr); }
public override int Validate() { var v = (int)NWorkorderValidationError.Validated; int isInstalltoID = GetIsInstallto(); var ci = new CustomerDetails(isInstalltoID); string address = ci.Address; string city = ci.City; if (!(MyString.IsStringLengthLongerThan(3, address) & MyString.IsStringLengthLongerThan(3, city))) { v = (int)NWorkorderValidationError.InstalltoAddressOrCityRequired; } return(v); }
static void Main(string[] args) { MyBool.ZeigeGleichheit(); MyBool.ZeigeUngleichheit(); MyBool.ZeigeUnd(); MyBool.ZeigeOder(); MyBool.ZeigeAusschlOder(); MyString.ZeigeInterpoliertesString(); MyString.ZeigeEscapes(); MyString.ZeigeVerbatimString(); MyString.ZeigeinterpoliertesVerbatimString(); MyInt.ZeigeLiterals(); MyInt.ZeigeMöglicheWerte(); MyInt.ZeigeParsing(); MyInt.ZeigeCasting(); MyInt.ZeigeVergleich(); MyDouble.ZeigeDouble(); MyEnum.ZeigeEnumerator(); Console.ReadKey(); }
protected void Page_Load(object sender, EventArgs e) { DEVREQ vrParameter = new DEVREQ(); UNIDEVICE[] vrResult; GetPageCtrlValue(out vrParameter.szReqExtInfo); if (m_Request.Device.Get(vrParameter, out vrResult) == REQUESTCODE.EXECUTE_SUCCESS) { for (int i = 0; i < vrResult.Length; i++) { m_szOut += "<tr>"; m_szOut += "<td data-id=" + vrResult[i].dwDevID.ToString() + " data-classid=" + vrResult[i].dwDevSN.ToString() + ">" + vrResult[i].szDevName + "</td>"; m_szOut += "<td><div class='OPTD'></div></td>"; m_szOut += "</tr>"; } UpdatePageCtrl(m_Request.Device); } PutBackValue(); }
protected void Page_Load(object sender, EventArgs e) { RTRESVREQ vrParameter = new RTRESVREQ(); if (!IsPostBack) { vrParameter.dwBeginDate = GetDate(DateTime.Now.AddDays(-7).ToString("yyyy-MM-dd")); vrParameter.dwEndDate = GetDate(DateTime.Now.AddDays(7).ToString("yyyy-MM-dd")); dwStartDate.Value = DateTime.Now.AddDays(-7).ToString("yyyy-MM-dd"); dwEndDate.Value = DateTime.Now.AddDays(7).ToString("yyyy-MM-dd"); } if (dwStartDate.Value != "" && dwEndDate.Value != "") { vrParameter.dwBeginDate = GetDate(dwStartDate.Value); vrParameter.dwEndDate = GetDate(dwEndDate.Value); } RTRESV[] vrResult; GetPageCtrlValue(out vrParameter.szReqExtInfo); if (m_Request.Reserve.GetRTResv(vrParameter, out vrResult) == REQUESTCODE.EXECUTE_SUCCESS) { int count = 0; uint uTimeNow = Get1970Seconds(DateTime.Now.ToString("yyyy-MM-dd HH:mm")); for (int i = 0; i < vrResult.Length; i++) { count = count + 1; m_szOut += "<tr>"; m_szOut += "<td data-id=\"" + vrResult[i].dwResvID.ToString() + "\">" + vrResult[i].szTestName.ToString() + "</td>"; m_szOut += "<td class='lnkAccount' data-id='" + vrResult[i].dwOwner.ToString() + "' title='查看个人信息'><a href=\"#\">" + vrResult[i].szOwnerName.ToString() + "</a></td>"; m_szOut += "<td class='lnkAccount' data-id='" + vrResult[i].dwLeaderID.ToString() + "' title='查看个人信息'><a href=\"#\">" + vrResult[i].szLeaderName.ToString() + "</a></td>"; m_szOut += "<td>" + vrResult[i].szDevName.ToString() + "</td>"; m_szOut += "<td>" + vrResult[i].szLabName.ToString() + "</td>"; m_szOut += "<td>" + Get1970Date((uint)vrResult[i].dwOccurTime, "MM-dd HH:mm") + "</td>"; m_szOut += "<td>" + Get1970Date((uint)vrResult[i].dwBeginTime, "MM-dd HH:mm") + "到" + Get1970Date((uint)vrResult[i].dwEndTime, "MM-dd HH:mm") + "</td>"; m_szOut += "</tr>"; } UpdatePageCtrl(m_Request.Reserve); } PutBackValue(); }
static void Main(string[] args) { // Задание 2.4 /* Написать свой собственный класс MyString, описывающий строку как массив * символов. Перегрузить для этого класса типовые операции.*/ Console.WriteLine("\nЗадание 2.4 \n"); MyString str1 = new MyString("1234567"); MyString str2 = new MyString("45"); Console.Write("Исходная строка: "); str1.Print(); Console.Write("Сложение объектов: "); str1 = str1 + str2; str1.Print(); Console.Write("Вычитание объектов: "); str1 = str1 - str2; str1.Print(); Console.Write("Сложение объектов со строками: "); str1 = str1 + "89"; str1.Print(); Console.Write("Сложение строк с объектами: "); str1 = "12" + str1; str1.Print(); Console.Write("Вычитание объектов из строк: "); str1 = "1234567" - str2; str1.Print(); Console.Write("Вычитание строк из объектов: "); str1 = str1 - "23"; str1.Print(); Console.ReadKey(); }
public virtual EReturn Load(IConfig config) { //IConfig config = GetConfig(source, "Karta"); if (config != null) { Id = config.GetString("ID"); Jmeno = config.GetString("Jmeno"); Popis = config.GetString("Popis"); Sfera = (ESfery)config.GetInt("Sfera"); Typ = (ETypy)config.GetInt("Typ"); string s = config.GetString("Druh"); string[] druh = s.Split(','); Druh = new List<MyString>(); foreach (string ss in druh) { MyString ms = new MyString(); ms.String = ss; Druh.Add(ms); } s = config.GetString("Reakce"); string[] reakce = s.Split(','); Reakce = new List<MyString>(); foreach (string ss in reakce) { MyString ms = new MyString(); ms.String = ss; Reakce.Add(ms); } Text = config.GetString("Text"); Autor = config.GetString("Autor"); Kvalita = config.GetBoolean("Kvalita"); return EReturn.NoError; } else return EReturn.Error; }
public static MyString operator +(MyString str1, MyString str2) { //string str = str1.GetStr() + str2.GetStr(); //char[] newArrStr = new char[str1.arrStr.Length + str2.arrStr.Length]; MyString newArrStr = new MyString(); newArrStr.arrStr = new char[str1.arrStr.Length + str2.arrStr.Length]; //newArrStr.CopyTo(str1.arrStr, 0); //newArrStr.CopyTo(str2.arrStr, str1.arrStr.Length); for (int i = 0; i < str1.arrStr.Length; i++) { newArrStr.arrStr[i] = str1.arrStr[i]; } for (int j = 0; j < str2.arrStr.Length; j++) { newArrStr.arrStr[j + str1.arrStr.Length] = str2.arrStr[j]; } //return new MyString(newArrStr.ToString()); return newArrStr; }
public static MyString operator -(string str1, MyString str2) { bool success = false; int indexSubstring = 0; #region Search for (int i = 0; i < str1.Length; i++) { if (str1[i] == str2.arrStr[0]) { indexSubstring = i; int count = 0; while (count < str2.arrStr.Length) { if (str1[i + count] == str2.arrStr[count]) { count++; } else { break; } } if (count == str2.arrStr.Length) { success = true; } } } #endregion #region Subtraction if (success == true) { MyString newArrStr = new MyString(); newArrStr.arrStr = new char[str1.Length - str2.arrStr.Length]; string countStr = ""; for (int i = 0; i < indexSubstring; i++) { countStr += str1[i]; } // Если не последний if (indexSubstring != str1.Length - str2.arrStr.Length) { // Если не с края if (str2.arrStr.Length <= str1.Length - (indexSubstring + str2.arrStr.Length)) { for (int i = indexSubstring; i < str1.Length - str2.arrStr.Length; i++) { countStr += str1[i + str2.arrStr.Length]; } } else { for (int i = 0; i < str1.Length - (indexSubstring + str2.arrStr.Length); i++) { countStr += str1[indexSubstring + str2.arrStr.Length + i]; } } } for (int i = 0; i < countStr.Length; i++) { newArrStr.arrStr[i] = countStr[i]; } return newArrStr; } else { return new MyString(str1); } #endregion }
public static MyString operator +(string str1, MyString str2) { MyString newArrStr = new MyString(); newArrStr.arrStr = new char[str1.Length + str2.arrStr.Length]; for (int i = 0; i < str1.Length; i++) { newArrStr.arrStr[i] = str1[i]; } for (int j = 0; j < str2.arrStr.Length; j++) { newArrStr.arrStr[j + str1.Length] = str2.arrStr[j]; } return newArrStr; }
public override EReturn Load(Nini.Config.IConfig config) { base.Load(config); //Nini.Config.IConfig config = GetConfig(source, "Nepritel"); if (config != null) { Ohrozeni = config.GetInt("Ohrozeni"); Stretnuti = config.GetInt("Stretnuti"); Utok = config.GetInt("Utok"); Obrana = config.GetInt("Obrana"); Zivoty = config.GetInt("Zivoty"); string s = config.GetString("Stiny"); string[] stin = s.Split(','); Stin = new List<MyString>(); foreach (string ss in stin) { MyString ms = new MyString(); ms.String = ss; Stin.Add(ms); } return EReturn.NoError; } else return EReturn.Error; }