Clear() public method

public Clear ( ) : void
return void
Example #1
0
        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;
        }
        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("[email protected]");
                        message.Body = msgBody;
                        message.ReplyTo = new MailAddress("[email protected]");
                        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);
                    }
                }
        }
Example #3
0
        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;
        }
Example #4
0
 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);
 }
Example #5
0
        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;
        }
Example #6
0
        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;
        }
		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
			}
		}
Example #9
0
        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");
        }
Example #10
0
		/**
		 * 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);
							}
						}
					}
				}
			}
		}
 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;
 }
        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);
        }
Example #13
0
        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;
        }
Example #14
0
 public train(formDelegate sender, ArrayList from)
 {
     trainDelegate = sender;
     toolTip = Convert.ToBoolean(from[0]);
     from.Clear();
     InitializeComponent();
 }
Example #15
0
 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("--------完成--------");
     }
 }
Example #16
0
 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;
 }
Example #17
0
        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;
        }
        /// <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();
        }
		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 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;
        }
Example #21
0
        /// <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;
        }
Example #22
0
        /// <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;
        }
Example #23
0
        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;
        }
Example #24
0
        /// 获取一个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 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;
            }
        }
Example #26
0
        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);
        }
Example #27
0
            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;
            }
Example #28
0
        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;
        }
Example #29
0
 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("--------完成--------");
     }
 }
        /// <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;
            }            
        }