/// <summary> /// Dispose the collection /// </summary> public void Dispose() { if (pArray != null) { pArray.Clear(); pArray = null; } }
public bool SaveData(ArrayList ParameterList, DataTable dt) { bool bResult = false; ArrayList Para = new ArrayList(); try { //ParameterList[0] D_CREATEDATE //ParameterList[1] V_CREATEUID VAM21_DBO DBO = new VAM21_DBO(ref USEDB); Conn = USEDB.CreateConnection(); Conn.Open(); DBT = Conn.BeginTransaction(); //先刪除已存在DB內的資料 for (int i = 0; i < dt.Rows.Count; i++) { if (dt.Rows[i]["CREATEDATE"].ToString().Trim() != "") { Para.Clear(); Para.Add(dt.Rows[i]["ID"].ToString().Trim()); DBO.DeleteData(Para, DBT); } } //全部重新INSERT for (int i = 0; i < dt.Rows.Count; i++) { if ((dt.Rows[i]["ENABLE"].ToString().Trim() == "1") && (dt.Rows[i]["VENDOR"].ToString().Trim() != "")) { Para.Clear(); Para.Add(dt.Rows[i]["VENDOR"].ToString().Trim()); Para.Add(ParameterList[0]); Para.Add(ParameterList[1]); DBO.InsertData(Para, DBT); } } DBT.Commit(); bResult = true; } catch (Exception ex) { if (DBT != null) DBT.Rollback(); throw ex; } finally { //獨立呼叫Transcation,關閉連線 if (Conn.State == ConnectionState.Connecting) Conn.Close(); } return bResult; }
/// <summary> Reset the retransmitter: clear all msgs and cancel all the /// respective tasks /// </summary> public virtual void reset() { lock (msgs.SyncRoot) { for (int index = 0; index < msgs.Count; index++) { RetransmitterEntry entry = (RetransmitterEntry)msgs[index]; entry.cancel(); } msgs.Clear(); } }
public train(formDelegate sender, ArrayList from) { trainDelegate = sender; toolTip = Convert.ToBoolean(from[0]); from.Clear(); InitializeComponent(); }
public void sendEmail(string recipID, string msgBody) { ArrayList msgList = new ArrayList(); msgList.Clear(); msgList.Add(recipID); foreach (string item in msgList) { try { MailMessage message = new MailMessage(); message.To.Add(item); message.Subject = "Printable Integration Notication"; message.From = new MailAddress("*****@*****.**"); message.Body = msgBody; message.ReplyTo = new MailAddress("*****@*****.**"); message.IsBodyHtml = true; System.Net.Mail.SmtpClient smtp = Globals.get_smtpClient; Console.ForegroundColor = ConsoleColor.Cyan; Console.Write("Sending email to " + message.To.ToString()); smtp.Send(message); Console.WriteLine(" - Success"); Console.ResetColor(); message.Dispose(); } catch (Exception e) { Console.WriteLine("SendEmail Error - RecipID:" + recipID + " - Receiver:" + item + " - Msg:" + msgBody); Console.WriteLine(e.ToString()); Console.Beep(); //errorLog("Email-1", e.ToString(), "SendEmail Error - RecipID:" + recipID + " - Receiver:" + item + " - Msg:" + msgBody); } } }
public Int32 select1giatriPRObigint(string storeName, System.Collections.ArrayList parameterCollection) { int kq; SqlConnection sqlConnection1 = new SqlConnection(connStr); SqlCommand cmd = new SqlCommand(); cmd.CommandText = storeName; cmd.CommandType = CommandType.StoredProcedure; cmd.Connection = sqlConnection1; if (parameterCollection != null) { foreach (object oParameter in parameterCollection) { cmd.Parameters.Add(oParameter); } parameterCollection.Clear(); } sqlConnection1.Open(); try { kq = Convert.ToInt32(cmd.ExecuteScalar()); } catch (Exception) { return(0); } sqlConnection1.Close(); return(kq); }
private void 下料完成ToolStripMenuItem_Click(object sender, EventArgs e) { AddWorkerIDFrm addID = new AddWorkerIDFrm(); if (addID.ShowDialog() == DialogResult.OK) { string frmtext = this.Parent.Text.ToString(); string workID = addID.nametb.Text.ToString(); DateTime datetime = System.DateTime.Now; ArrayList selectedlist = new ArrayList(); foreach (DataGridViewRow dr in this.dataGridView1.Rows) { if (dr.Selected == true) { selectedlist.Add(dr.Index); } } for (int i = 0; i < selectedlist.Count; i++) { int index = int.Parse(selectedlist[i].ToString()); string projectidStr = this.dataGridView1.Rows[index].Cells["项目号"].Value.ToString(); string drawingStr = this.dataGridView1.Rows[index].Cells["图纸号"].Value.ToString(); string spoolStr = this.dataGridView1.Rows[index].Cells["小票号"].Value.ToString(); WorkShopStatusFlow.UpdatePersonStatus("SP_UPDATEPERSONSTATUS", projectidStr, drawingStr, spoolStr, workID, datetime, frmtext); this.dataGridView1.Rows[index].Cells["下料人"].Value = workID; this.dataGridView1.Rows[index].Cells["下料日期"].Value = datetime; } selectedlist.Clear(); MessageBox.Show("--------完成--------"); } }
public void Test(int arg) { ArrayList items = new ArrayList(); items.Add(1); items.AddRange(1, 2, 3); items.Clear(); bool b1 = items.Contains(2); items.Insert(0, 1); items.InsertRange(1, 0, 5); items.RemoveAt(4); items.RemoveRange(4, 3); items.Remove(1); object[] newItems = items.GetRange(5, 2); object[] newItems2 = items.GetRange(5, arg); List<int> numbers = new List<int>(); numbers.Add(1); numbers.AddRange(1, 2, 3); numbers.Clear(); bool b2 = numbers.Contains(4); numbers.Insert(1, 10); numbers.InsertRange(2, 10, 3); numbers.RemoveAt(4); numbers.RemoveRange(4, 2); int[] newNumbers = items.GetRange(5, 2); int[] newNumbers2 = items.GetRange(5, arg); string[] words = new string[5]; words[0] = "hello"; words[1] = "world"; bool b3 = words.Contains("hi"); string[] newWords = words.GetRange(5, 2); string[] newWords2 = words.GetRange(5, arg); }
/// <summary> /// Oracle錯誤訊息判別 /// </summary> /// <param name="oex">傳入Oracle的錯誤物件</param> /// <param name="USEDB">傳入參考的DB</param> public Exception OracleExceptionProxy(OracleException oex, Database USEDB ) { ArrayList ParameterList = new ArrayList(); #region 輸入變數 ParameterList.Clear(); //Oracle 錯誤代碼 ParameterList.Add(oex.Code); #endregion string pmSqlExceptionMessage = ExceptionMessage(ParameterList, USEDB ); if (pmSqlExceptionMessage.Length != 0)//有自定義的錯誤訊息 { //this.SaveSqlErrorLog(oex, "AP SERVER 已處理"); return new Exception(pmSqlExceptionMessage); } else { return oex; } }
//重置,每次新生成一个json对象时必须执行该方法 public void Reset() { _success = true; _has_next = true; singleInfo = string.Empty; arrData.Clear(); }
internal bool ImportComComponent(string path, OutputMessageCollection outputMessages, string outputDisplayName) { ComImporter importer = new ComImporter(path, outputMessages, outputDisplayName); if (importer.Success) { ArrayList list = new ArrayList(); if (this.typeLibs != null) { list.AddRange(this.typeLibs); } if (importer.TypeLib != null) { list.Add(importer.TypeLib); } this.typeLibs = (TypeLib[]) list.ToArray(typeof(TypeLib)); list.Clear(); if (this.comClasses != null) { list.AddRange(this.comClasses); } if (importer.ComClasses != null) { list.AddRange(importer.ComClasses); } this.comClasses = (ComClass[]) list.ToArray(typeof(ComClass)); } return importer.Success; }
/** * Adds all possible blendshape targets of the game object * curGameObject and its sub-objects (recursively) to the * list of target blendshapes. */ public static void GetGameObjectBlendshapes(GameObject curGameObject, ArrayList blendshape_infos) { if (blendshape_infos != null) blendshape_infos.Clear(); // Iterate over game object itself and over children and add blendshapes Transform [] children = curGameObject.GetComponentsInChildren<Transform>(); foreach (Transform child in children) { string transformPath = CalculateTransformPath(child, curGameObject.transform); SkinnedMeshRenderer meshRenderer = (SkinnedMeshRenderer)child.GetComponent(typeof(SkinnedMeshRenderer)); if (meshRenderer != null) { if (meshRenderer.sharedMesh != null) { //Debug.Log("Number of blend shapes: " + meshRenderer.sharedMesh.blendShapeCount); for (int blend_shape_nr = 0; blend_shape_nr < meshRenderer.sharedMesh.blendShapeCount; blend_shape_nr++) { string blend_shape_name = meshRenderer.sharedMesh.GetBlendShapeName(blend_shape_nr); //Debug.Log("Path: '" + transformPath + "', blend shape: '" + blend_shape_name + "'"); if (blendshape_infos != null) { BlendshapeInfo blendshape_info = new BlendshapeInfo(); blendshape_info.m_path = transformPath; blendshape_info.m_name = blend_shape_name; blendshape_info.m_index = blend_shape_nr; blendshape_info.m_mesh_renderer = meshRenderer; blendshape_infos.Add (blendshape_info); } } } } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { // //Setup Criteria // RestrictValueCount = RestrictValueOptions.OnlyOne_Period; // // Setup cmbDistrict // cmbDistrict.Attributes.Add("CriteriaName", CriteriaName); cmbDistrict.OnClientSelectedIndexChanged = CriteriaName + "Controller.OnComboChanged"; cmbDistrict.OnClientLoad = CriteriaName + "Controller.PopulateControls"; ValueDisplayTemplateName = "DistrictCriteriaValueDisplayTemplate"; // // Create Json array strings for populating our dropdownlist controls, and register them as javascript; // var serializer = new JavaScriptSerializer(); var arry = new ArrayList(); // data for cmbDistrict arry.Clear(); // todo: mpf - populate district data. //arry = Semester.BuildJsonArray(); ScriptManager.RegisterStartupScript(this, typeof(string), CriteriaName + "DependencyData", "var " + CriteriaName + "DependencyData = " + serializer.Serialize(arry) + ";", true); } ConfigureCriteriaHeader(CriteriaHeader, RadToolTip1); }
/// <summary> /// Renames ASP.NET VIEW_STATE input field name to some more secure name /// </summary> public static byte[] AspDotNetViewStateResetToDef(Stream src) { byte[] result; try { result = new byte[src.Length]; src.Read(result, 0, result.Length); } catch (NotSupportedException) { // If reading directly nor supported ArrayList arrayBuff = new ArrayList(); byte[] buff = new byte[256]; int readed = 0; do { readed = src.Read(buff, 0, buff.Length); for (int i = 0; i < readed; i++) { arrayBuff.Add(buff[i]); } } while (readed > 0); result = (byte[])arrayBuff.ToArray(typeof(byte)); arrayBuff.Clear(); } result = ApplyViewStateResetRename(result); return result; }
public static ArrayList CompareDocuments(string document1, string document2) { Common.SetLicense(); ArrayList result = new ArrayList(); try { // Create a temporary folder string comparisonDocument = GetCompareDocumentName(document1, document2); // Call the util class for comparison DocumentComparisonUtil docCompUtil = new DocumentComparisonUtil(); int added = 0, deleted = 0; docCompUtil.Compare(document1, document2, comparisonDocument, ref added, ref deleted); result.Add(Common.Success); // 0. Result result.Add((comparisonDocument)); // 1. Path of the comparison document result.Add(added); // 2. Number of additions result.Add(deleted); // 3. Number of deletions } catch (Exception ex) { result.Clear(); result.Add(Common.Error + ": " + ex.Message); // 0. Result } return result; }
private int HandleSubMenu(AutomationElement childHandle, AutomationElement firstObjHandle, ref ArrayList menuList) { if (childHandle == null || firstObjHandle == null) { throw new XmlRpcFaultException(123, "Argument cannot be null."); } string matchedKey = null; Hashtable objectHT = new Hashtable(); try { menuList.Clear(); utils.InternalGetObjectList(childHandle, ref menuList, ref objectHT, ref matchedKey); if (menuList.Count > 0) { // Set it back to old state, // else the menu selection left there utils.InternalClick(firstObjHandle); // Don't process the last item return 1; } else LogMessage("menuList.Count <= 0: " + menuList.Count); } catch (Exception ex) { LogMessage(ex); } finally { objectHT = null; } return 0; }
public bool chaySQLPRO(string storeName, System.Collections.ArrayList parameterCollection) { SqlConnection sqlConnection1 = new SqlConnection(connStr); SqlCommand cmd = new SqlCommand(); cmd.CommandText = storeName; cmd.CommandType = CommandType.StoredProcedure; cmd.Connection = sqlConnection1; if (parameterCollection != null) { foreach (object oParameter in parameterCollection) { cmd.Parameters.Add(oParameter); } parameterCollection.Clear(); } sqlConnection1.Open(); try { cmd.ExecuteNonQuery(); } catch (Exception) { sqlConnection1.Close(); return(false); } sqlConnection1.Close(); return(true); }
public Or(Or another) { Oid refOid = null; formula = new ArrayList(); try { if (another.Oid != null) { refOid = (Oid)another.Oid.Clone(); } if (another.Formula != null) { AndOrFormula[] items = (AndOrFormula[])another.Formula.Clone(); formula.Clear(); foreach (AndOrFormula item in items) { formula.Add(new AndOrFormula(item)); } } } catch (Exception e) { e.ToString(); } oid = refOid; isCorrected = another.isCorrected; }
public bool isPHPReady() { if (!File.Exists(var.strPHPTemplateConfigFilePath)) { MessageBox.Show("The PHP template file, " + var.strPHPTemplateConfigFilePath + " cannot be found"); return false; } /*if (!File.Exists(var.strPHPTSConfigFilePath)) { MessageBox.Show("The PHP configuration file, " + var.strPHPTSConfigFilePath + " cannot be found"); return false; } if (!File.Exists(var.strPHPNTSConfigFilePath)) { MessageBox.Show("The PHP configuration file, " + var.strPHPNTSConfigFilePath + " cannot be found"); return false; }*/ // Thread-safe PHP config ArrayList alReplace = new ArrayList(); alReplace.Add(new string[]{";%INCLUDE_PATH%", "include_path=\".;"+var.strPHPTSFolderPath+"\\pear\""}); alReplace.Add(new string[]{"%EXTDIR%", Path.Combine(var.strPHPTSFolderPath, "ext")}); File.WriteAllText(var.strPHPTSConfigFilePath, var.replaceText(File.ReadAllText(var.strPHPTemplateConfigFilePath),alReplace)); // Non thread-safe PHP config alReplace.Clear(); alReplace.Add(new string[]{";%INCLUDE_PATH%", "include_path=\".;"+var.strPHPNTSFolderPath+"\\pear\""}); alReplace.Add(new string[]{"%EXTDIR%", Path.Combine(var.strPHPNTSFolderPath, "ext")}); File.WriteAllText(var.strPHPNTSConfigFilePath, var.replaceText(File.ReadAllText(var.strPHPTemplateConfigFilePath),alReplace)); Environment.SetEnvironmentVariable("PHP_FCGI_MAX_REQUESTS",var.getString("PHP","numPHPRequests")); return true; }
public void filterExceptions(int filterLength) { ArrayList cleanedWhiteList = new ArrayList(); for (int i = 0; i < WhiteList.Count; i++) { bool contained = false; String exception = WhiteList[i].ToString(); if (exception.Length > filterLength) { exception = exception.Substring(0, filterLength); } for (int x = 0; x < cleanedWhiteList.Count; x++) { if (cleanedWhiteList[x].ToString().StartsWith(exception)) { contained = true; } } if (!contained) { cleanedWhiteList.Add(WhiteList[i]); } } WhiteList = (ArrayList)cleanedWhiteList.Clone(); cleanedWhiteList.Clear(); cleanedWhiteList = null; }
/// <summary> /// Creates a list of all intersections between the vertical line-scan and polygon's borders /// </summary> /// <param name="bordi2">The list of polygon borders</param> /// <param name="intersezioni">The list of intersections</param> /// <param name="xls">The line-scan x-value</param> private bool Interseca(System.Collections.ArrayList bordi2, System.Collections.ArrayList intersezioni, double xls) { bool result = false; int l, nlati, c; double x1, x2, m, q; nlati = bordi2.Count; intersezioni.Clear(); c = -1; for (l = 0; l < nlati; ++l) { x1 = ((bord)bordi2[l]).x1; x2 = ((bord)bordi2[l]).x2; if (((xls >= x1) && (xls < x2)) || ((xls >= x2) && (xls < x1))) { c = c + 1; m = ((bord)bordi2[l]).m; q = ((bord)bordi2[l]).q; //calculate Y intersection intersezioni.Add(m * xls + q); } } result = true; return(result); }
private void btnInhoadon_Click(object sender, EventArgs e) { ArrayList listdv = new ArrayList(); ArrayList listp = new ArrayList(); listdv.Clear(); listp.Clear(); if (flagtinhtien == true) { listdv = new ArrayList(inhddvBUS.inhoadondv(labMaHD.Text)); listp = new ArrayList(inhdpBUS.InHoaDonPhong(labMaHD.Text)); qlks3lopDataSet.InhoadonDichVuDataTable dtdv = new qlks3lopDataSet.InhoadonDichVuDataTable(); qlks3lopDataSet.InhoadonPhongDataTable dtp = new qlks3lopDataSet.InhoadonPhongDataTable(); foreach (InHoaDonDichVuDTO hddv in listdv) { dtdv.Rows.Add(hddv.Maphieuthue, hddv.Tendichvu, hddv.Gia, hddv.Donvitinh, hddv.Soluong, hddv.MaPhong, hddv.Mahoadon, hddv.Ngay); } foreach (InHoaDonPhongDTO hdp in listp) { dtp.Rows.Add(hdp.Mahoadon, hdp.Tenkhachhang, hdp.Songayo, hdp.CMND, hdp.Diachi, hdp.Coquan, hdp.Sodienthoai, hdp.Email, hdp.Ngayden, hdp.Ngaydi, hdp.Sotiendatcoc, hdp.Gia, hdp.Maphong, hdp.Tennhanvien, hdp.Tongtien); } InHoaDon frmInHoaDon = new InHoaDon(); frmInHoaDon.dtdv = dtdv; frmInHoaDon.dtp = dtp; frmInHoaDon.ShowDialog(); //show_MaPT(); } else MessageBox.Show("Thanh toán trước khi in hóa đơn"); }
public static void ReadSettings( out bool enabled , out bool toast , ArrayList processActions ) { PriorityManagerSettings p; try { XmlSerializer deSerialiser = new XmlSerializer( typeof(PriorityManagerSettings) ); IsolatedStorageFileStream fileStream = new IsolatedStorageFileStream( SettingsFileName , FileMode.Open , FileAccess.Read , FileShare.None ); System.IO.StreamReader reader = new System.IO.StreamReader( fileStream ); p = (PriorityManagerSettings)deSerialiser.Deserialize( reader ); enabled = p.Enabled ; toast = p.ToastEnabled; lock ( processActions.SyncRoot ) { processActions.Clear(); processActions.AddRange( p.ProcessActions ); } reader.Close(); } catch { // hard coded defaults... toast = true; enabled = true; processActions = new ArrayList(); } }
public void CastFunc() { IList args = new ArrayList(); CastFunction cf = new CastFunction(); try { SqlString t = cf.Render(args, factoryImpl); Assert.Fail("No exception if no argument"); } catch (QueryException) { //correct } args.Add("'123'"); args.Add("long"); string expected = string.Format("cast({0} as {1})", args[0], factoryImpl.Dialect.GetCastTypeName(SqlTypeFactory.Int64)); Assert.AreEqual(expected, cf.Render(args, factoryImpl).ToString()); args.Clear(); args.Add("'123'"); args.Add("NO_TYPE"); try { SqlString t = cf.Render(args, factoryImpl); Assert.Fail("Ivalid type accepted"); } catch (QueryException) { //correct } }
private void 添加分类ToolStripMenuItem_Click(object sender, EventArgs e) { AddClassFrm addclass = new AddClassFrm(); if (addclass.ShowDialog() == DialogResult.OK) { string classStr = addclass.textBox1.Text.ToUpper().ToString(); ArrayList selectedlist = new ArrayList(); foreach (DataGridViewRow dr in this.dataGridView1.Rows) { if (dr.Selected == true) { selectedlist.Add(dr.Index); } } for (int i = 0; i < selectedlist.Count; i++) { int index = int.Parse(selectedlist[i].ToString()); string projectidStr = this.dataGridView1.Rows[index].Cells["项目号"].Value.ToString(); string drawingStr = this.dataGridView1.Rows[index].Cells["图纸号"].Value.ToString(); string spoolStr = this.dataGridView1.Rows[index].Cells["小票号"].Value.ToString(); WorkShopStatusFlow.AddTrayORClass("SP_ADDCLASSIFICATION", projectidStr, drawingStr, spoolStr, classStr); this.dataGridView1.Rows[index].Cells["分类"].Value = classStr; } selectedlist.Clear(); MessageBox.Show("--------完成--------"); } }
public void TradeTableDisplayer(DataGridView tradegrid) { var provider = tradegrid.DataSource as DataTable; var trValues = new ArrayList(); foreach (Position position in Trades) { trValues.Add(position.Account); trValues.Add(position.Symbol); trValues.Add(position.OpenOrderId); trValues.Add(position.CloseOrderId); trValues.Add(position.TimeOpen); trValues.Add(position.TimeClose); trValues.Add(position.Operation); trValues.Add(position.Size); trValues.Add(position.Price); trValues.Add(position.Last); trValues.Add(Math.Round(position.Trades, 2)); trValues.Add(position.Margin); trValues.Add(position.Comment); trValues.Add(position.AddInfo); trValues.Add(MinDt.ToString("dd/MM/yyyy")); trValues.Add(MaxDt.ToString("dd/MM/yyyy")); if (provider != null) provider.Rows.Add(trValues.ToArray()); trValues.Clear(); } tradegrid.DataSource = provider; }
public Query(Query another) { formula = new ArrayList(); Oid refOid = null; try { if (another.Oid != null) { refOid = (Oid)another.Oid.Clone(); } if (another.Formula != null) { QueryFormula[] items = (QueryFormula[])another.Formula.Clone(); formula.Clear(); foreach (QueryFormula item in items) { formula.Add(new QueryFormula(item)); } } } catch (Exception e) { e.ToString(); } oid = refOid; }
public Assert(Assert another) { Oid refOid = null; formula = new ArrayList(); try { if (another.Oid != null) { refOid = (Oid)another.Oid.Clone(); } if (another.Formula != null) { AssertFormula[] items = (AssertFormula[])another.Formula.Clone(); formula.Clear(); foreach (AssertFormula item in items) { formula.Add(new AssertFormula(item)); } } } catch (Exception e) { e.ToString(); } oid = refOid; }
public override string BuildNumber(int Num) //id = 21 { System.Random rd = new Random(); StringBuilder sb = new StringBuilder(); ArrayList al = new ArrayList(); for (int i = 0; i < Num; i++) { al.Clear(); for (int j = 0; j < 5; j++) { int Ball = 0; while ((Ball == 0) || isExistBall(al, Ball)) Ball = rd.Next(1, 15 + 1); al.Add(Ball.ToString().PadLeft(2, '0')); } CompareToAscii compare = new CompareToAscii(); al.Sort(compare); string LotteryNumber = ""; for (int j = 0; j < al.Count; j++) LotteryNumber += al[j].ToString() + " "; sb.Append(LotteryNumber.Trim() + "\n"); } string Result = sb.ToString(); Result = Result.Substring(0, Result.Length - 1); return Result; }
public Equivalent(Equivalent another) { torso = new ArrayList(); Oid refOid = null; torso = new ArrayList(); try { if (another.Oid != null) { refOid = (Oid)another.Oid.Clone(); } if (another.Torso != null) { Torso[] items = (Torso[])another.Torso.Clone(); torso.Clear(); foreach (Torso item in items) { torso.Add(new Torso(item)); } } } catch (Exception e) { e.ToString(); } oid = refOid; }
/// <summary> /// Copy property value of object stored in source into destination array. /// </summary> /// <param name="source">List of object which property must be read</param> /// <param name="array">Destination array</param> /// <param name="property">Source Object Property Name</param> /// <param name="startIndx">Start index of source object</param> public static void CopyTo( IList source, Array array, string property, int index ) { ArrayList list = new ArrayList( source.Count ); PropertyInfo keyProp = null; int iCount = 0; foreach( object obj in source ) { if( keyProp == null ) { keyProp = obj.GetType().GetProperty( property ); if( keyProp == null ) throw new ArgumentException( "Property Name of object is wrong", "property" ); } if( iCount >= index ) { list.Add( keyProp.GetValue( obj, null ) ); } iCount++; } list.CopyTo( array ); list.Clear(); }
/// 获取一个Section中的所有行 /** * @param[out] lines 保存Section中的所有行的数据, 元素类型为string. */ public void GetSection(string section, ArrayList lines) { const int MAX_SIZE = 32767; byte[] buffer = new byte[MAX_SIZE]; int bufLen = 0; lines.Clear(); bufLen = GetPrivateProfileSection(section, buffer, MAX_SIZE, m_filePath); if (bufLen > 0) { byte[] line = new byte[MAX_SIZE]; int nPos = 0; for (int i = 0; i < bufLen; i++) { if (buffer[i] != 0) { line[nPos++] = buffer[i]; } else { if (nPos > 0) { lines.Add(Encoding.GetEncoding("GB2312").GetString(line, 0, nPos)); line = new byte[MAX_SIZE]; nPos = 0; } } } } }
public DataSet getDatasetPRO(string storeName, System.Collections.ArrayList parameterCollection) { SqlConnection sqlConnection1 = new SqlConnection(connStr); SqlCommand cmd = new SqlCommand(); cmd.CommandText = storeName; cmd.CommandType = CommandType.StoredProcedure; cmd.Connection = sqlConnection1; if (parameterCollection != null) { foreach (object oParameter in parameterCollection) { cmd.Parameters.Add(oParameter); } parameterCollection.Clear(); } sqlConnection1.Open(); SqlDataAdapter adpt = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); adpt.Fill(ds); sqlConnection1.Close(); return(ds); }
/// <summary> /// handles upaloding files /// </summary> /// <param name="list"></param> /// <returns></returns> private bool fileUploader(ArrayList list) { bool flag = true; list.Clear(); OpenFileDialog op = new OpenFileDialog(); op.Filter = "Text File (.txt) | *.txt"; DialogResult result = op.ShowDialog(); try { if (result == DialogResult.OK) { using (System.IO.FileStream fs = new System.IO.FileStream(op.FileName, System.IO.FileMode.Open, System.IO.FileAccess.Read)) using (System.IO.StreamReader reader = new System.IO.StreamReader(fs)) { while (!reader.EndOfStream) { list.Add(reader.ReadLine().ToString().Trim()); } } MessageBox.Show("File was successfully uploaded!", "Pre-set Queries", MessageBoxButtons.OK); } else flag = false; } catch (Exception) { MessageBox.Show("Was not able to open the file!", "Pre-set Queries", MessageBoxButtons.OK); } return flag; }
public bool GetStockQtyByLocateSec(string Item, string Period, string LocateSec, out int OnHd_Qty) { try { ArrayList ParameterList = new ArrayList(); ParameterList.Clear(); DBOINV.MaintainStockStatement dboINV = new DBOINV.MaintainStockStatement(strConn); DBOINV.SQLHelper.SQLWhere(ref ParameterList, DbType.String, "LOCATE_SECTION", LocateSec, "=", "and"); DBOINV.SQLHelper.SQLWhere(ref ParameterList, DbType.String, "ITEM", Item, "=", "and"); DBOINV.SQLHelper.SQLWhere(ref ParameterList, DbType.String, "PERIOD", Period, "=", "and"); DataTable dtResult = dboINV.QueryStockStatementByFind_1(ParameterList); if (dtResult.Rows.Count > 0) { OnHd_Qty = int.Parse(dtResult.Rows[0]["onhd_qty"].ToString()); if (OnHd_Qty == 0) { return false; } } else { OnHd_Qty = 0; return false; } return true; } catch (Exception ex) { throw ex; } }
public void Clear() { // TODO: Add ControlListView.Clear implementation controlList.Clear(); this.Controls.Clear(); ReCalculateItems(); }
public override string BuildNumber(int Num) { Random random = new Random(); StringBuilder builder = new StringBuilder(); ArrayList al = new ArrayList(); for (int i = 0; i < Num; i++) { al.Clear(); for (int j = 0; j < 5; j++) { int ball = 0; while ((ball == 0) || base.isExistBall(al, ball)) { ball = random.Next(1, 0x17); } al.Add(ball.ToString().PadLeft(2, '0')); } LotteryBase.CompareToAscii comparer = new LotteryBase.CompareToAscii(); al.Sort(comparer); string str = ""; for (int k = 0; k < al.Count; k++) { str = str + al[k].ToString() + " "; } builder.Append(str.Trim() + "\n"); } string str2 = builder.ToString(); return str2.Substring(0, str2.Length - 1); }
public void ArgsDiffParams() { SQLFunctionTemplate ft; IList args = new ArrayList(); // No Args; 2 params ft = new SQLFunctionTemplate(NHibernateUtil.String, "func(?1,?2)"); Assert.AreEqual("func(,)", ft.Render(args, factoryImpl).ToString()); // Args<params args.Clear(); ft = new SQLFunctionTemplate(NHibernateUtil.String, "func(?1,?2)"); args.Add(1); Assert.AreEqual("func(1,)", ft.Render(args, factoryImpl).ToString()); // Args>params args.Clear(); ft = new SQLFunctionTemplate(NHibernateUtil.String, "func(?1,?3)"); args.Add(1); args.Add(2); args.Add(3); Assert.AreEqual("func(1,3)", ft.Render(args, factoryImpl).ToString()); // Args in different position args.Clear(); ft = new SQLFunctionTemplate(NHibernateUtil.String, "func(?2, ?1, ?3)"); args.Add(1); args.Add(2); args.Add(3); Assert.AreEqual("func(2, 1, 3)", ft.Render(args, factoryImpl).ToString()); }
public static void InsertSalesGroupByID(HttpContext context) { DatabaseConnection con = new DatabaseConnection(); System.Collections.ArrayList paramMax = new System.Collections.ArrayList(); System.Collections.ArrayList param = new System.Collections.ArrayList(); byte[] bytes = context.Request.BinaryRead(context.Request.TotalBytes); string jsonString = Encoding.UTF8.GetString(bytes); var oneObject = Newtonsoft.Json.JsonConvert.DeserializeObject <int[]>(jsonString); DataTable dtMaxInvoice = con.ExecSpSelect("SalesSelectMaxInvoice", paramMax); int iMaxInvoice = int.Parse(dtMaxInvoice.Rows[0]["InvoiceNumber"].ToString()) + 1; if (oneObject.Count() > 0) { foreach (var item in oneObject) { param.Clear(); param.Add(new SqlParameter("@SaleID", item)); param.Add(new SqlParameter("@InvoiceNumber", iMaxInvoice)); con.ExecSpNone("SalesGroupInsert", param); } } string s = "{\"result\": {\"result\": \"OK\",\"details\": \"NO ERROR\"},\"InvoiceNumber\":" + iMaxInvoice + "}"; context.Response.BinaryWrite(Encoding.UTF8.GetBytes(s)); }
private void getTessellation() { try { primList.Clear(); primTypes.Clear(); System.Collections.ArrayList pointList = new ArrayList(); for (int i = 0; i < m_outerRing.Points.Length; i++) { double[] p = new double[3]; p[0] = m_outerRing.Points[i].X; p[1] = m_outerRing.Points[i].Y; p[2] = m_outerRing.Points[i].Z; pointList.Add(p); } Glu.GLUtesselator tess = Glu.gluNewTess(); Glu.gluTessCallback(tess, Glu.GLU_TESS_BEGIN, new Glu.TessBeginCallback(b)); Glu.gluTessCallback(tess, Glu.GLU_TESS_END, new Glu.TessEndCallback(e)); Glu.gluTessCallback(tess, Glu.GLU_TESS_ERROR, new Glu.TessErrorCallback(r)); Glu.gluTessCallback(tess, Glu.GLU_TESS_VERTEX, new Glu.TessVertexCallback(f)); Glu.gluTessBeginPolygon(tess, IntPtr.Zero); Glu.gluTessBeginContour(tess); for (int i = 0; i < pointList.Count - 1; i++) { double[] p = (double[])pointList[i]; Glu.gluTessVertex(tess, p, p); } Glu.gluTessEndContour(tess); if (m_innerRings != null && m_innerRings.Length > 0) { for (int i = 0; i < m_innerRings.Length; i++) { Glu.gluTessBeginContour(tess); for (int j = m_innerRings[i].Points.Length - 1; j >= 0; j--) { double[] p = new double[3]; p[0] = m_innerRings[i].Points[j].X; p[1] = m_innerRings[i].Points[j].Y; p[2] = m_innerRings[i].Points[j].Z; Glu.gluTessVertex(tess, p, p); } Glu.gluTessEndContour(tess); } } Glu.gluTessEndPolygon(tess); } catch (Exception ex) { Log.Write(ex); } }
//重置,每次新生成一个json对象时必须执行该方法 public void Reset() { _success = true; _error = string.Empty; singleInfo = string.Empty; arrData.Clear(); arrDataItem.Clear(); }
public void LoadMacros(string sourceDir, string version, string build) { Macros.Clear(); AddMacro("%BUILD_NUMBER%", build); AddMacro("%PATH_SOURCE%", sourceDir); AddMacro("%HMAILSERVER_VERSION%", version); AddMacro("%PROGRAM_FILES%", BuildLoader.ProgramFilesx86()); }
private void Clear_Click(object sender, System.EventArgs e) { m_chro = null; this.Refresh(); Points.Clear(); //新加的部分 points.Clear(); temps.Clear(); }
protected override void CustomizeCommand(System.Data.IDbCommand cmd) { foreach (OracleParameter param in arParams) { (cmd as OracleCommand).Parameters.Add(param); } arParams.Clear(); base.CustomizeCommand(cmd); }
//重置,每次新生成一个json对象时必须执行该方法 public void Reset() { _success = true; _error = string.Empty; singleInfo = string.Empty; arrMatch.Clear(); arrMatchItem.Clear(); arrClass.Clear(); arrClassItem.Clear(); }
public void Clear() { lock (this) { EventType.Clear(); BytesToRead.Clear(); NumEventsHandled = 0; } }
public void Dispose() { img = null; name = null; if (tags != null) { tags.Clear(); } tags = null; fii = null; }
static public int Clear(IntPtr l) { try { System.Collections.ArrayList self = (System.Collections.ArrayList)checkSelf(l); self.Clear(); pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
//Load the page, pull the products from the database and populate the table. protected void Page_Load(object sender, EventArgs e) { SqlDataAdapter sqlDataAdapter = null; DataSet ds = new DataSet(); SqlConnection connectFill = new SqlConnection(dbConnect); SqlConnection connectCmd = null; SqlCommand cmd = null; SqlCommand scmd = null; string sqlString = ""; //Get all the files from the data folder //Getting the number of products in the product table int ProductCount = 0; sqlString = "SELECT * FROM Products"; scmd = new SqlCommand(sqlString, connectFill); sqlDataAdapter = new SqlDataAdapter(); sqlDataAdapter.SelectCommand = scmd; sqlDataAdapter.Fill(ds, "Products"); //Converting to an int ProductCount = Convert.ToInt32(ds.Tables["Products"].Rows.Count); int k = 0; int b = 0; //populate the table foreach (DataRow dr in ds.Tables["Products"].Rows) { productFiles.Clear(); b = Convert.ToInt32(ds.Tables["Products"].Rows[0][0].ToString()); productFiles.Add(dr["ID"].ToString()); productFiles.Add(dr["ManufacCode"].ToString()); productFiles.Add(dr["Description"].ToString()); productFiles.Add(dr["Picture"].ToString()); productFiles.Add(dr["QtyOnHand"].ToString()); productFiles.Add(dr["Price"].ToString()); //add the row to the table tblBooks.Rows.Add(GetProductRow(productFiles, b)); k++; } }
private ArrayList getCurrentData(string matName) { System.Collections.ArrayList data = new System.Collections.ArrayList(); data.Clear(); bool writeFallback = true; data.Add("Texture " + matName); foreach (object obj in mats) { if (obj.GetType() == typeof(aeCommon.MatBlock)) { aeCommon.MatBlock mb = (aeCommon.MatBlock)obj; if (mb.isFallBack) { if (writeFallback) { writeFallback = false; data.Add("\tFallback"); int useFallbackVal = this.useFallback ? 1 : 0; data.Add(string.Format("\t\tUseFallback {0}", useFallbackVal)); } mb.getData(ref data); } else { mb.getData(ref data); data.Add(""); } } else if (obj.GetType() == typeof(FB_GlobalOptionsPnl)) { FB_GlobalOptionsPnl fbg = (FB_GlobalOptionsPnl)obj; fbg.getData(ref data); } else if (obj.GetType() == typeof(aeCommon.MatSpecLitCubeMapTintFlags)) { aeCommon.MatSpecLitCubeMapTintFlags mslcmtf = (aeCommon.MatSpecLitCubeMapTintFlags)obj; mslcmtf.getData(ref data); } } data.Add("\tEnd"); data.Add("End"); return(data); }
internal StatusGV.TypeStatusExec ValidateSimpContWrap(GErrList gerrlist) { /* * ASSUMPTION: determines only "fully" wrapped contours */ if (this.outl == null) { //throw new ExceptionGlyph("Glyph","ValidateSimpContWrap",null); return(StatusGV.TypeStatusExec.Aborted); } ArrayList pozsContWrap = new ArrayList(); for (int pozCont = 0; pozCont < this.outl.NumCont; pozCont++) { Contour cont = this.outl.ContourByPoz(pozCont); bool isWrapped; if (!cont.IsWrapped(out isWrapped)) { //throw new ExceptionGlyph("Glyph","ValidateSimpContWrap",null); return(StatusGV.TypeStatusExec.Aborted); } if (isWrapped) { pozsContWrap.Add(pozCont); } } int numCont = pozsContWrap.Count; if (numCont != 0) { int[] indsKnotStart = new int[numCont]; for (int iCont = 0; iCont < numCont; iCont++) { int pozCont = (int)pozsContWrap[iCont]; indsKnotStart[iCont] = this.Outl.ContourByPoz(pozCont).IndKnotStart; } GErr gerr = new GErrContWrap(this.index, indsKnotStart); gerrlist.Add(gerr); //this.isOrientDefined=false; } /* * else * { * //this.isOrientDefined=true; * } */ pozsContWrap.Clear(); return(StatusGV.TypeStatusExec.Completed); }
static int Clear(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); System.Collections.ArrayList obj = (System.Collections.ArrayList)ToLua.CheckObject(L, 1, typeof(System.Collections.ArrayList)); obj.Clear(); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
private void BindTree() { GUTree.Nodes.Clear(); int iGroup = SGroupID; aGroupPath.Clear(); while (iGroup > 1) { aGroupPath.Add(iGroup); iGroup = UserReport.GetParentGroup(iGroup); } aGroupPath.Add(iGroup); ProcessGroup2(iGroup, null); }
public void CloseProject() { if (state != eState.stDisc) { rpxProject.CloseProject(); state = eState.stDisc; foreach (ReqPro40.Project rpxRelPrj in arpxRelProjects) { rpxRelPrj.CloseProject(); } arpxRelProjects.Clear(); } }
private void btn_simulate_Click(object sender, EventArgs e) { //得到起始时间和终止时间 int startdate = Convert.ToInt32(this.txt_fromdate.Value.ToString("yyyyMMdd")); int enddate = Convert.ToInt32(this.txt_todate.Value.ToString("yyyyMMdd")); //仓位股票数量 holdstocknum = (int)txt_num.Value; list.Clear(); Simulate(startdate, enddate); MessageBox.Show("Done"); this.lbl_status.Text = "Simulate Done"; }
internal StatusGV.TypeStatusExec ValidateSimpContMisor(GErrList gerrlist) { if ((this.statusGV[(int)DefsGV.TypeGV.ValidateSimpContDupl].StatusRes != StatusGV.TypeStatusRes.NoErrors) || (this.statusGV[(int)DefsGV.TypeGV.ValidateSimpContWrap].StatusRes != StatusGV.TypeStatusRes.NoErrors) || (this.statusGV[(int)DefsGV.TypeGV.ValidateSimpContInters].StatusRes != StatusGV.TypeStatusRes.NoErrors)) { return(StatusGV.TypeStatusExec.UnableToExec); } if (this.outl == null) { //throw new ExceptionGlyph("Glyph","ValidateSimpContMisor",null); return(StatusGV.TypeStatusExec.Aborted); } ArrayList pozsContMisor = new ArrayList(); for (int pozCont = 0; pozCont < this.outl.NumCont; pozCont++) { Contour cont = this.outl.ContourByPoz(pozCont); bool isMisoriented; if (!cont.IsMisoriented(this.outl, out isMisoriented)) { throw new ExceptionGlyph("Glyph", "ValidateSimpContMisor", null); //return StatusGV.TypeStatusExec.Aborted; } if (isMisoriented) { pozsContMisor.Add(pozCont); } } int numCont = pozsContMisor.Count; if (numCont != 0) { int[] indsKnotStart = new int[numCont]; for (int iCont = 0; iCont < numCont; iCont++) { int pozCont = (int)pozsContMisor[iCont]; indsKnotStart[iCont] = this.Outl.ContourByPoz(pozCont).IndKnotStart; } GErr gerr = new GErrContMisor(this.index, indsKnotStart); gerrlist.Add(gerr); } pozsContMisor.Clear(); return(StatusGV.TypeStatusExec.Completed); }
private void Load(System.IO.Stream stream, bool metadata_only) { marker_list.Clear(); image_data = null; bool at_image = false; Marker marker = Marker.Load(stream); if (marker == null || marker.Type != JpegMarker.Soi) { throw new System.Exception("This doesn't appear to be a jpeg stream"); } this.Markers.Add(marker); while (!at_image) { marker = Marker.Load(stream); if (marker == null) { break; } // System.Console.WriteLine ("loaded marker {0} length {1}", marker.Type, marker.Data.Length); this.Markers.Add(marker); if (marker.Type == JpegMarker.Sos) { at_image = true; if (metadata_only) { // System.Console.WriteLine ("read = {0}", stream.Position); return; } } } long image_data_length = stream.Length - stream.Position; this.image_data = new byte [image_data_length]; if (stream.Read(image_data, 0, (int)image_data_length) != image_data_length) { throw new System.Exception("truncated image data or something"); } }
private ArrayList getCurrentData(string oTrickName) { System.Collections.ArrayList data = new System.Collections.ArrayList(); data.Clear(); data.Add("Texture " + oTrickName); TextureTrickPanel ttPnl = (TextureTrickPanel)this.textureTrickPropertiesPanel.Controls[0]; ttPnl.getData(ref data); data.Add("End"); return(data); }
public static void SelectSalesMappingAccountPaymentMethod(HttpContext context) { DatabaseConnection con = new DatabaseConnection(); System.Collections.ArrayList param = new System.Collections.ArrayList(); byte[] bytes = context.Request.BinaryRead(context.Request.TotalBytes); string jsonString = Encoding.UTF8.GetString(bytes); var oneObject = Newtonsoft.Json.JsonConvert.DeserializeObject <SalesMappingAccountPaymentMethod>(jsonString); param.Clear(); param.Add(new System.Data.SqlClient.SqlParameter("@PaymentMethodID", oneObject.PaymentMethodID)); DataTable dtMappingCash = con.ExecSpSelect("SalesMappingAccountPaymentMethodSelect", param); string s = "{\"result\": {\"result\": \"OK\",\"details\": \"NO ERROR\"},\"Rows\":" + con.DataTableToJson(dtMappingCash) + "}"; context.Response.BinaryWrite(Encoding.UTF8.GetBytes(s)); }
private ArrayList getCurrentData(string oTrickName) { System.Collections.ArrayList data = new System.Collections.ArrayList(); data.Clear(); data.Add("Trick " + oTrickName); ObjectTrickPanel otPnl = (ObjectTrickPanel)this.objTrickPropertiesPanel.Controls[0]; otPnl.getData(ref data); data.Add("End"); return(data); }