Exemplo n.º 1
0
		public virtual void  TestStopList()
		{
			System.Collections.Hashtable stopWordsSet = new System.Collections.Hashtable();
			stopWordsSet.Add("good", "good");
			stopWordsSet.Add("test", "test");
			stopWordsSet.Add("analyzer", "analyzer");

            // {{Aroush  how can we copy 'stopWordsSet' to 'System.String[]'?
            System.String[] arrStopWordsSet = new System.String[3];
            arrStopWordsSet[0] = "good";
            arrStopWordsSet[1] = "test";
            arrStopWordsSet[2] = "analyzer";
            // Aroush}}

			StopAnalyzer newStop = new StopAnalyzer(arrStopWordsSet);
			System.IO.StringReader reader = new System.IO.StringReader("This is a good test of the english stop analyzer");
			TokenStream stream = newStop.TokenStream("test", reader);
			Assert.IsTrue(stream != null);
			Token token = null;
			try
			{
				while ((token = stream.Next()) != null)
				{
					System.String text = token.TermText();
					Assert.IsTrue(stopWordsSet.Contains(text) == false);
				}
			}
			catch (System.IO.IOException e)
			{
				Assert.IsTrue(false);
			}
		}
Exemplo n.º 2
0
		public static void RunExample(String[] arg)
		{
			try
			{
				//Create a new JSch instance
				JSch jsch=new JSch();
			
				//Prompt for username and server host
				Console.WriteLine("Please enter the user and host info at the popup window...");
				String host = InputForm.GetUserInput
					("Enter username@hostname",
					Environment.UserName+"@localhost");
				String user=host.Substring(0, host.IndexOf('@'));
				host=host.Substring(host.IndexOf('@')+1);

				//Create a new SSH session
				Session session=jsch.getSession(user, host, 22);

				// username and password will be given via UserInfo interface.
				UserInfo ui=new MyUserInfo();
				session.setUserInfo(ui);

				//Add AES128 as default cipher in the session config store
				System.Collections.Hashtable config=new System.Collections.Hashtable();
				config.Add("cipher.s2c", "aes128-cbc,3des-cbc");
				config.Add("cipher.c2s", "aes128-cbc,3des-cbc");
				session.setConfig(config);

				//Connect to remote SSH server
				session.connect();			

				//Open a new Shell channel on the SSH session
				Channel channel=session.openChannel("shell");

				//Redirect standard I/O to the SSH channel
				channel.setInputStream(Console.OpenStandardInput());
				channel.setOutputStream(Console.OpenStandardOutput());

				//Connect the channel
				channel.connect();

				Console.WriteLine("-- Shell channel is connected using the {0} cipher", 
					session.getCipher());

				//Wait till channel is closed
				while(!channel.isClosed())
				{
					System.Threading.Thread.Sleep(500);
				}

				//Disconnect from remote server
				channel.disconnect();
				session.disconnect();			

			}
			catch(Exception e)
			{
				Console.WriteLine(e.Message);
			}
		}
        protected void btnSearch_click(object sender, EventArgs e)
        {
            string strLeaseType = string.Empty;
            if (rbdBuy.Checked)
            {
                strLeaseType = "S";
            }
            else
            {
                strLeaseType = "R";
            }

            if (Session["SearchParams"] != null)
                Session.Remove("SearchParams");
            System.Collections.Hashtable objSearchParams = new System.Collections.Hashtable();
            objSearchParams.Add("Property", (ddlPropertType.SelectedValue.ToString()).Contains("-1") ? "-1" : ddlPropertType.SelectedValue.ToString());
            objSearchParams.Add("Location", ddlLocation.SelectedValue.ToString());
            objSearchParams.Add("City", ddlCity.SelectedValue.ToString());
            objSearchParams.Add("Bedroom", txtBedroooms.Text);
            objSearchParams.Add("LeaseType", strLeaseType.ToString());
            objSearchParams.Add("Budget", txtBudgetfrom.Text);
            //objSearchParams.Add("BudgetTo", txtBudgetTo.Text);
            objSearchParams.Add("Individual", (chkIndividual.Checked ? "I" : string.Empty));
            objSearchParams.Add("Dealers", (chkDealers.Checked ? "D" : string.Empty));
            objSearchParams.Add("Builders", (chkBuilders.Checked ? "B" : string.Empty));
            objSearchParams.Add("User", "0");
            SiteHelper.SearchParams = objSearchParams;
            CurrentSession.SearchType = "SReq";
            Response.Redirect("/SearchResults.aspx?Search=Req");
        }
Exemplo n.º 4
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(Model.Regional model)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("insert into regional(");
            strSql.Append("RegionalID,RegionalName,RegionalCode,SubRegionalID,RegionalLevel,Orders,LastModifyTime,IsValid,Memo)");
            strSql.Append(" values (");
            strSql.Append("@RegionalID,@RegionalName,@RegionalCode,@SubRegionalID,@RegionalLevel,@Orders,@LastModifyTime,@IsValid,@Memo)");
            MySqlParameter[] parameters = {
                    new MySqlParameter("@RegionalID", MySqlDbType.VarChar,50),
                    new MySqlParameter("@RegionalName", MySqlDbType.VarChar,50),
                    new MySqlParameter("@RegionalCode", MySqlDbType.VarChar,50),
                    new MySqlParameter("@SubRegionalID", MySqlDbType.VarChar,50),
                    new MySqlParameter("@RegionalLevel", MySqlDbType.VarChar,50),
                    new MySqlParameter("@LastModifyTime", MySqlDbType.DateTime),
                    new MySqlParameter("@IsValid", MySqlDbType.Bit),
                    new MySqlParameter("@Memo", MySqlDbType.VarChar,50),
                    new MySqlParameter("@Orders", MySqlDbType.Int32)};
            parameters[0].Value = model.RegionalID;
            parameters[1].Value = model.RegionalName;
            parameters[2].Value = model.RegionalCode;
            parameters[3].Value = model.SubRegionalID;
            parameters[4].Value = model.RegionalLevel;
            parameters[5].Value = model.LastModifyTime;
            parameters[6].Value = model.IsValid;
            parameters[7].Value = model.Memo;
            parameters[8].Value = model.Orders;

            StringBuilder strSql1 = new StringBuilder();
            strSql1.Append("insert into T_SYSCODEDETIAL(");
            strSql1.Append("SYSCodeID,SYSCodeDetialID,SYSCodeDetialContext,LastModifyTime,IsValid,Memo)");
            strSql1.Append(" values (");
            strSql1.Append("@SYSCodeID,@SYSCodeDetialID,@SYSCodeDetialContext,@LastModifyTime,@IsValid,@Memo)");
            MySqlParameter[] parameters1 = {
                    new MySqlParameter("@SYSCodeID", MySqlDbType.VarChar,50),
                    new MySqlParameter("@SYSCodeDetialID", MySqlDbType.VarChar,50),
                    new MySqlParameter("@SYSCodeDetialContext", MySqlDbType.VarChar,50),
                    new MySqlParameter("@LastModifyTime", MySqlDbType.DateTime),
                    new MySqlParameter("@IsValid", MySqlDbType.Bit,1),
                    new MySqlParameter("@Memo", MySqlDbType.VarChar,50)};
            parameters1[0].Value = "Region";
            parameters1[1].Value = model.RegionalID;
            parameters1[2].Value = model.RegionalName;
            parameters1[3].Value = DateTime.Now;
            parameters1[4].Value = model.IsValid;
            parameters1[5].Value = model.Memo;

            System.Collections.Hashtable sqlStringList = new System.Collections.Hashtable();
            sqlStringList.Add(strSql, parameters);
            sqlStringList.Add(strSql1, parameters1);

            try
            {
                DbHelperMySQL.ExecuteSqlTran(sqlStringList);
                return true;
            }
            catch
            {
                return false;
            }
        }
Exemplo n.º 5
0
 public EngineWrapperTest()
 {
     //testDataPath = @"..\..\..\TestData\";
     arguments = new System.Collections.Hashtable();
     inputFilename = "EngineWrapperTestHydroNetInputFile.xml";
     arguments.Add("InputFilename", inputFilename);
     arguments.Add("TimestepLength", "2"); //2 seconds
 }
Exemplo n.º 6
0
 protected void btnSearch_Click(object sender, EventArgs e)
 {
     //dgAgent.Visible = true;
     if (Session["SearchParams"] != null)
         Session.Remove("SearchParams");
     System.Collections.Hashtable objSearchParams = new System.Collections.Hashtable();
     objSearchParams.Add("CityID", Convert.ToByte(ddlCity.SelectedValue));
     objSearchParams.Add("Location", Convert.ToByte(ddlLocation.SelectedValue));
     SiteHelper.SearchParams = objSearchParams;
     CurrentSession.SearchType = "SAg";
     Response.Redirect("/SearchResults.aspx");
 }
Exemplo n.º 7
0
 //
 // GET: /Login/
 /**
  * Upon login returns json string:
  *
  * {type:0} - non valid login parameters
  * {type:1} - admin logged in
  * {type:2} - comercial I logged in
  * {type:3} - cliente logged in
  */
 public System.Collections.Hashtable Get(string username, string password)
 {
     if (FirstREST.Lib_Primavera.PriEngine.InitializeCompany("BELAFLOR", username, password))
     {
         StdBSAdministrador list = FirstREST.Lib_Primavera.PriEngine.Platform.Administrador;
         StdBSUtilizador user = FirstREST.Lib_Primavera.PriEngine.Platform.Contexto.Utilizador;
         String s; // = Microsoft.VisualBasic.Information.TypeName(user.get_objUtilizador());
         System.Collections.Hashtable table = new System.Collections.Hashtable();
         dynamic d = user.get_objUtilizador();
         s = d.PerfilSugerido();
         switch (s) {
             case "Comercial I":
                 //sales manager detected
                 table.Add("type", "2");
                 return table;
             case "":
                 //admin detected
                 table.Add("type","1");
                 return table;
             case "Guest":
                 //client detected
                table.Add("type","3");
                 return table;
             default:
                 //no identifiable profile
                 table.Add("type","0");
                 return table;
         }
     }
     else
     {
         //Attempt to verify DB for clients orders with this id on
         //first log as guest (the guest password is still required)
         System.Collections.Hashtable table = new System.Collections.Hashtable();
         if (FirstREST.Lib_Primavera.PriEngine.InitializeCompany("BELAFLOR", "guest", password))
         {
             String query = "SELECT * FROM PRIBELAFLOR.dbo.CabecDoc where entidade='" + username + "'";
             StdBELista objList = FirstREST.Lib_Primavera.PriEngine.Engine.Consulta(query);
             //if query returns non empty table then it is a client id
             if (!objList.Vazia())
             {
                 query = "SELECT NOME FROM [PRIBELAFLOR].[dbo].[Clientes] WHERE cliente="+username;
                 string name = FirstREST.Lib_Primavera.PriEngine.Engine.Consulta(query).Valor("Nome");
                 table.Add("type", "3");
                 table.Add("name", name);
                 return table;
             }
         }
         table.Add("type", "0");
         return table;
     }
 }
Exemplo n.º 8
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(SmartLaw.Model.SysUser model)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("insert into SysUser(");
            strSql.Append("UserID,Password,EmployeeID,UserName,IsValid)");
            strSql.Append(" values (");
            strSql.Append("@UserID,@Password,@EmployeeID,@UserName,@IsValid)");
            MySqlParameter[] parameters = {
                    new MySqlParameter("@UserID", MySqlDbType.VarChar,50),
                    new MySqlParameter("@Password", MySqlDbType.VarChar,50),
                    new MySqlParameter("@EmployeeID", MySqlDbType.VarChar,50),
                    new MySqlParameter("@UserName", MySqlDbType.VarChar,50),
                    new MySqlParameter("@IsValid", MySqlDbType.Bit,1)};
            parameters[0].Value = model.UserID;
            parameters[1].Value = model.Password;
            parameters[2].Value = model.EmployeeID;
            parameters[3].Value = model.UserName;
            parameters[4].Value = model.IsValid;

            StringBuilder strSql1 = new StringBuilder();
            strSql1.Append("insert into T_SYSCODEDETIAL(");
            strSql1.Append("SYSCodeID,SYSCodeDetialID,SYSCodeDetialContext,LastModifyTime,IsValid,Memo)");
            strSql1.Append(" values (");
            strSql1.Append("@SYSCodeID,@SYSCodeDetialID,@SYSCodeDetialContext,@LastModifyTime,@IsValid,@Memo)");
            MySqlParameter[] parameters1 = {
                    new MySqlParameter("@SYSCodeID", MySqlDbType.VarChar,50),
                    new MySqlParameter("@SYSCodeDetialID", MySqlDbType.VarChar,50),
                    new MySqlParameter("@SYSCodeDetialContext", MySqlDbType.VarChar,50),
                    new MySqlParameter("@LastModifyTime", MySqlDbType.DateTime),
                    new MySqlParameter("@IsValid", MySqlDbType.Bit,1),
                    new MySqlParameter("@Memo", MySqlDbType.VarChar,50)};
            parameters1[0].Value = "SysUser";
            parameters1[1].Value = model.UserID;
            parameters1[2].Value = model.UserName;
            parameters1[3].Value = DateTime.Now;
            parameters1[4].Value = model.IsValid;
            parameters1[5].Value = "操作员";

            System.Collections.Hashtable sqlStringList=new System.Collections.Hashtable();
            sqlStringList.Add(strSql,parameters);
            sqlStringList.Add(strSql1,parameters1);

            try
            {
                DbHelperMySQL.ExecuteSqlTran(sqlStringList);
                return true;
            }
            catch
            {
                return false;
            }
        }
Exemplo n.º 9
0
        public static string PerformWhois(string WhoisServerHost, int WhoisServerPort, string Host)
        {
            string result="";
            try {
                String strDomain = Host;
                char[] chSplit = {'.'};
                string[] arrDomain = strDomain.Split(chSplit);
                // There may only be exactly one domain name and one suffix
                if (arrDomain.Length != 2) {
                    return "";
                }

                // The suffix may only be 2 or 3 characters long
                int nLength = arrDomain[1].Length;
                if (nLength != 2 && nLength != 3) {
                    return "";
                }

                System.Collections.Hashtable table = new System.Collections.Hashtable();
                table.Add("de", "whois.denic.de");
                table.Add("be", "whois.dns.be");
                table.Add("gov", "whois.nic.gov");
                table.Add("mil", "whois.nic.mil");

                String strServer = WhoisServerHost;
                if (table.ContainsKey(arrDomain[1])) {
                    strServer = table[arrDomain[1]].ToString();
                }
                else if (nLength == 2) {
                    // 2-letter TLD's always default to RIPE in Europe
                    strServer = "whois.ripe.net";
                }

                System.Net.Sockets.TcpClient tcpc = new System.Net.Sockets.TcpClient ();
                tcpc.Connect(strServer, WhoisServerPort);
                String strDomain1 = Host+"\r\n";
                Byte[] arrDomain1 = System.Text.Encoding.ASCII.GetBytes(strDomain1.ToCharArray());
                System.IO.Stream s = tcpc.GetStream();
                s.Write(arrDomain1, 0, strDomain1.Length);
                System.IO.StreamReader sr = new System.IO.StreamReader(tcpc.GetStream(), System.Text.Encoding.ASCII);
                System.Text.StringBuilder strBuilder = new System.Text.StringBuilder();
                string strLine = null;
                while (null != (strLine = sr.ReadLine())) {
                    strBuilder.Append(strLine+"\r\n");
                }
                result = strBuilder.ToString();
                tcpc.Close();
            }catch(Exception exc) {
                result="Could not connect to WHOIS server!\r\n"+exc.ToString();
            }
            return result;
        }
Exemplo n.º 10
0
        public static void Init()
        {
            config=new System.Collections.Hashtable();

            //  config.Add("kex", "diffie-hellman-group-exchange-sha1");
            config.Add("kex", "diffie-hellman-group1-sha1,diffie-hellman-group-exchange-sha1");
            config.Add("server_host_key", "ssh-rsa,ssh-dss");
            //config.Add("server_host_key", "ssh-dss,ssh-rsa");

            //			config.Add("cipher.s2c", "3des-cbc,blowfish-cbc");
            //			config.Add("cipher.c2s", "3des-cbc,blowfish-cbc");

            config.Add("cipher.s2c", "3des-cbc");
            config.Add("cipher.c2s", "3des-cbc");

            //			config.Add("mac.s2c", "hmac-md5,hmac-sha1,hmac-sha1-96,hmac-md5-96");
            //			config.Add("mac.c2s", "hmac-md5,hmac-sha1,hmac-sha1-96,hmac-md5-96");
            config.Add("mac.s2c", "hmac-md5");
            config.Add("mac.c2s", "hmac-md5");
            config.Add("compression.s2c", "none");
            config.Add("compression.c2s", "none");
            config.Add("lang.s2c", "");
            config.Add("lang.c2s", "");

            config.Add("diffie-hellman-group-exchange-sha1",
                "Tamir.SharpSsh.jsch.DHGEX");
            config.Add("diffie-hellman-group1-sha1",
                "Tamir.SharpSsh.jsch.DHG1");

            config.Add("dh",            "Tamir.SharpSsh.jsch.jce.DH");
            config.Add("3des-cbc",      "Tamir.SharpSsh.jsch.jce.TripleDESCBC");
            //config.Add("blowfish-cbc",  "Tamir.SharpSsh.jsch.jce.BlowfishCBC");
            config.Add("hmac-sha1",     "Tamir.SharpSsh.jsch.jce.HMACSHA1");
            config.Add("hmac-sha1-96",  "Tamir.SharpSsh.jsch.jce.HMACSHA196");
            config.Add("hmac-md5",      "Tamir.SharpSsh.jsch.jce.HMACMD5");
            config.Add("hmac-md5-96",   "Tamir.SharpSsh.jsch.jce.HMACMD596");
            config.Add("sha-1",         "Tamir.SharpSsh.jsch.jce.SHA1");
            config.Add("md5",           "Tamir.SharpSsh.jsch.jce.MD5");
            config.Add("signature.dss", "Tamir.SharpSsh.jsch.jce.SignatureDSA");
            config.Add("signature.rsa", "Tamir.SharpSsh.jsch.jce.SignatureRSA");
            config.Add("keypairgen.dsa",   "Tamir.SharpSsh.jsch.jce.KeyPairGenDSA");
            config.Add("keypairgen.rsa",   "Tamir.SharpSsh.jsch.jce.KeyPairGenRSA");
            config.Add("random",        "Tamir.SharpSsh.jsch.jce.Random");

            //config.Add("aes128-cbc",    "Tamir.SharpSsh.jsch.jce.AES128CBC");

            //config.Add("zlib",          "com.jcraft.jsch.jcraft.Compression");

            config.Add("StrictHostKeyChecking",  "ask");
        }
Exemplo n.º 11
0
        /// <summary>
        /// 添加CC_Movement对象(即:一条记录)
        /// </summary>
        public object AddWithReturn(CC_Movement cC_Movement)
        {
            string sql = "INSERT INTO CC_Movement () VALUES ();SELECT @@IDENTITY AS ReturnID;";

            int Re = 0;
            //SQL日志记录
            var RunMethod = System.Reflection.MethodBase.GetCurrentMethod();
            System.Collections.Hashtable param = new System.Collections.Hashtable();
            string Ex = string.Empty;
            foreach (System.Collections.DictionaryEntry item in idb.GetParameters())
            {
                  param.Add(item.Key, item.Value);
            }

            object obj=null;
            try
            {
                obj = idb.ReturnValue(sql);
                Ex = obj.ToString();
            }
            catch (Exception ex)
            {
                Ex = ex.Message;
            }
            finally
            {
                SysRunLog.InsertRunSql(sql, param, RunMethod.DeclaringType +"." + RunMethod.Name,Ex);
            }            return obj;
        }
Exemplo n.º 12
0
        public bool ContainsDuplicate(int[] nums)
        {
            if (nums == null || nums.Length < 2)
            {
                return false;
            }

            System.Collections.Hashtable ht = new System.Collections.Hashtable();
            bool result = false;

            for (int i = 0; i < nums.Length; i++)
            {
                if (!ht.ContainsKey(nums[i]))
                {
                    ht.Add(nums[i], i);
                }
                else
                {
                    result = true;
                    break;
                }
            }

            return result;
        }
 public void Init()
 {
     mohidWaterEngineWrapper = new MohidWaterEngineWrapper();
     System.Collections.Hashtable ht = new System.Collections.Hashtable();
     ht.Add("FilePath", @"D:\MohidProjects\Studio\20_OpenMI\Sample Estuary\exe\nomfich.dat");
     mohidWaterEngineWrapper.Initialize(ht);
 }
Exemplo n.º 14
0
        public static string GetTableAlias(string tableName)
        {
            if (__tableNames == null)
            {
                DataSet _data = new DataSet();
                _data.ReadXml(System.Configuration.ConfigurationManager.AppSettings["PathXMLAlias"]);

                __tableNames = new System.Collections.Hashtable();
                foreach (DataRow row in _data.Tables[0].Rows)
                {
                    if (!__tableNames.ContainsKey(row["name"].ToString().ToLower().Trim()))
                    {
                        __tableNames.Add(row["name"].ToString().ToLower().Trim(), row["alias"].ToString());
                    }
                }
            }


            if (__tableNames.ContainsKey(tableName))
            {
                return __tableNames[tableName].ToString();
            }

            return tableName;
        }
Exemplo n.º 15
0
        /// <summary>
        /// 添加CC_Movement对象(即:一条记录)
        /// </summary>
        public int Add(CC_Movement cC_Movement)
        {
            string sql = "INSERT INTO CC_Movement () VALUES ()";

            int Re = 0;
            //SQL日志记录
            var RunMethod = System.Reflection.MethodBase.GetCurrentMethod();
            System.Collections.Hashtable param = new System.Collections.Hashtable();
            string Ex = string.Empty;
            foreach (System.Collections.DictionaryEntry item in idb.GetParameters())
            {
                  param.Add(item.Key, item.Value);
            }

            try
            {
                Re = idb.ExeCmd(sql);
                Ex = Re.ToString();
            }
            catch (Exception ex)
            {
                Ex = ex.Message;
            }
            finally
            {
                SysRunLog.InsertRunSql(sql, param, RunMethod.DeclaringType +"." + RunMethod.Name,Ex);
             }            return Re;
        }
Exemplo n.º 16
0
		public TabbedSkin(BasilProject project, ITaskBuilder taskBuilder)
		{
			_project = project;
			_tabsToTools = new System.Collections.Hashtable();

			window = new Gtk.Window ("WeSay");
			window.SetDefaultSize (600, 400);
			window.DeleteEvent += new DeleteEventHandler (WindowDelete);

			HBox hbox = new HBox (false, 0);
			window.Add (hbox);

			Notebook notebook = new Notebook ();
			notebook.SwitchPage += new SwitchPageHandler(OnNotebookSwitchPage);
			hbox.PackStart(notebook, true, true, 0);
			foreach (ITask t in taskBuilder.Tasks)
			{
				VBox container = new VBox();
				t.Container = container;
				int i = notebook.AppendPage(container, new Label(t.Label));
				_tabsToTools.Add(i, t);
			}

			window.ShowAll ();
		}
Exemplo n.º 17
0
        protected override System.Collections.Hashtable setWEADisplay(RemoteInterface.HC.FetchDeviceData[] devNames, int maxSegId)
        {
            //serMeg.setAlarmMeg("WIS�T����ƪ���������g��!!");
            System.Collections.Hashtable outputs = new System.Collections.Hashtable();
            string meg = "";
            switch (secType)
            {
                case 45:    //�@��
                    meg = "�@���C��";
                    break;
                case 46:    //�j��
                    meg = "�j���C��";
                    break;
                case 47:    //���B
                    meg = "���B�C��";
                    break;
                default:    //��L
                    meg = "�t�C����";
                    break;
            }
            byte[] colors = new byte[4] { 32, 32, 32, 32 };

            if (devNames == null) return null;
            foreach (RemoteInterface.HC.FetchDeviceData devName in devNames)
            {
                RemoteInterface.HC.CMSOutputData output = new RemoteInterface.HC.CMSOutputData(0, 0, 0, meg, colors);
                outputs.Add(devName.DevName, output);
            }
            return outputs;
        }
Exemplo n.º 18
0
        public int MajorityElement(int[] nums)
        {
            System.Collections.Hashtable ht = new System.Collections.Hashtable();

            for (int i = 0; i < nums.Length; i++)
            {
                if (!ht.ContainsKey(nums[i]))
                {
                    ht.Add(nums[i], 1);
                }
                else
                {
                    ht[nums[i]] = (int)ht[nums[i]] + 1;
                }
            }

            foreach (System.Collections.DictionaryEntry item in ht)
            {
                if ((int)item.Value > nums.Length / 2)
                {
                    return (int)item.Key;
                }
            }

            return 0;
        }
		public override string SaveDocument(string filename, string contentType, byte[] documentContents)
		{
			#if _NO_KDMS
				return "9999999999999999";
			#else
				if (string.IsNullOrEmpty(_rootPath))
					throw new Exception("DocumentumDocumentStorage RootPath property has not been set.");
				if (!ValidDocumentType(contentType))
					throw new ArgumentException(string.Format("{0} '{1}'.", Names._EM_UnrecognizedExtension, contentType));

			    KDMS.ImportConfiguration ic = new Kindred.Knect.ITAT.Utility.KDMS.ImportConfiguration();
				ic.DocuType = Names.KDMS_DocType;
				System.Collections.Hashtable ht = new System.Collections.Hashtable();
				ht.Add(Names.KDMS_Property_DocumentName, filename);
				ic.PropertyList = Utility.WebServiceHelper.ToJaggedArray(ht);
				ic.LifeCyclePolicyName = "ITAT Scanned Document Lifecycle";
				ic.DocuFolderPath = _rootPath;
				try
				{
					KDMS.Service svc = new KDMS.Service();
					svc.Credentials = System.Net.CredentialCache.DefaultCredentials;
					svc.Url = ConfigurationManager.AppSettings[string.Format("{0}.{1}", Utility.EnvironmentHelper.GetEnvironment(EnvironmentDetectionMode.Machine), svc.GetType())];
					return svc.ImportDocumentContent(documentContents, contentType, ic);
				}
				catch (Exception e)
				{
					string error = string.Format("Error uploading file '{0}' to KDMS : {1}",filename,e.ToString());
					ILog log = LogManager.GetLogger(this.GetType());
					log.Error(error);
					throw new Exception(error, e);
				}
			#endif
		}
Exemplo n.º 20
0
        /// <summary>
        /// �]�wCMS���
        /// </summary>
        /// <param name="devNames"></param>
        /// <returns></returns>        
        protected override System.Collections.Hashtable setDisplay(RemoteInterface.HC.FetchDeviceData[] devNames, int maxSegId, MegType megType)
        {
            System.Collections.Hashtable displayht = new System.Collections.Hashtable();

            List<object> outputs = new List<object>();
            if (devNames == null || devNames.Length == 0) return displayht;

            foreach (RemoteInterface.HC.FetchDeviceData devName in devNames)
            {
                int distance = getDeviceDistance(devName.SegId, maxSegId);
                DevStartMile = devName.Mileage;
                DevLineID = devName.LineId;
                CMSDevName = devName.DevName;

                outputs = (List<object>)com.select(DBConnect.DataType.CmsCategory, Command.GetSelectCmd.getCMSCategory(Convert.ToInt32(DevRange["RULEID"]), (int)secType, devType.ToString(), distance, devName.DevName, megType.ToString(), ht["INC_LINEID"].ToString().Trim(),devName.Location,devName.LineId));
                foreach (object obj in outputs)
                {
                    List<object> output=new List<object>();
                    output.AddRange(new object[] { getPriority(), obj });
                    if (!displayht.Contains(devName.DevName))
                        displayht.Add(devName.DevName, output);
                    else if (devName.Location == "L")
                    {
                        displayht[devName.DevName] = output;
                    }
                }
            }
            return displayht;
        }
Exemplo n.º 21
0
		/// <summary> Builds a Set from an array of stop words,
		/// appropriate for passing into the StopFilter constructor.
		/// This permits this stopWords construction to be cached once when
		/// an Analyzer is constructed.
		/// </summary>
		public static System.Collections.Hashtable MakeStopSet(System.String[] stopWords)
		{
			System.Collections.Hashtable stopTable = new System.Collections.Hashtable(stopWords.Length);
			for (int i = 0; i < stopWords.Length; i++)
				stopTable.Add(stopWords[i], stopWords[i]);
			return stopTable;
		}
		/// <summary> Loads a text file and adds every line as an entry to a HashSet (omitting
		/// leading and trailing whitespace). Every line of the file should contain only 
		/// one word. The words need to be in lowercase if you make use of an
		/// Analyzer which uses LowerCaseFilter (like GermanAnalyzer).
		/// 
		/// </summary>
		/// <param name="wordfile">File containing the wordlist
		/// </param>
		/// <returns> A HashSet with the file's words
		/// </returns>
		public static System.Collections.Hashtable GetWordSet(System.IO.FileInfo wordfile)
		{
			System.Collections.Hashtable result = new System.Collections.Hashtable();
			System.IO.StreamReader freader = null;
			System.IO.StreamReader lnr = null;
			try
			{
				freader = new System.IO.StreamReader(wordfile.FullName, System.Text.Encoding.Default);
				lnr = new System.IO.StreamReader(freader.BaseStream, freader.CurrentEncoding);
				System.String word = null;
				while ((word = lnr.ReadLine()) != null)
				{
                    System.String trimedWord = word.Trim();
					result.Add(trimedWord, trimedWord);
				}
			}
			finally
			{
				if (lnr != null)
					lnr.Close();
				if (freader != null)
					freader.Close();
			}
			return result;
		}
Exemplo n.º 23
0
		public static void  CheckHits_(Query query, System.String defaultFieldName, Searcher searcher, int[] results, TestCase testCase)
		{
            Hits hits = searcher.Search(query);
			
            System.Collections.Hashtable correct = new System.Collections.Hashtable();
            for (int i = 0; i < results.Length; i++)
            {
                correct.Add((System.Int32) results[i], null);
            }
			
            System.Collections.Hashtable actual = new System.Collections.Hashtable();
            for (int i = 0; i < hits.Length(); i++)
            {
                actual.Add((System.Int32) hits.Id(i), null);
            }
			
            //Assert.AreEqual(correct, actual, query.ToString(defaultFieldName));
            if (correct.Count != 0)
            {
                System.Collections.IDictionaryEnumerator iter = correct.GetEnumerator();
                bool status = false;
                while (iter.MoveNext())
                {
                    status = actual.ContainsKey(iter.Key);
                    if (status == false)
                        break;
                }
                Assert.IsTrue(status, query.ToString(defaultFieldName));
            }
        }
Exemplo n.º 24
0
        protected override System.Collections.Hashtable setWEADisplay(RemoteInterface.HC.FetchDeviceData[] devNames, int maxSegId)
        {
            System.Collections.Hashtable outputs = new System.Collections.Hashtable();

            byte display = 1;
            switch (secType)
            {
                case 45:    //�@��
                    display = 1;
                    break;
                case 46:    //�j��
                    display = 2;
                    break;
                case 47:    //���B
                    display = 3;
                    break;
                default:    //��L
                    display = 0;
                    break;
            }

            if (devNames == null) return null;
            foreach (RemoteInterface.HC.FetchDeviceData devName in devNames)
            {
                RemoteInterface.HC.FSOutputData output = new RemoteInterface.HC.FSOutputData(display);
                outputs.Add(devName.DevName, output);
            }
            return outputs;
        }
        public void ImportarVariables(DataGridView Grid)
        {
            foreach (DataGridViewRow row in Grid.Rows)
            {
                System.Collections.Hashtable lin = new System.Collections.Hashtable();

                foreach (DataGridViewCell cell in row.Cells)
                {

                    string valor;
                    if (cell != null && cell.Value != null)
                    {
                        valor = cell.Value.ToString() ?? "";
                    }
                    else
                    {
                        valor = "";
                    }

                    lin.Add(NumToLetra(cell.ColumnIndex), valor);

                }

                ST.SetAttribute("grid", lin);
            }
        }
        public static DataTable LoadFullSummary(int locationId, int thermostatId, DateTime startDate, DateTime endDate, int timezoneDifference)
        {
            DataTable cycles = LoadSummary(thermostatId, startDate, endDate,timezoneDifference);
            DataTable weather = OutsideConditions.LoadSummary(locationId, startDate, endDate, timezoneDifference);

            DataTable result = new DataTable();
            result.Columns.Add("LogDate", typeof(DateTime));
            result.Columns.Add("OutsideMin", typeof(int));
            result.Columns.Add("OutsideMax", typeof(int));
            System.Collections.Hashtable cycleTypes = new System.Collections.Hashtable();
            foreach (DataRow row in cycles.Rows)
            {
                string cycleType = Convert.ToString(row["cycle_type"]);
                if (!cycleTypes.Contains(cycleType)) cycleTypes.Add(cycleType, cycleType);
            }
            foreach (string cycleType in cycleTypes.Keys)
            {
                result.Columns.Add(cycleType + "_CycleCount", typeof(int));
                result.Columns.Add(cycleType + "_TotalSeconds", typeof(double));
                result.Columns.Add(cycleType + "_AverageSeconds", typeof(double));
            }

            System.Collections.Hashtable dateHash = new System.Collections.Hashtable();

            foreach (DataRow row in cycles.Rows)
            {
                string cycleType = Convert.ToString(row["cycle_type"]);
                int cycleCount = Convert.ToInt32(row["cycle_count"]);
                int totalSeconds = Convert.ToInt32(row["total_seconds"]);
                double averageSeconds = Convert.ToDouble(totalSeconds) / Convert.ToDouble(cycleCount);
                DateTime logDate = Convert.ToDateTime(row["log_date"]);

                bool newDate = !dateHash.Contains(logDate);
                DataRow resultRow=null;
                if (newDate) resultRow = result.NewRow(); else resultRow = result.Rows[Convert.ToInt32(dateHash[logDate])];
                resultRow[cycleType + "_CycleCount"] = cycleCount;
                resultRow[cycleType + "_TotalSeconds"] = totalSeconds;
                resultRow[cycleType + "_AverageSeconds"] = averageSeconds;
                if (newDate)
                {
                    resultRow["LogDate"] = logDate;
                    result.Rows.Add(resultRow);
                    dateHash.Add(logDate, result.Rows.Count - 1);
                }
            }

            foreach (DataRow row in weather.Rows)
            {
                DateTime logDate = Convert.ToDateTime(row["log_date"]);
                bool newDate = !dateHash.Contains(logDate);
                if (!newDate)
                {
                    DataRow resultRow = result.Rows[Convert.ToInt32(dateHash[logDate])];
                    resultRow["OutsideMin"] = Convert.ToInt32(row["MinDegrees"]);
                    resultRow["OutsideMax"] = Convert.ToInt32(row["MaxDegrees"]);
                }
            }

            return result;
        }
Exemplo n.º 27
0
        /// <summary>
        /// 添加部门人员关系表 DeptEmployee对象(即:一条记录)
        /// </summary>
        public int Add(DeptEmployee deptEmployee)
        {
            string sql = "INSERT INTO DeptEmployee (DE_Dept_Code,DE_Empoyee_Code,DE_Type,Stat) VALUES (@DE_Dept_Code,@DE_Empoyee_Code,@DE_Type,@Stat)";
             if (string.IsNullOrEmpty(deptEmployee.DE_Dept_Code))
             {
            idb.AddParameter("@DE_Dept_Code", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@DE_Dept_Code", deptEmployee.DE_Dept_Code);
             }
             if (string.IsNullOrEmpty(deptEmployee.DE_Empoyee_Code))
             {
            idb.AddParameter("@DE_Empoyee_Code", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@DE_Empoyee_Code", deptEmployee.DE_Empoyee_Code);
             }
             if (string.IsNullOrEmpty(deptEmployee.DE_Type))
             {
            idb.AddParameter("@DE_Type", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@DE_Type", deptEmployee.DE_Type);
             }
             if (deptEmployee.Stat == 0)
             {
            idb.AddParameter("@Stat", 0);
             }
             else
             {
            idb.AddParameter("@Stat", deptEmployee.Stat);
             }

             int Re = 0;
             //SQL日志记录
             var RunMethod = System.Reflection.MethodBase.GetCurrentMethod();
             System.Collections.Hashtable param = new System.Collections.Hashtable();
             string Ex = "0";
             foreach (System.Collections.DictionaryEntry item in idb.GetParameters())
             {
                 param.Add(item.Key, item.Value);
             }
             try
             {
                 Re = idb.ExeCmd(sql);
                 Ex = Re.ToString();
             }
             catch (Exception ex)
             {
                 Ex = ex.Message;
             }

             SysRunLog.InsertRunSql(sql, param, RunMethod.DeclaringType + "." + RunMethod.Name,Ex);

             return Re;
        }
Exemplo n.º 28
0
        /// <summary>
        /// 添加备注信息 Bse_Bak对象(即:一条记录)
        /// </summary>
        public int Add(Bse_Bak bse_Bak)
        {
            string sql = "INSERT INTO Bse_Bak (Module_Code,Record_ID,Bak_Content,Stat) VALUES (@Module_Code,@Record_ID,@Bak_Content,@Stat)";
             if (string.IsNullOrEmpty(bse_Bak.Module_Code))
             {
            idb.AddParameter("@Module_Code", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Module_Code", bse_Bak.Module_Code);
             }
             if (string.IsNullOrEmpty(bse_Bak.Record_ID))
             {
            idb.AddParameter("@Record_ID", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Record_ID", bse_Bak.Record_ID);
             }
             if (string.IsNullOrEmpty(bse_Bak.Bak_Content))
             {
            idb.AddParameter("@Bak_Content", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Bak_Content", bse_Bak.Bak_Content);
             }
             if (bse_Bak.Stat == 0)
             {
            idb.AddParameter("@Stat", 0);
             }
             else
             {
            idb.AddParameter("@Stat", bse_Bak.Stat);
             }

             int Re = 0;
             //SQL日志记录
             var RunMethod = System.Reflection.MethodBase.GetCurrentMethod();
             System.Collections.Hashtable param = new System.Collections.Hashtable();
             string Ex = "0";
             foreach (System.Collections.DictionaryEntry item in idb.GetParameters())
             {
                 param.Add(item.Key, item.Value);
             }
             try
             {
                 Re = idb.ExeCmd(sql);
                 Ex = Re.ToString();
             }
             catch (Exception ex)
             {
                 Ex = ex.Message;
             }

             SysRunLog.InsertRunSql(sql, param, RunMethod.DeclaringType + "." + RunMethod.Name,Ex);

             return Re;
        }
Exemplo n.º 29
0
        /// <summary>
        /// 添加PCD_Queue对象(即:一条记录)
        /// </summary>
        public int Add(PCD_Queue pCD_Queue)
        {
            string sql = "INSERT INTO PCD_Queue (PCDO_PlanCode,PCDO_NCode,PCDO_Order,Stat) VALUES (@PCDO_PlanCode,@PCDO_NCode,@PCDO_Order,@Stat)";
             if (string.IsNullOrEmpty(pCD_Queue.PCDO_PlanCode))
             {
            idb.AddParameter("@PCDO_PlanCode", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@PCDO_PlanCode", pCD_Queue.PCDO_PlanCode);
             }
             if (string.IsNullOrEmpty(pCD_Queue.PCDO_NCode))
             {
            idb.AddParameter("@PCDO_NCode", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@PCDO_NCode", pCD_Queue.PCDO_NCode);
             }
             if (pCD_Queue.PCDO_Order == 0)
             {
            idb.AddParameter("@PCDO_Order", 0);
             }
             else
             {
            idb.AddParameter("@PCDO_Order", pCD_Queue.PCDO_Order);
             }
             if (pCD_Queue.Stat == 0)
             {
            idb.AddParameter("@Stat", 0);
             }
             else
             {
            idb.AddParameter("@Stat", pCD_Queue.Stat);
             }

             int Re = 0;
             //SQL日志记录
             var RunMethod = System.Reflection.MethodBase.GetCurrentMethod();
             System.Collections.Hashtable param = new System.Collections.Hashtable();
             string Ex = "0";
             foreach (System.Collections.DictionaryEntry item in idb.GetParameters())
             {
                 param.Add(item.Key, item.Value);
             }
             try
             {
                 Re = idb.ExeCmd(sql);
                 Ex = Re.ToString();
             }
             catch (Exception ex)
             {
                 Ex = ex.Message;
             }

             SysRunLog.InsertRunSql(sql, param, RunMethod.DeclaringType + "." + RunMethod.Name,Ex);

             return Re;
        }
Exemplo n.º 30
0
 private MonedasFlyweigthFactory()
 {
     monedas = new Monedas();
     hashMonedas = new System.Collections.Hashtable();
     monedas.RecuperarTodas();
     foreach (Moneda m in monedas)
         hashMonedas.Add(m.IdMoneda, m);
 }
Exemplo n.º 31
0
        public void PTS_3ReachNetwork()
        {
            Debug.WriteLine("\n\n---------------------------------------------------");
            Debug.WriteLine("Testing the Perform Time Step Method for 3 Reaches");
            Debug.WriteLine("---------------------------------------------------");

            //initialize the component
            edu.SC.Models.Routing.Muskingum Routing = new edu.SC.Models.Routing.Muskingum();
            System.Collections.Hashtable    args    = new System.Collections.Hashtable();
            args.Add("ConfigFile", "ConfigTest_3reaches.xml");
            Routing.Initialize(args);


            //Begin Perform Time Step Procedures

            //define the input hydrograph.
            double[,] p = new double[13, 3] {
                { 0, 0, 0 },
                { 0, 0.235733, 0 },
                { 0, 0.711618, 0 },
                { 0.438576, 1.377104, 0.174021 },
                { 3.081694, 2.348495, 4.341684 },
                { 8.084392, 3.419044, 13.786119 },
                { 13.492319, 4.193174, 21.125838 },
                { 15.109068, 4.572254, 20.66142 },
                { 13.640105, 4.594348, 15.781394 },
                { 10.458048, 4.369926, 9.388822 },
                { 6.77479, 3.962268, 5.85001 },
                { 4.549214, 3.452857, 3.737803 },
                { 3.124193, 2.795561, 2.306243 }
            };



            //define known muskingum routed vals, from example 9.3.2
            double[] vals = new double[13] {
                0.0,
                0.0,
                0.0,
                0.3,
                4.8,
                15.3,
                25.2,
                28.6,
                27.3,
                23.1,
                20.2,
                17.2,
                14.3
            };

            Queue <double> KnownAnswers = new Queue <double>(vals);

            //loop over all hydrograph values
            for (int j = 0; j <= p.GetLength(0) - 1; j++)
            {
                Console.WriteLine("TimeStep " + Convert.ToString(j + 1));
                double[] Array = new double[p.GetLength(1)];
                for (int k = 0; k <= p.GetLength(1) - 1; k++)
                {
                    //create array to hold the input hydrograph values for this timestep
                    Array[k] = p[j, k];
                }

                //Save input values to the Simple Model Wrappers DataTable using "SetValues"
                IValueSet Precip = new ScalarSet(Array);
                Routing.SetValues("Excess Rainfall", "Smith Branch", Precip);

                //Call Perform Time Step within the Muskingum routing component.
                Routing.PerformTimeStep();

                //Retrieve the calculated outflow from the Simple Model Wrappers DataTable, by calling GetValues()
                ScalarSet Outflow = (ScalarSet)Routing.GetValues("Streamflow", "Smith Branch");

                //Write the output results to the screen
                for (int i = 0; i <= Outflow.Count - 1; i++)
                {
                    Console.WriteLine("Outlet: " + i.ToString() + "\t Outflow [cfs]: " + Outflow.data[i].ToString() + "\n");
                }

                //Check to see if the computed values equal the known ones
                //Assert.IsTrue(Math.Round(Outflow.data[0], 1) == KnownAnswers.Dequeue());
            }

            Routing.Finish();
        }
Exemplo n.º 32
0
        public string Gravar(TRegistro_ItensOrdemServico val)
        {
            System.Collections.Hashtable hs = new System.Collections.Hashtable(11);
            hs.Add("@P_CD_EMPRESA", val.Cd_empresa);
            hs.Add("@P_ID_ORDEM", val.Id_ordem);
            hs.Add("@P_ID_ITEM", val.Id_item);
            hs.Add("@P_CD_PRODUTO", val.Cd_produto);
            hs.Add("@P_CD_LOCAL", val.Cd_local);
            hs.Add("@P_QUANTIDADE", val.Quantidade);
            hs.Add("@P_VL_UNITARIO", val.Vl_unitario);
            hs.Add("@P_VL_DESCONTO", val.Vl_desconto);
            hs.Add("@p_VL_COMISSAO", val.Vl_comissao);
            hs.Add("@P_KM_VALIDADE", val.Km_validade);
            hs.Add("@P_DIAS_VALIDADE", val.Dias_validade);

            return(this.executarProc("IA_PDC_ITENSORDEMSERVICO", hs));
        }
Exemplo n.º 33
0
        /// <summary>
        /// 添加PU_Relations对象(即:一条记录)
        /// </summary>
        public object AddWithReturn(PU_Relations pU_Relations)
        {
            string sql = "INSERT INTO PU_Relations (PUR_SRCode,PUR_SRTpe,PUR_RCode,PUR_RType,PUR_MCode,PUR_SNum,PUR_Num,PUR_Date,PUR_Owner,PUR_OwnerCode,PUR_Udef1,PUR_Udef2,PUR_Udef3,PUR_Udef4,PUR_Udef5,Stat) VALUES (@PUR_SRCode,@PUR_SRTpe,@PUR_RCode,@PUR_RType,@PUR_MCode,@PUR_SNum,@PUR_Num,@PUR_Date,@PUR_Owner,@PUR_OwnerCode,@PUR_Udef1,@PUR_Udef2,@PUR_Udef3,@PUR_Udef4,@PUR_Udef5,@Stat);SELECT @@IDENTITY AS ReturnID;";

            if (string.IsNullOrEmpty(pU_Relations.PUR_SRCode))
            {
                idb.AddParameter("@PUR_SRCode", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@PUR_SRCode", pU_Relations.PUR_SRCode);
            }
            if (string.IsNullOrEmpty(pU_Relations.PUR_SRTpe))
            {
                idb.AddParameter("@PUR_SRTpe", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@PUR_SRTpe", pU_Relations.PUR_SRTpe);
            }
            if (string.IsNullOrEmpty(pU_Relations.PUR_RCode))
            {
                idb.AddParameter("@PUR_RCode", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@PUR_RCode", pU_Relations.PUR_RCode);
            }
            if (string.IsNullOrEmpty(pU_Relations.PUR_RType))
            {
                idb.AddParameter("@PUR_RType", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@PUR_RType", pU_Relations.PUR_RType);
            }
            if (string.IsNullOrEmpty(pU_Relations.PUR_MCode))
            {
                idb.AddParameter("@PUR_MCode", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@PUR_MCode", pU_Relations.PUR_MCode);
            }
            if (pU_Relations.PUR_SNum == 0)
            {
                idb.AddParameter("@PUR_SNum", 0);
            }
            else
            {
                idb.AddParameter("@PUR_SNum", pU_Relations.PUR_SNum);
            }
            if (pU_Relations.PUR_Num == 0)
            {
                idb.AddParameter("@PUR_Num", 0);
            }
            else
            {
                idb.AddParameter("@PUR_Num", pU_Relations.PUR_Num);
            }
            if (pU_Relations.PUR_Date == DateTime.MinValue)
            {
                idb.AddParameter("@PUR_Date", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@PUR_Date", pU_Relations.PUR_Date);
            }
            if (string.IsNullOrEmpty(pU_Relations.PUR_Owner))
            {
                idb.AddParameter("@PUR_Owner", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@PUR_Owner", pU_Relations.PUR_Owner);
            }
            if (string.IsNullOrEmpty(pU_Relations.PUR_OwnerCode))
            {
                idb.AddParameter("@PUR_OwnerCode", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@PUR_OwnerCode", pU_Relations.PUR_OwnerCode);
            }
            if (string.IsNullOrEmpty(pU_Relations.PUR_Udef1))
            {
                idb.AddParameter("@PUR_Udef1", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@PUR_Udef1", pU_Relations.PUR_Udef1);
            }
            if (string.IsNullOrEmpty(pU_Relations.PUR_Udef2))
            {
                idb.AddParameter("@PUR_Udef2", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@PUR_Udef2", pU_Relations.PUR_Udef2);
            }
            if (string.IsNullOrEmpty(pU_Relations.PUR_Udef3))
            {
                idb.AddParameter("@PUR_Udef3", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@PUR_Udef3", pU_Relations.PUR_Udef3);
            }
            if (string.IsNullOrEmpty(pU_Relations.PUR_Udef4))
            {
                idb.AddParameter("@PUR_Udef4", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@PUR_Udef4", pU_Relations.PUR_Udef4);
            }
            if (string.IsNullOrEmpty(pU_Relations.PUR_Udef5))
            {
                idb.AddParameter("@PUR_Udef5", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@PUR_Udef5", pU_Relations.PUR_Udef5);
            }
            if (string.IsNullOrEmpty(pU_Relations.Stat))
            {
                idb.AddParameter("@Stat", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@Stat", pU_Relations.Stat);
            }


            int Re = 0;
            //SQL日志记录
            var RunMethod = System.Reflection.MethodBase.GetCurrentMethod();

            System.Collections.Hashtable param = new System.Collections.Hashtable();
            string Ex = "0";

            foreach (System.Collections.DictionaryEntry item in idb.GetParameters())
            {
                param.Add(item.Key, item.Value);
            }
            try
            {
                var Return = idb.ReturnValue(sql);
                Ex = Return.ToString();
            }
            catch (Exception ex)
            {
                Ex = ex.Message;
            }

            SysRunLog.InsertRunSql(sql, param, RunMethod.DeclaringType + "." + RunMethod.Name, Ex);

            return(Re);
        }
Exemplo n.º 34
0
        public string Gravar(TRegistro_DesdobroEspecial val)
        {
            System.Collections.Hashtable hs = new System.Collections.Hashtable(11);
            hs.Add("@P_ID_DESDOBROESPECIAL", val.Id_desdobroespecial);
            hs.Add("@P_CD_EMPRESA", val.Cd_empresa);
            hs.Add("@P_ID_TICKET", val.Id_ticket);
            hs.Add("@P_TP_PESAGEM", val.Tp_pesagem);
            hs.Add("@P_ID_TPDESDOBRO", val.Id_tpdesdobro);
            hs.Add("@P_NR_PEDIDODEST", val.Nr_pedidodest);
            hs.Add("@P_CD_PRODUTODEST", val.Cd_produtodest);
            hs.Add("@P_ID_PEDIDOITEMDEST", val.Id_pedidoitemdest);
            hs.Add("@P_ID_TRANSF", val.Id_transf);
            hs.Add("@P_PC_DESDOBRO", val.Pc_desdobro);
            hs.Add("@P_PESO_DESDOBRO", val.Peso_desdobro);

            return(this.executarProc("IA_BAL_DESDOBROESPECIAL", hs));
        }
Exemplo n.º 35
0
        /// <summary>
        /// 添加印章使用记录 GM_SealRecord对象(即:一条记录)
        /// </summary>
        public int Add(GM_SealRecord gM_SealRecord)
        {
            string sql = "INSERT INTO GM_SealRecord (GMSR_Code,GMSR_SCode,GMSR_SName,GMSR_Date,GMSR_Function,GMSR_Copy,GMSR_Employee,GMSR_Approve,GMSR_RDate,GMSR_UCat,GMSR_Company,GMSR_Dept,GMSR_Bak,Stat,CreateDate,UpdateDate,DeleteDate) VALUES (@GMSR_Code,@GMSR_SCode,@GMSR_SName,@GMSR_Date,@GMSR_Function,@GMSR_Copy,@GMSR_Employee,@GMSR_Approve,@GMSR_RDate,@GMSR_UCat,@GMSR_Company,@GMSR_Dept,@GMSR_Bak,@Stat,@CreateDate,@UpdateDate,@DeleteDate)";

            if (string.IsNullOrEmpty(gM_SealRecord.GMSR_Code))
            {
                idb.AddParameter("@GMSR_Code", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@GMSR_Code", gM_SealRecord.GMSR_Code);
            }
            if (string.IsNullOrEmpty(gM_SealRecord.GMSR_SCode))
            {
                idb.AddParameter("@GMSR_SCode", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@GMSR_SCode", gM_SealRecord.GMSR_SCode);
            }
            if (string.IsNullOrEmpty(gM_SealRecord.GMSR_SName))
            {
                idb.AddParameter("@GMSR_SName", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@GMSR_SName", gM_SealRecord.GMSR_SName);
            }
            if (gM_SealRecord.GMSR_Date == DateTime.MinValue)
            {
                idb.AddParameter("@GMSR_Date", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@GMSR_Date", gM_SealRecord.GMSR_Date);
            }
            if (string.IsNullOrEmpty(gM_SealRecord.GMSR_Function))
            {
                idb.AddParameter("@GMSR_Function", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@GMSR_Function", gM_SealRecord.GMSR_Function);
            }
            if (gM_SealRecord.GMSR_Copy == 0)
            {
                idb.AddParameter("@GMSR_Copy", 0);
            }
            else
            {
                idb.AddParameter("@GMSR_Copy", gM_SealRecord.GMSR_Copy);
            }
            if (string.IsNullOrEmpty(gM_SealRecord.GMSR_Employee))
            {
                idb.AddParameter("@GMSR_Employee", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@GMSR_Employee", gM_SealRecord.GMSR_Employee);
            }
            if (string.IsNullOrEmpty(gM_SealRecord.GMSR_Approve))
            {
                idb.AddParameter("@GMSR_Approve", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@GMSR_Approve", gM_SealRecord.GMSR_Approve);
            }
            if (gM_SealRecord.GMSR_RDate == DateTime.MinValue)
            {
                idb.AddParameter("@GMSR_RDate", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@GMSR_RDate", gM_SealRecord.GMSR_RDate);
            }
            if (string.IsNullOrEmpty(gM_SealRecord.GMSR_UCat))
            {
                idb.AddParameter("@GMSR_UCat", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@GMSR_UCat", gM_SealRecord.GMSR_UCat);
            }
            if (string.IsNullOrEmpty(gM_SealRecord.GMSR_Company))
            {
                idb.AddParameter("@GMSR_Company", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@GMSR_Company", gM_SealRecord.GMSR_Company);
            }
            if (string.IsNullOrEmpty(gM_SealRecord.GMSR_Dept))
            {
                idb.AddParameter("@GMSR_Dept", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@GMSR_Dept", gM_SealRecord.GMSR_Dept);
            }
            if (string.IsNullOrEmpty(gM_SealRecord.GMSR_Bak))
            {
                idb.AddParameter("@GMSR_Bak", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@GMSR_Bak", gM_SealRecord.GMSR_Bak);
            }
            if (gM_SealRecord.Stat == 0)
            {
                idb.AddParameter("@Stat", 0);
            }
            else
            {
                idb.AddParameter("@Stat", gM_SealRecord.Stat);
            }
            if (gM_SealRecord.CreateDate == DateTime.MinValue)
            {
                idb.AddParameter("@CreateDate", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@CreateDate", gM_SealRecord.CreateDate);
            }
            if (gM_SealRecord.UpdateDate == DateTime.MinValue)
            {
                idb.AddParameter("@UpdateDate", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@UpdateDate", gM_SealRecord.UpdateDate);
            }
            if (gM_SealRecord.DeleteDate == DateTime.MinValue)
            {
                idb.AddParameter("@DeleteDate", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@DeleteDate", gM_SealRecord.DeleteDate);
            }


            int Re = 0;
            //SQL日志记录
            var RunMethod = System.Reflection.MethodBase.GetCurrentMethod();

            System.Collections.Hashtable param = new System.Collections.Hashtable();
            string Ex = "0";

            foreach (System.Collections.DictionaryEntry item in idb.GetParameters())
            {
                param.Add(item.Key, item.Value);
            }
            try
            {
                Re = idb.ExeCmd(sql);
                Ex = Re.ToString();
            }
            catch (Exception ex)
            {
                Ex = ex.Message;
            }

            SysRunLog.InsertRunSql(sql, param, RunMethod.DeclaringType + "." + RunMethod.Name, Ex);

            return(Re);
        }
Exemplo n.º 36
0
        /// <summary>
        /// 添加生产配比下达信息 TC_DComp对象(即:一条记录)
        /// </summary>
        public int Add(TC_DComp tC_DComp)
        {
            string sql = "INSERT INTO TC_DComp (TCD_Code,TCD_PCode,TCD_PLine,TCD_PPlan,TCD_Remark,TCD_UDef1,TCD_UDef2,TCD_UDef3,TCD_UDef4,TCD_UDef5,Stat,CreateDate,UpdateDate,DeleteDate) VALUES (@TCD_Code,@TCD_PCode,@TCD_PLine,@TCD_PPlan,@TCD_Remark,@TCD_UDef1,@TCD_UDef2,@TCD_UDef3,@TCD_UDef4,@TCD_UDef5,@Stat,@CreateDate,@UpdateDate,@DeleteDate)";

            if (string.IsNullOrEmpty(tC_DComp.TCD_Code))
            {
                idb.AddParameter("@TCD_Code", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@TCD_Code", tC_DComp.TCD_Code);
            }
            if (string.IsNullOrEmpty(tC_DComp.TCD_PCode))
            {
                idb.AddParameter("@TCD_PCode", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@TCD_PCode", tC_DComp.TCD_PCode);
            }
            if (string.IsNullOrEmpty(tC_DComp.TCD_PLine))
            {
                idb.AddParameter("@TCD_PLine", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@TCD_PLine", tC_DComp.TCD_PLine);
            }
            if (string.IsNullOrEmpty(tC_DComp.TCD_PPlan))
            {
                idb.AddParameter("@TCD_PPlan", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@TCD_PPlan", tC_DComp.TCD_PPlan);
            }
            if (string.IsNullOrEmpty(tC_DComp.TCD_Remark))
            {
                idb.AddParameter("@TCD_Remark", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@TCD_Remark", tC_DComp.TCD_Remark);
            }
            if (string.IsNullOrEmpty(tC_DComp.TCD_UDef1))
            {
                idb.AddParameter("@TCD_UDef1", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@TCD_UDef1", tC_DComp.TCD_UDef1);
            }
            if (string.IsNullOrEmpty(tC_DComp.TCD_UDef2))
            {
                idb.AddParameter("@TCD_UDef2", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@TCD_UDef2", tC_DComp.TCD_UDef2);
            }
            if (string.IsNullOrEmpty(tC_DComp.TCD_UDef3))
            {
                idb.AddParameter("@TCD_UDef3", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@TCD_UDef3", tC_DComp.TCD_UDef3);
            }
            if (string.IsNullOrEmpty(tC_DComp.TCD_UDef4))
            {
                idb.AddParameter("@TCD_UDef4", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@TCD_UDef4", tC_DComp.TCD_UDef4);
            }
            if (string.IsNullOrEmpty(tC_DComp.TCD_UDef5))
            {
                idb.AddParameter("@TCD_UDef5", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@TCD_UDef5", tC_DComp.TCD_UDef5);
            }
            if (tC_DComp.Stat == 0)
            {
                idb.AddParameter("@Stat", 0);
            }
            else
            {
                idb.AddParameter("@Stat", tC_DComp.Stat);
            }
            if (tC_DComp.CreateDate == DateTime.MinValue)
            {
                idb.AddParameter("@CreateDate", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@CreateDate", tC_DComp.CreateDate);
            }
            if (tC_DComp.UpdateDate == DateTime.MinValue)
            {
                idb.AddParameter("@UpdateDate", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@UpdateDate", tC_DComp.UpdateDate);
            }
            if (tC_DComp.DeleteDate == DateTime.MinValue)
            {
                idb.AddParameter("@DeleteDate", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@DeleteDate", tC_DComp.DeleteDate);
            }


            int Re = 0;
            //SQL日志记录
            var RunMethod = System.Reflection.MethodBase.GetCurrentMethod();

            System.Collections.Hashtable param = new System.Collections.Hashtable();
            string Ex = "0";

            foreach (System.Collections.DictionaryEntry item in idb.GetParameters())
            {
                param.Add(item.Key, item.Value);
            }
            try
            {
                Re = idb.ExeCmd(sql);
                Ex = Re.ToString();
            }
            catch (Exception ex)
            {
                Ex = ex.Message;
            }

            SysRunLog.InsertRunSql(sql, param, RunMethod.DeclaringType + "." + RunMethod.Name, Ex);

            return(Re);
        }
Exemplo n.º 37
0
        }//Encode_Code39

        private void init_Code39()
        {
            C39_Code.Clear();
            C39_Code.Add('0', "101001101101");
            C39_Code.Add('1', "110100101011");
            C39_Code.Add('2', "101100101011");
            C39_Code.Add('3', "110110010101");
            C39_Code.Add('4', "101001101011");
            C39_Code.Add('5', "110100110101");
            C39_Code.Add('6', "101100110101");
            C39_Code.Add('7', "101001011011");
            C39_Code.Add('8', "110100101101");
            C39_Code.Add('9', "101100101101");
            C39_Code.Add('A', "110101001011");
            C39_Code.Add('B', "101101001011");
            C39_Code.Add('C', "110110100101");
            C39_Code.Add('D', "101011001011");
            C39_Code.Add('E', "110101100101");
            C39_Code.Add('F', "101101100101");
            C39_Code.Add('G', "101010011011");
            C39_Code.Add('H', "110101001101");
            C39_Code.Add('I', "101101001101");
            C39_Code.Add('J', "101011001101");
            C39_Code.Add('K', "110101010011");
            C39_Code.Add('L', "101101010011");
            C39_Code.Add('M', "110110101001");
            C39_Code.Add('N', "101011010011");
            C39_Code.Add('O', "110101101001");
            C39_Code.Add('P', "101101101001");
            C39_Code.Add('Q', "101010110011");
            C39_Code.Add('R', "110101011001");
            C39_Code.Add('S', "101101011001");
            C39_Code.Add('T', "101011011001");
            C39_Code.Add('U', "110010101011");
            C39_Code.Add('V', "100110101011");
            C39_Code.Add('W', "110011010101");
            C39_Code.Add('X', "100101101011");
            C39_Code.Add('Y', "110010110101");
            C39_Code.Add('Z', "100110110101");
            C39_Code.Add('-', "100101011011");
            C39_Code.Add('.', "110010101101");
            C39_Code.Add(' ', "100110101101");
            C39_Code.Add('$', "100100100101");
            C39_Code.Add('/', "100100101001");
            C39_Code.Add('+', "100101001001");
            C39_Code.Add('%', "101001001001");
            C39_Code.Add('*', "100101101101");
        }//init_Code39
Exemplo n.º 38
0
        public ActionResult RedirectOption(string option)
        {
            //option = option.ToUpper();

            //XmlDocument xDoc = new XmlDocument();

            //xDoc.Load(@ConfigurationManager.AppSettings["pathSiteMap"]);

            //XmlNodeList options = xDoc.GetElementsByTagName("siteMapNode");

            //int index = options.Count;
            //foreach (XmlElement nodo in options)
            //{
            //    if (nodo.GetAttribute("id").Equals(option) && nodo.GetAttribute("resourceKey").Equals(System.Web.HttpContext.Current.Session["App"].ToString().Trim()))
            //    {
            //        //return RedirectToAction(nodo.GetAttribute("action").Trim(), nodo.GetAttribute("controller").Trim());

            //        var urlBuilder = new UrlHelper(Request.RequestContext);
            //        var url = urlBuilder.Action(nodo.GetAttribute("action").Trim(), nodo.GetAttribute("controller").Trim());
            //        return Json(new { status = "success", url = url, action = nodo.GetAttribute("action").Trim(), controller = nodo.GetAttribute("controller").Trim() }, JsonRequestBehavior.AllowGet);

            //    }
            //}



            try
            {
                string variable = ConfigurationManager.AppSettings[ConfigurationManager.AppSettings["AmbienteSC"]];
                sqlHelper.connection_Name(variable);
                DataSet dts = new DataSet();

                int pIdUsuario = int.Parse(System.Web.HttpContext.Current.Session["SystemUserId"].ToString().Trim());
                System.Collections.Hashtable parametros = new System.Collections.Hashtable();
                parametros.Add("@pIdUsuario", pIdUsuario);
                parametros.Add("@pOpcion", option);

                dts = sqlHelper.ExecuteDataSet(CommandType.StoredProcedure, "up_fmk_ValidaTransaccionPC", false, parametros);


                TransaccionPC item = new TransaccionPC();

                foreach (DataTable table in dts.Tables)
                {
                    foreach (DataRow dr in table.Rows)
                    {
                        item.IdSistema     = int.Parse(dr["IdSistema"].ToString());
                        item.NombreSistema = (dr["NombreSistema"].ToString());
                        item.url           = (dr["url"].ToString());
                    }
                }


                string srvName = ConfigurationManager.AppSettings["srvrName"].ToString() + item.NombreSistema;
                var    result  = new { Success = true, datos = item, Message = "OK" };
                if (item.IdSistema == 0)
                {
                    result = new { Success = false, datos = item, Message = "Transaccion invalida o usted no tiene acceso!!!" };
                }
                else
                {
                    this.ControllerContext.HttpContext.Response.Cookies.Clear();

                    HttpCookie cookie = new HttpCookie("CookieLogin");

                    cookie["Created"]   = DateTime.Now.ToShortTimeString();
                    cookie["UserId"]    = Request.Cookies["CookieLogin"]["UserId"];
                    cookie["User"]      = Request.Cookies["CookieLogin"]["User"];
                    cookie["Pass"]      = Request.Cookies["CookieLogin"]["Pass"];
                    cookie["IdSistema"] = item.IdSistema.ToString();


                    cookie.Expires = DateTime.Now.AddHours(8);
                    this.ControllerContext.HttpContext.Response.Cookies.Add(cookie);
                    item.url = srvName + item.url;
                }
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                var result = new { Success = false, Message = ex.Message };
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
        }
Exemplo n.º 39
0
        private void CargaHeaderInfoSystem(string userId, string idSistema)
        {
            try
            {
                DataSet ds = new DataSet();

                try
                {
                    System.Collections.Hashtable parameters = new System.Collections.Hashtable();

                    parameters.Add("@in_Id_Usuario", userId);
                    parameters.Add("@in_Id_Sistema", idSistema);
                    ds = Soriana.FWK.Datos.SQL.SqlHelper.ExecuteDataSet(System.Data.CommandType.StoredProcedure, "sp_GetHeaderSystemInfo", false, parameters);

                    Boolean flagDatosIn = false;
                    if (ds != null)
                    {
                        if (ds.Tables.Count > 0)
                        {
                            if (ds.Tables[0].Rows.Count > 0)
                            {
                                flagDatosIn = true;
                            }
                        }
                    }

                    if (flagDatosIn)
                    {
                        System.Web.HttpContext.Current.Session["Tienda"] = ds.Tables[0].Rows[0][1].ToString().Trim();
                    }
                    else
                    {
                        System.Web.HttpContext.Current.Session["Tienda"] = string.Empty;
                    }
                    flagDatosIn = false;
                    if (ds != null)
                    {
                        if (ds.Tables.Count > 0)
                        {
                            if (ds.Tables[1].Rows.Count > 0)
                            {
                                flagDatosIn = true;
                            }
                        }
                    }

                    if (flagDatosIn)
                    {
                        System.Web.HttpContext.Current.Session["sNombre"] = ds.Tables[1].Rows[0][6].ToString().Trim();
                        System.Web.HttpContext.Current.Session["Profile"] = ds.Tables[1].Rows[0][5].ToString().Trim();
                        System.Web.HttpContext.Current.Session["App"]     = ds.Tables[1].Rows[0][4].ToString().Trim();
                    }
                    else
                    {
                        System.Web.HttpContext.Current.Session["sNombre"] = string.Empty;
                        System.Web.HttpContext.Current.Session["Profile"] = string.Empty;
                        System.Web.HttpContext.Current.Session["App"]     = string.Empty;
                    }
                }
                catch (SqlException ex)
                {
                    throw ex;
                }
                catch (System.Exception ex)
                {
                    throw ex;
                }
            }
            catch (SqlException ex)
            {
                throw ex;
            }
            catch (System.Exception ex)
            {
                throw ex;
            }
        }
        private void Load_rptWare_Congno_Chitiet()
        {
            try
            {
                System.Collections.Hashtable hashtableControls = new System.Collections.Hashtable();
                hashtableControls.Add(dtNgay_Batdau, lblNgay_Batdau.Text);
                hashtableControls.Add(dtNgay_Ketthuc, lblNgay_Ketthuc.Text);
                hashtableControls.Add(lookUpEditMa_Ncc, lblDoituong.Text);

                if (!GoobizFrame.Windows.MdiUtils.Validator.CheckNullFields(hashtableControls))
                {
                    return;
                }

                if (!GoobizFrame.Windows.MdiUtils.Validator.CheckDate(dtNgay_Batdau, dtNgay_Ketthuc))
                {
                    return;
                }

                DataSet ds_Congnothu = objReportService.RptCongno_NCC_Chitiet(dtNgay_Batdau.EditValue, dtNgay_Ketthuc.EditValue, lookUpEditTen_Ncc.EditValue).ToDataSet();
                Ecm.Reports.XtraReports.rptWare_Congno_Chitiet _rptWare_Congno_Chitiet = new Ecm.Reports.XtraReports.rptWare_Congno_Chitiet();
                _rptWare_Congno_Chitiet.DataSource = ds_Congnothu;
                GoobizFrame.Windows.Forms.FrmPrintPreview _FrmPrintPreview = new GoobizFrame.Windows.Forms.FrmPrintPreview();
                _FrmPrintPreview.Report = _rptWare_Congno_Chitiet;
                // Thiết lập hệ số chương trình (Logo, thông tin công ty)
                setHesoChuongtrinh(_rptWare_Congno_Chitiet.xrc_CompanyName, _rptWare_Congno_Chitiet.xrc_CompanyAddress, null);
                _rptWare_Congno_Chitiet.xrDate_From.Text           = dtNgay_Batdau.DateTime.ToString("dd/MM/yyyy");
                _rptWare_Congno_Chitiet.xrDate_To.Text             = dtNgay_Ketthuc.DateTime.ToString("dd/MM/yyyy");
                _rptWare_Congno_Chitiet.xrTableCell_TenKH.Text     = lookUpEditTen_Ncc.Text + " - " + lookUpEditMa_Ncc.Text;
                _rptWare_Congno_Chitiet.xrTableCell_Dienthoai.Text = lookUpEditMa_Ncc.GetColumnValue("Dienthoai").ToString();
                _rptWare_Congno_Chitiet.xrTableCell_Diachi.Text    = lookUpEditMa_Ncc.GetColumnValue("Diachi_Nhacungcap").ToString();
                _rptWare_Congno_Chitiet.xrTableCell_KH.Text        = "Tên NCC";
                _rptWare_Congno_Chitiet.xrTable_Ngay.Text          = DateTime.Today.Day.ToString();
                _rptWare_Congno_Chitiet.xrTable_Thang.Text         = DateTime.Today.Month.ToString();
                _rptWare_Congno_Chitiet.xrTable_Nam.Text           = DateTime.Today.Year.ToString();
                _rptWare_Congno_Chitiet.CreateDocument();
                GoobizFrame.Windows.Forms.ReportOptions oReportOptions = GoobizFrame.Windows.Forms.ReportOptions.GetReportOptions(_rptWare_Congno_Chitiet);
                if (Convert.ToBoolean(oReportOptions.PrintPreview))
                {
                    _FrmPrintPreview.Text = "" + oReportOptions.Caption;
                    _FrmPrintPreview.printControl1.PrintingSystem = _rptWare_Congno_Chitiet.PrintingSystem;
                    _FrmPrintPreview.MdiParent = this.MdiParent;
                    _FrmPrintPreview.Text      = this.Text + "(Xem trang in)";
                    _FrmPrintPreview.Show();
                    _FrmPrintPreview.Activate();
                }
                else
                {
                    var ReportPrintTool = new DevExpress.XtraReports.UI.ReportPrintTool(_rptWare_Congno_Chitiet);
                    ReportPrintTool.Print();
                }
                _FrmPrintPreview.Show();
                _FrmPrintPreview.Activate();
            }
            catch (Exception ex)
            {
#if DEBUG
                MessageBox.Show(ex.Message);
#endif
            }
        }
        private void Load_Rptware_Nhap_Chitiet()
        {
            System.Collections.Hashtable hashtableControls = new System.Collections.Hashtable();
            hashtableControls.Add(dtNgay_Batdau, lblNgay_Batdau.Text);
            hashtableControls.Add(dtNgay_Ketthuc, lblNgay_Ketthuc.Text);
            hashtableControls.Add(lookUpEdit_Cuahang_Ban, lblCuahang_Ban.Text);

            if (!GoobizFrame.Windows.MdiUtils.Validator.CheckNullFields(hashtableControls))
            {
                return;
            }
            if (!GoobizFrame.Windows.MdiUtils.Validator.CheckDate(dtNgay_Batdau, dtNgay_Ketthuc))
            {
                return;
            }
            DataSet ds_Xuat_Chittiet = objWareService.Get_All_Ware_Nhap_Chitiet(lookUpEdit_Cuahang_Ban.EditValue, dtNgay_Batdau.EditValue, dtNgay_Ketthuc.EditValue, lookUpEdit_Mahang.EditValue, null).ToDataSet();

            Reports.XtraReports.rptWare_Xuatnhap_Chitiet _Rptware_Xuatnhap_Chitiet = new Ecm.Reports.XtraReports.rptWare_Xuatnhap_Chitiet();

            #region Thiết lập hệ số chương trình (Logo, thông tin công ty)
            using (DataSet dsHeso_Chuongtrinh = objMasterService.Get_Rex_Dm_Heso_Chuongtrinh_Collection3().ToDataSet())
            {
                DataSet dsCompany_Paras = new DataSet();
                dsCompany_Paras.Tables.Add("Company_Paras");
                dsCompany_Paras.Tables[0].Columns.Add("CompanyName", typeof(string));
                dsCompany_Paras.Tables[0].Columns.Add("CompanyAddress", typeof(string));
                dsCompany_Paras.Tables[0].Columns.Add("CompanyLogo", typeof(byte[]));

                byte[] imageData = Convert.FromBase64String("" + dsHeso_Chuongtrinh.Tables[0].Select(string.Format("Ma_Heso_Chuongtrinh='{0}'", "CompanyLogo"))[0]["Heso"]);

                dsCompany_Paras.Tables[0].Rows.Add(new object[]  {
                    dsHeso_Chuongtrinh.Tables[0].Select(string.Format("Ma_Heso_Chuongtrinh='{0}'", "CompanyName"))[0]["Heso"]
                    , dsHeso_Chuongtrinh.Tables[0].Select(string.Format("Ma_Heso_Chuongtrinh='{0}'", "CompanyAddress"))[0]["Heso"]
                    , imageData
                });

                _Rptware_Xuatnhap_Chitiet.xrc_CompanyName.DataBindings.Add(
                    new DevExpress.XtraReports.UI.XRBinding("Text", dsCompany_Paras, dsCompany_Paras.Tables[0].TableName + ".CompanyName"));
                _Rptware_Xuatnhap_Chitiet.xrc_CompanyAddress.DataBindings.Add(
                    new DevExpress.XtraReports.UI.XRBinding("Text", dsCompany_Paras, dsCompany_Paras.Tables[0].TableName + ".CompanyAddress"));
            }
            #endregion
            _Rptware_Xuatnhap_Chitiet.xrLabel_ReportName.Text = @"SỔ CHI TIẾT NHẬP HÀNG";
            _Rptware_Xuatnhap_Chitiet.xrTable_Loaiphieu.Text  = @"PHIẾU NHẬP";
            _Rptware_Xuatnhap_Chitiet.xrTable_Kho.Text        = lookUpEdit_Cuahang_Ban.Text;
            _Rptware_Xuatnhap_Chitiet.xrTable_Denngay.Text    = DateTime.Parse(dtNgay_Ketthuc.EditValue.ToString()).ToString("dd/MM/yyyy");
            _Rptware_Xuatnhap_Chitiet.xrTable_Tungay.Text     = DateTime.Parse(dtNgay_Batdau.EditValue.ToString()).ToString("dd/MM/yyyy");
            _Rptware_Xuatnhap_Chitiet.xrTable_ngay.Text       = DateTime.Today.Day.ToString();
            _Rptware_Xuatnhap_Chitiet.xrTable_Thang.Text      = DateTime.Today.Month.ToString();
            _Rptware_Xuatnhap_Chitiet.xrTable_Nam.Text        = DateTime.Today.Year.ToString();
            _Rptware_Xuatnhap_Chitiet.DataSource = ds_Xuat_Chittiet;
            _Rptware_Xuatnhap_Chitiet.CreateDocument();
            string path_file = @"Resources\repx\rptWare_Xuatnhap_Chitiet.repx";
            if (System.IO.File.Exists(path_file))
            {
                System.IO.File.Delete(path_file);
            }
            GoobizFrame.Windows.Forms.FrmPrintPreview _FrmPrintPreview = new GoobizFrame.Windows.Forms.FrmPrintPreview();
            _FrmPrintPreview.Report = _Rptware_Xuatnhap_Chitiet;
            GoobizFrame.Windows.Forms.ReportOptions oReportOptions = GoobizFrame.Windows.Forms.ReportOptions.GetReportOptions(_Rptware_Xuatnhap_Chitiet);
            if (Convert.ToBoolean(oReportOptions.PrintPreview))
            {
                _FrmPrintPreview.Text = "" + oReportOptions.Caption;
                _FrmPrintPreview.printControl1.PrintingSystem = _Rptware_Xuatnhap_Chitiet.PrintingSystem;
                _FrmPrintPreview.MdiParent = this.MdiParent;
                _FrmPrintPreview.Text      = this.Text + "(Xem trang in)";
            }
            else
            {
                var ReportPrintTool = new DevExpress.XtraReports.UI.ReportPrintTool(_Rptware_Xuatnhap_Chitiet);
                ReportPrintTool.Print();
            }
            _FrmPrintPreview.Show();
            _FrmPrintPreview.Activate();
        }
Exemplo n.º 42
0
        public string Gravar(TRegistro_OrdemServico val)
        {
            System.Collections.Hashtable hs = new System.Collections.Hashtable(14);
            hs.Add("@P_CD_EMPRESA", val.Cd_empresa);
            hs.Add("@P_ID_ORDEM", val.Id_ordem);
            hs.Add("@P_CD_CLIFOR", val.Cd_clifor);
            hs.Add("@P_CD_ENDERECO", val.Cd_endereco);
            hs.Add("@P_CD_VENDEDOR", val.Cd_vendedor);
            hs.Add("@P_CD_TABELAPRECO", val.Cd_tabelapreco);
            hs.Add("@P_DS_VEICULO", val.Ds_veiculo);
            hs.Add("@P_MARCA_VEICULO", val.Marca_veiculo);
            hs.Add("@P_PLACA", val.Placa);
            hs.Add("@P_ANO", val.Ano);
            hs.Add("@P_MODELO", val.Modelo);
            hs.Add("@P_KM_ATUAL", val.Km_atual);
            hs.Add("@P_DT_ORDEM", val.Dt_ordem);
            hs.Add("@P_NR_REQUISICAO", val.Nr_requisicao);

            return(this.executarProc("IA_PDC_ORDEMSERVICO", hs));
        }
Exemplo n.º 43
0
        /// <summary>
        /// 更新语音播报 PCD_Voice对象(即:一条记录
        /// </summary>
        public int Update(PCD_Voice pCD_Voice)
        {
            StringBuilder sbParameter = new StringBuilder();
            StringBuilder sb          = new StringBuilder();

            sb.Append(@"UPDATE       PCD_Voice       SET ");
            if (pCD_Voice.PCDV_Code_IsChanged)
            {
                sbParameter.Append("PCDV_Code=@PCDV_Code, ");
            }
            if (pCD_Voice.PCDV_Type_IsChanged)
            {
                sbParameter.Append("PCDV_Type=@PCDV_Type, ");
            }
            if (pCD_Voice.PCDV_OType_IsChanged)
            {
                sbParameter.Append("PCDV_OType=@PCDV_OType, ");
            }
            if (pCD_Voice.PCDV_Object_IsChanged)
            {
                sbParameter.Append("PCDV_Object=@PCDV_Object, ");
            }
            if (pCD_Voice.PCDV_Content_IsChanged)
            {
                sbParameter.Append("PCDV_Content=@PCDV_Content, ");
            }
            if (pCD_Voice.PCDV_Date_IsChanged)
            {
                sbParameter.Append("PCDV_Date=@PCDV_Date, ");
            }
            if (pCD_Voice.PCDV_ODate_IsChanged)
            {
                sbParameter.Append("PCDV_ODate=@PCDV_ODate, ");
            }
            if (pCD_Voice.PCDV_FType_IsChanged)
            {
                sbParameter.Append("PCDV_FType=@PCDV_FType, ");
            }
            if (pCD_Voice.PCDV_FCode_IsChanged)
            {
                sbParameter.Append("PCDV_FCode=@PCDV_FCode, ");
            }
            if (pCD_Voice.Stat_IsChanged)
            {
                sbParameter.Append("Stat=@Stat, ");
            }
            if (pCD_Voice.CreateDate_IsChanged)
            {
                sbParameter.Append("CreateDate=@CreateDate, ");
            }
            if (pCD_Voice.UpdateDate_IsChanged)
            {
                sbParameter.Append("UpdateDate=@UpdateDate, ");
            }
            if (pCD_Voice.DeleteDate_IsChanged)
            {
                sbParameter.Append("DeleteDate=@DeleteDate ");
            }
            sb.Append(sbParameter.ToString().Trim().TrimEnd(','));
            sb.Append(" WHERE 1=1 AND ((Stat is null) or (Stat=0))   and PCDV_ID=@PCDV_ID; ");
            string sql = sb.ToString();

            if (pCD_Voice.PCDV_Code_IsChanged)
            {
                if (string.IsNullOrEmpty(pCD_Voice.PCDV_Code))
                {
                    idb.AddParameter("@PCDV_Code", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@PCDV_Code", pCD_Voice.PCDV_Code);
                }
            }
            if (pCD_Voice.PCDV_Type_IsChanged)
            {
                if (string.IsNullOrEmpty(pCD_Voice.PCDV_Type))
                {
                    idb.AddParameter("@PCDV_Type", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@PCDV_Type", pCD_Voice.PCDV_Type);
                }
            }
            if (pCD_Voice.PCDV_OType_IsChanged)
            {
                if (string.IsNullOrEmpty(pCD_Voice.PCDV_OType))
                {
                    idb.AddParameter("@PCDV_OType", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@PCDV_OType", pCD_Voice.PCDV_OType);
                }
            }
            if (pCD_Voice.PCDV_Object_IsChanged)
            {
                if (string.IsNullOrEmpty(pCD_Voice.PCDV_Object))
                {
                    idb.AddParameter("@PCDV_Object", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@PCDV_Object", pCD_Voice.PCDV_Object);
                }
            }
            if (pCD_Voice.PCDV_Content_IsChanged)
            {
                if (string.IsNullOrEmpty(pCD_Voice.PCDV_Content))
                {
                    idb.AddParameter("@PCDV_Content", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@PCDV_Content", pCD_Voice.PCDV_Content);
                }
            }
            if (pCD_Voice.PCDV_Date_IsChanged)
            {
                if (pCD_Voice.PCDV_Date == DateTime.MinValue)
                {
                    idb.AddParameter("@PCDV_Date", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@PCDV_Date", pCD_Voice.PCDV_Date);
                }
            }
            if (pCD_Voice.PCDV_ODate_IsChanged)
            {
                if (pCD_Voice.PCDV_ODate == DateTime.MinValue)
                {
                    idb.AddParameter("@PCDV_ODate", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@PCDV_ODate", pCD_Voice.PCDV_ODate);
                }
            }
            if (pCD_Voice.PCDV_FType_IsChanged)
            {
                if (string.IsNullOrEmpty(pCD_Voice.PCDV_FType))
                {
                    idb.AddParameter("@PCDV_FType", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@PCDV_FType", pCD_Voice.PCDV_FType);
                }
            }
            if (pCD_Voice.PCDV_FCode_IsChanged)
            {
                if (string.IsNullOrEmpty(pCD_Voice.PCDV_FCode))
                {
                    idb.AddParameter("@PCDV_FCode", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@PCDV_FCode", pCD_Voice.PCDV_FCode);
                }
            }
            if (pCD_Voice.Stat_IsChanged)
            {
                if (pCD_Voice.Stat == 0)
                {
                    idb.AddParameter("@Stat", 0);
                }
                else
                {
                    idb.AddParameter("@Stat", pCD_Voice.Stat);
                }
            }
            if (pCD_Voice.CreateDate_IsChanged)
            {
                if (pCD_Voice.CreateDate == DateTime.MinValue)
                {
                    idb.AddParameter("@CreateDate", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@CreateDate", pCD_Voice.CreateDate);
                }
            }
            if (pCD_Voice.UpdateDate_IsChanged)
            {
                if (pCD_Voice.UpdateDate == DateTime.MinValue)
                {
                    idb.AddParameter("@UpdateDate", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@UpdateDate", pCD_Voice.UpdateDate);
                }
            }
            if (pCD_Voice.DeleteDate_IsChanged)
            {
                if (pCD_Voice.DeleteDate == DateTime.MinValue)
                {
                    idb.AddParameter("@DeleteDate", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@DeleteDate", pCD_Voice.DeleteDate);
                }
            }

            idb.AddParameter("@PCDV_ID", pCD_Voice.PCDV_ID);


            int Re = 0;
            //SQL日志记录
            var RunMethod = System.Reflection.MethodBase.GetCurrentMethod();

            System.Collections.Hashtable param = new System.Collections.Hashtable();
            string Ex = "0";

            foreach (System.Collections.DictionaryEntry item in idb.GetParameters())
            {
                param.Add(item.Key, item.Value);
            }
            try
            {
                Re = idb.ExeCmd(sql);
                Ex = Re.ToString();
            }
            catch (Exception ex)
            {
                Ex = ex.Message;
            }

            SysRunLog.InsertRunSql(sql, param, RunMethod.DeclaringType + "." + RunMethod.Name, Ex);

            return(Re);
        }
Exemplo n.º 44
0
        /// <summary>
        /// 更新PU_Relations对象(即:一条记录
        /// </summary>
        public int Update(PU_Relations pU_Relations)
        {
            StringBuilder sbParameter = new StringBuilder();
            StringBuilder sb          = new StringBuilder();

            sb.Append(@"UPDATE       PU_Relations       SET ");
            if (pU_Relations.PUR_SRCode_IsChanged)
            {
                sbParameter.Append("PUR_SRCode=@PUR_SRCode, ");
            }
            if (pU_Relations.PUR_SRTpe_IsChanged)
            {
                sbParameter.Append("PUR_SRTpe=@PUR_SRTpe, ");
            }
            if (pU_Relations.PUR_RCode_IsChanged)
            {
                sbParameter.Append("PUR_RCode=@PUR_RCode, ");
            }
            if (pU_Relations.PUR_RType_IsChanged)
            {
                sbParameter.Append("PUR_RType=@PUR_RType, ");
            }
            if (pU_Relations.PUR_MCode_IsChanged)
            {
                sbParameter.Append("PUR_MCode=@PUR_MCode, ");
            }
            if (pU_Relations.PUR_SNum_IsChanged)
            {
                sbParameter.Append("PUR_SNum=@PUR_SNum, ");
            }
            if (pU_Relations.PUR_Num_IsChanged)
            {
                sbParameter.Append("PUR_Num=@PUR_Num, ");
            }
            if (pU_Relations.PUR_Date_IsChanged)
            {
                sbParameter.Append("PUR_Date=@PUR_Date, ");
            }
            if (pU_Relations.PUR_Owner_IsChanged)
            {
                sbParameter.Append("PUR_Owner=@PUR_Owner, ");
            }
            if (pU_Relations.PUR_OwnerCode_IsChanged)
            {
                sbParameter.Append("PUR_OwnerCode=@PUR_OwnerCode, ");
            }
            if (pU_Relations.PUR_Udef1_IsChanged)
            {
                sbParameter.Append("PUR_Udef1=@PUR_Udef1, ");
            }
            if (pU_Relations.PUR_Udef2_IsChanged)
            {
                sbParameter.Append("PUR_Udef2=@PUR_Udef2, ");
            }
            if (pU_Relations.PUR_Udef3_IsChanged)
            {
                sbParameter.Append("PUR_Udef3=@PUR_Udef3, ");
            }
            if (pU_Relations.PUR_Udef4_IsChanged)
            {
                sbParameter.Append("PUR_Udef4=@PUR_Udef4, ");
            }
            if (pU_Relations.PUR_Udef5_IsChanged)
            {
                sbParameter.Append("PUR_Udef5=@PUR_Udef5, ");
            }
            if (pU_Relations.Stat_IsChanged)
            {
                sbParameter.Append("Stat=@Stat ");
            }
            sb.Append(sbParameter.ToString().Trim().TrimEnd(','));
            sb.Append(" WHERE 1=1 AND ((Stat is null) or (Stat=0))   and PUR_ID=@PUR_ID; ");
            string sql = sb.ToString();

            if (pU_Relations.PUR_SRCode_IsChanged)
            {
                if (string.IsNullOrEmpty(pU_Relations.PUR_SRCode))
                {
                    idb.AddParameter("@PUR_SRCode", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@PUR_SRCode", pU_Relations.PUR_SRCode);
                }
            }
            if (pU_Relations.PUR_SRTpe_IsChanged)
            {
                if (string.IsNullOrEmpty(pU_Relations.PUR_SRTpe))
                {
                    idb.AddParameter("@PUR_SRTpe", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@PUR_SRTpe", pU_Relations.PUR_SRTpe);
                }
            }
            if (pU_Relations.PUR_RCode_IsChanged)
            {
                if (string.IsNullOrEmpty(pU_Relations.PUR_RCode))
                {
                    idb.AddParameter("@PUR_RCode", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@PUR_RCode", pU_Relations.PUR_RCode);
                }
            }
            if (pU_Relations.PUR_RType_IsChanged)
            {
                if (string.IsNullOrEmpty(pU_Relations.PUR_RType))
                {
                    idb.AddParameter("@PUR_RType", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@PUR_RType", pU_Relations.PUR_RType);
                }
            }
            if (pU_Relations.PUR_MCode_IsChanged)
            {
                if (string.IsNullOrEmpty(pU_Relations.PUR_MCode))
                {
                    idb.AddParameter("@PUR_MCode", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@PUR_MCode", pU_Relations.PUR_MCode);
                }
            }
            if (pU_Relations.PUR_SNum_IsChanged)
            {
                if (pU_Relations.PUR_SNum == 0)
                {
                    idb.AddParameter("@PUR_SNum", 0);
                }
                else
                {
                    idb.AddParameter("@PUR_SNum", pU_Relations.PUR_SNum);
                }
            }
            if (pU_Relations.PUR_Num_IsChanged)
            {
                if (pU_Relations.PUR_Num == 0)
                {
                    idb.AddParameter("@PUR_Num", 0);
                }
                else
                {
                    idb.AddParameter("@PUR_Num", pU_Relations.PUR_Num);
                }
            }
            if (pU_Relations.PUR_Date_IsChanged)
            {
                if (pU_Relations.PUR_Date == DateTime.MinValue)
                {
                    idb.AddParameter("@PUR_Date", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@PUR_Date", pU_Relations.PUR_Date);
                }
            }
            if (pU_Relations.PUR_Owner_IsChanged)
            {
                if (string.IsNullOrEmpty(pU_Relations.PUR_Owner))
                {
                    idb.AddParameter("@PUR_Owner", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@PUR_Owner", pU_Relations.PUR_Owner);
                }
            }
            if (pU_Relations.PUR_OwnerCode_IsChanged)
            {
                if (string.IsNullOrEmpty(pU_Relations.PUR_OwnerCode))
                {
                    idb.AddParameter("@PUR_OwnerCode", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@PUR_OwnerCode", pU_Relations.PUR_OwnerCode);
                }
            }
            if (pU_Relations.PUR_Udef1_IsChanged)
            {
                if (string.IsNullOrEmpty(pU_Relations.PUR_Udef1))
                {
                    idb.AddParameter("@PUR_Udef1", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@PUR_Udef1", pU_Relations.PUR_Udef1);
                }
            }
            if (pU_Relations.PUR_Udef2_IsChanged)
            {
                if (string.IsNullOrEmpty(pU_Relations.PUR_Udef2))
                {
                    idb.AddParameter("@PUR_Udef2", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@PUR_Udef2", pU_Relations.PUR_Udef2);
                }
            }
            if (pU_Relations.PUR_Udef3_IsChanged)
            {
                if (string.IsNullOrEmpty(pU_Relations.PUR_Udef3))
                {
                    idb.AddParameter("@PUR_Udef3", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@PUR_Udef3", pU_Relations.PUR_Udef3);
                }
            }
            if (pU_Relations.PUR_Udef4_IsChanged)
            {
                if (string.IsNullOrEmpty(pU_Relations.PUR_Udef4))
                {
                    idb.AddParameter("@PUR_Udef4", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@PUR_Udef4", pU_Relations.PUR_Udef4);
                }
            }
            if (pU_Relations.PUR_Udef5_IsChanged)
            {
                if (string.IsNullOrEmpty(pU_Relations.PUR_Udef5))
                {
                    idb.AddParameter("@PUR_Udef5", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@PUR_Udef5", pU_Relations.PUR_Udef5);
                }
            }
            if (pU_Relations.Stat_IsChanged)
            {
                if (string.IsNullOrEmpty(pU_Relations.Stat))
                {
                    idb.AddParameter("@Stat", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@Stat", pU_Relations.Stat);
                }
            }

            idb.AddParameter("@PUR_ID", pU_Relations.PUR_ID);


            int Re = 0;
            //SQL日志记录
            var RunMethod = System.Reflection.MethodBase.GetCurrentMethod();

            System.Collections.Hashtable param = new System.Collections.Hashtable();
            string Ex = "0";

            foreach (System.Collections.DictionaryEntry item in idb.GetParameters())
            {
                param.Add(item.Key, item.Value);
            }
            try
            {
                Re = idb.ExeCmd(sql);
                Ex = Re.ToString();
            }
            catch (Exception ex)
            {
                Ex = ex.Message;
            }

            SysRunLog.InsertRunSql(sql, param, RunMethod.DeclaringType + "." + RunMethod.Name, Ex);

            return(Re);
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            try
            {
                string[] hashVarsSeq;
                string   hash_string = string.Empty;


                if (string.IsNullOrEmpty(Request.Form["txnid"])) // generating txnid
                {
                    Random rnd     = new Random();
                    string strHash = Generatehash512(rnd.ToString() + DateTime.Now);
                    txnid1 = strHash.ToString().Substring(0, 20);
                }
                else
                {
                    txnid1 = Request.Form["txnid"];
                }
                if (string.IsNullOrEmpty(Request.Form["hash"])) // generating hash value
                {
                    if (
                        string.IsNullOrEmpty(ConfigurationManager.AppSettings["MERCHANT_KEY"]) ||
                        string.IsNullOrEmpty(txnid1) ||
                        string.IsNullOrEmpty(Request.Form["amount"]) ||
                        string.IsNullOrEmpty(Request.Form["firstname"]) ||
                        string.IsNullOrEmpty(Request.Form["email"]) ||
                        string.IsNullOrEmpty(Request.Form["phone"]) ||
                        string.IsNullOrEmpty(Request.Form["productinfo"]) ||
                        string.IsNullOrEmpty(Request.Form["surl"]) ||
                        string.IsNullOrEmpty(Request.Form["furl"]) ||
                        string.IsNullOrEmpty(Request.Form["service_provider"])
                        )
                    {
                        //error

                        frmError.Visible = true;
                        return;
                    }

                    else
                    {
                        frmError.Visible = false;
                        hashVarsSeq      = ConfigurationManager.AppSettings["hashSequence"].Split('|'); // spliting hash sequence from config
                        hash_string      = "";
                        foreach (string hash_var in hashVarsSeq)
                        {
                            if (hash_var == "key")
                            {
                                hash_string = hash_string + ConfigurationManager.AppSettings["MERCHANT_KEY"];
                                hash_string = hash_string + '|';
                            }
                            else if (hash_var == "txnid")
                            {
                                hash_string = hash_string + txnid1;
                                hash_string = hash_string + '|';
                            }
                            else if (hash_var == "amount")
                            {
                                hash_string = hash_string + Convert.ToDecimal(Request.Form[hash_var]).ToString("g29");
                                hash_string = hash_string + '|';
                            }
                            else
                            {
                                hash_string = hash_string + (Request.Form[hash_var] != null ? Request.Form[hash_var] : "");// isset if else
                                hash_string = hash_string + '|';
                            }
                        }

                        hash_string += ConfigurationManager.AppSettings["SALT"];                   // appending SALT

                        hash1   = Generatehash512(hash_string).ToLower();                          //generating hash
                        action1 = ConfigurationManager.AppSettings["PAYU_BASE_URL"] + "/_payment"; // setting URL
                    }
                }

                else if (!string.IsNullOrEmpty(Request.Form["hash"]))
                {
                    hash1   = Request.Form["hash"];
                    action1 = ConfigurationManager.AppSettings["PAYU_BASE_URL"] + "/_payment";
                }



                if (!string.IsNullOrEmpty(hash1))
                {
                    hash.Value  = hash1;
                    txnid.Value = txnid1;

                    System.Collections.Hashtable data = new System.Collections.Hashtable(); // adding values in gash table for data post
                    data.Add("hash", hash.Value);
                    data.Add("txnid", txnid.Value);
                    data.Add("key", key.Value);
                    string AmountForm = Convert.ToDecimal(amount.Text.Trim()).ToString("g29");// eliminating trailing zeros
                    amount.Text = AmountForm;
                    data.Add("amount", AmountForm);
                    data.Add("firstname", firstname.Text.Trim());
                    data.Add("email", email.Text.Trim());
                    data.Add("phone", phone.Text.Trim());
                    data.Add("productinfo", productinfo.Text.Trim());
                    data.Add("surl", surl.Text.Trim());
                    data.Add("furl", furl.Text.Trim());
                    data.Add("lastname", lastname.Text.Trim());
                    data.Add("curl", curl.Text.Trim());
                    data.Add("address1", address1.Text.Trim());
                    data.Add("address2", address2.Text.Trim());
                    data.Add("city", city.Text.Trim());
                    data.Add("state", state.Text.Trim());
                    data.Add("country", country.Text.Trim());
                    data.Add("zipcode", zipcode.Text.Trim());
                    data.Add("udf1", udf1.Text.Trim());
                    data.Add("udf2", udf2.Text.Trim());
                    data.Add("udf3", udf3.Text.Trim());
                    data.Add("udf4", udf4.Text.Trim());
                    data.Add("udf5", udf5.Text.Trim());
                    data.Add("pg", pg.Text.Trim());
                    data.Add("service_provider", service_provider.Text.Trim());


                    string strForm = PreparePOSTForm(action1, data);
                    Page.Controls.Add(new LiteralControl(strForm));
                }

                else
                {
                    //no hash
                }
            }

            catch (Exception ex)
            {
                Response.Write("<span style='color:red'>" + ex.Message + "</span>");
            }
        }
        public override bool Obtain()
        {
            lock (this)
            {
                if (IsLocked())
                {
                    // Our instance is already locked:
                    return(false);
                }

                // Ensure that lockDir exists and is a directory.
                bool tmpBool;
                if (System.IO.File.Exists(lockDir.FullName))
                {
                    tmpBool = true;
                }
                else
                {
                    tmpBool = System.IO.Directory.Exists(lockDir.FullName);
                }
                if (!tmpBool)
                {
                    try
                    {
                        System.IO.Directory.CreateDirectory(lockDir.FullName);
                    }
                    catch
                    {
                        throw new System.IO.IOException("Cannot create directory: " + lockDir.FullName);
                    }
                }
                else
                {
                    try
                    {
                        System.IO.Directory.Exists(lockDir.FullName);
                    }
                    catch
                    {
                        throw new System.IO.IOException("Found regular file where directory expected: " + lockDir.FullName);
                    }
                }

                System.String canonicalPath = path.FullName;

                bool markedHeld = false;

                try
                {
                    // Make sure nobody else in-process has this lock held
                    // already, and, mark it held if not:

                    lock (LOCK_HELD)
                    {
                        if (LOCK_HELD.Contains(canonicalPath))
                        {
                            // Someone else in this JVM already has the lock:
                            return(false);
                        }
                        else
                        {
                            // This "reserves" the fact that we are the one
                            // thread trying to obtain this lock, so we own
                            // the only instance of a channel against this
                            // file:
                            LOCK_HELD.Add(canonicalPath, canonicalPath);
                            markedHeld = true;
                        }
                    }

                    try
                    {
                        f = new System.IO.FileStream(path.FullName, System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.ReadWrite);
                    }
                    catch (System.IO.IOException e)
                    {
                        // On Windows, we can get intermittant "Access
                        // Denied" here.  So, we treat this as failure to
                        // acquire the lock, but, store the reason in case
                        // there is in fact a real error case.
                        failureReason = e;
                        f             = null;
                    }

                    if (f != null)
                    {
                        try
                        {
                            channel      = f;                        // f.getChannel();     // {{Aroush-2.1}}
                            lock_Renamed = false;
                            try
                            {
                                channel.Lock(0, channel.Length);
                                lock_Renamed = true;
                            }
                            catch (System.IO.IOException e)
                            {
                                // At least on OS X, we will sometimes get an
                                // intermittant "Permission Denied" IOException,
                                // which seems to simply mean "you failed to get
                                // the lock".  But other IOExceptions could be
                                // "permanent" (eg, locking is not supported via
                                // the filesystem).  So, we record the failure
                                // reason here; the timeout obtain (usually the
                                // one calling us) will use this as "root cause"
                                // if it fails to get the lock.
                                failureReason = e;
                            }
                            finally
                            {
                                if (lock_Renamed == false)
                                {
                                    try
                                    {
                                        channel.Close();
                                    }
                                    finally
                                    {
                                        channel = null;
                                    }
                                }
                            }
                        }
                        finally
                        {
                            if (channel == null)
                            {
                                try
                                {
                                    f.Close();
                                }
                                finally
                                {
                                    f = null;
                                }
                            }
                        }
                    }
                }
                finally
                {
                    if (markedHeld && !IsLocked())
                    {
                        lock (LOCK_HELD)
                        {
                            if (LOCK_HELD.Contains(canonicalPath))
                            {
                                LOCK_HELD.Remove(canonicalPath);
                            }
                        }
                    }
                }
                return(IsLocked());
            }
        }
Exemplo n.º 47
0
        /// <summary>
        /// 更新生产配比下达信息 TC_DComp对象(即:一条记录
        /// </summary>
        public int Update(TC_DComp tC_DComp)
        {
            StringBuilder sbParameter = new StringBuilder();
            StringBuilder sb          = new StringBuilder();

            sb.Append(@"UPDATE       TC_DComp       SET ");
            if (tC_DComp.TCD_Code_IsChanged)
            {
                sbParameter.Append("TCD_Code=@TCD_Code, ");
            }
            if (tC_DComp.TCD_PCode_IsChanged)
            {
                sbParameter.Append("TCD_PCode=@TCD_PCode, ");
            }
            if (tC_DComp.TCD_PLine_IsChanged)
            {
                sbParameter.Append("TCD_PLine=@TCD_PLine, ");
            }
            if (tC_DComp.TCD_PPlan_IsChanged)
            {
                sbParameter.Append("TCD_PPlan=@TCD_PPlan, ");
            }
            if (tC_DComp.TCD_Remark_IsChanged)
            {
                sbParameter.Append("TCD_Remark=@TCD_Remark, ");
            }
            if (tC_DComp.TCD_UDef1_IsChanged)
            {
                sbParameter.Append("TCD_UDef1=@TCD_UDef1, ");
            }
            if (tC_DComp.TCD_UDef2_IsChanged)
            {
                sbParameter.Append("TCD_UDef2=@TCD_UDef2, ");
            }
            if (tC_DComp.TCD_UDef3_IsChanged)
            {
                sbParameter.Append("TCD_UDef3=@TCD_UDef3, ");
            }
            if (tC_DComp.TCD_UDef4_IsChanged)
            {
                sbParameter.Append("TCD_UDef4=@TCD_UDef4, ");
            }
            if (tC_DComp.TCD_UDef5_IsChanged)
            {
                sbParameter.Append("TCD_UDef5=@TCD_UDef5, ");
            }
            if (tC_DComp.Stat_IsChanged)
            {
                sbParameter.Append("Stat=@Stat, ");
            }
            if (tC_DComp.CreateDate_IsChanged)
            {
                sbParameter.Append("CreateDate=@CreateDate, ");
            }
            if (tC_DComp.UpdateDate_IsChanged)
            {
                sbParameter.Append("UpdateDate=@UpdateDate, ");
            }
            if (tC_DComp.DeleteDate_IsChanged)
            {
                sbParameter.Append("DeleteDate=@DeleteDate ");
            }
            sb.Append(sbParameter.ToString().Trim().TrimEnd(','));
            sb.Append(" WHERE 1=1 AND ((Stat is null) or (Stat=0))   and TCD_ID=@TCD_ID; ");
            string sql = sb.ToString();

            if (tC_DComp.TCD_Code_IsChanged)
            {
                if (string.IsNullOrEmpty(tC_DComp.TCD_Code))
                {
                    idb.AddParameter("@TCD_Code", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@TCD_Code", tC_DComp.TCD_Code);
                }
            }
            if (tC_DComp.TCD_PCode_IsChanged)
            {
                if (string.IsNullOrEmpty(tC_DComp.TCD_PCode))
                {
                    idb.AddParameter("@TCD_PCode", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@TCD_PCode", tC_DComp.TCD_PCode);
                }
            }
            if (tC_DComp.TCD_PLine_IsChanged)
            {
                if (string.IsNullOrEmpty(tC_DComp.TCD_PLine))
                {
                    idb.AddParameter("@TCD_PLine", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@TCD_PLine", tC_DComp.TCD_PLine);
                }
            }
            if (tC_DComp.TCD_PPlan_IsChanged)
            {
                if (string.IsNullOrEmpty(tC_DComp.TCD_PPlan))
                {
                    idb.AddParameter("@TCD_PPlan", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@TCD_PPlan", tC_DComp.TCD_PPlan);
                }
            }
            if (tC_DComp.TCD_Remark_IsChanged)
            {
                if (string.IsNullOrEmpty(tC_DComp.TCD_Remark))
                {
                    idb.AddParameter("@TCD_Remark", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@TCD_Remark", tC_DComp.TCD_Remark);
                }
            }
            if (tC_DComp.TCD_UDef1_IsChanged)
            {
                if (string.IsNullOrEmpty(tC_DComp.TCD_UDef1))
                {
                    idb.AddParameter("@TCD_UDef1", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@TCD_UDef1", tC_DComp.TCD_UDef1);
                }
            }
            if (tC_DComp.TCD_UDef2_IsChanged)
            {
                if (string.IsNullOrEmpty(tC_DComp.TCD_UDef2))
                {
                    idb.AddParameter("@TCD_UDef2", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@TCD_UDef2", tC_DComp.TCD_UDef2);
                }
            }
            if (tC_DComp.TCD_UDef3_IsChanged)
            {
                if (string.IsNullOrEmpty(tC_DComp.TCD_UDef3))
                {
                    idb.AddParameter("@TCD_UDef3", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@TCD_UDef3", tC_DComp.TCD_UDef3);
                }
            }
            if (tC_DComp.TCD_UDef4_IsChanged)
            {
                if (string.IsNullOrEmpty(tC_DComp.TCD_UDef4))
                {
                    idb.AddParameter("@TCD_UDef4", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@TCD_UDef4", tC_DComp.TCD_UDef4);
                }
            }
            if (tC_DComp.TCD_UDef5_IsChanged)
            {
                if (string.IsNullOrEmpty(tC_DComp.TCD_UDef5))
                {
                    idb.AddParameter("@TCD_UDef5", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@TCD_UDef5", tC_DComp.TCD_UDef5);
                }
            }
            if (tC_DComp.Stat_IsChanged)
            {
                if (tC_DComp.Stat == 0)
                {
                    idb.AddParameter("@Stat", 0);
                }
                else
                {
                    idb.AddParameter("@Stat", tC_DComp.Stat);
                }
            }
            if (tC_DComp.CreateDate_IsChanged)
            {
                if (tC_DComp.CreateDate == DateTime.MinValue)
                {
                    idb.AddParameter("@CreateDate", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@CreateDate", tC_DComp.CreateDate);
                }
            }
            if (tC_DComp.UpdateDate_IsChanged)
            {
                if (tC_DComp.UpdateDate == DateTime.MinValue)
                {
                    idb.AddParameter("@UpdateDate", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@UpdateDate", tC_DComp.UpdateDate);
                }
            }
            if (tC_DComp.DeleteDate_IsChanged)
            {
                if (tC_DComp.DeleteDate == DateTime.MinValue)
                {
                    idb.AddParameter("@DeleteDate", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@DeleteDate", tC_DComp.DeleteDate);
                }
            }

            idb.AddParameter("@TCD_ID", tC_DComp.TCD_ID);


            int Re = 0;
            //SQL日志记录
            var RunMethod = System.Reflection.MethodBase.GetCurrentMethod();

            System.Collections.Hashtable param = new System.Collections.Hashtable();
            string Ex = "0";

            foreach (System.Collections.DictionaryEntry item in idb.GetParameters())
            {
                param.Add(item.Key, item.Value);
            }
            try
            {
                Re = idb.ExeCmd(sql);
                Ex = Re.ToString();
            }
            catch (Exception ex)
            {
                Ex = ex.Message;
            }

            SysRunLog.InsertRunSql(sql, param, RunMethod.DeclaringType + "." + RunMethod.Name, Ex);

            return(Re);
        }
Exemplo n.º 48
0
 static Error()
 {
     // See XEP-86.  (http://www.xmpp.org/extensions/xep-0086.html)
     s_errors.Add(BAD_REQUEST, new CodeType(400, ErrorType.modify));
     s_errors.Add(CONFLICT, new CodeType(409, ErrorType.cancel));
     s_errors.Add(FEATURE_NOT_IMPLEMENTED, new CodeType(501, ErrorType.cancel));
     s_errors.Add(FORBIDDEN, new CodeType(403, ErrorType.auth));
     s_errors.Add(GONE, new CodeType(302, ErrorType.modify));
     s_errors.Add(INTERNAL_SERVER_ERROR, new CodeType(500, ErrorType.wait));
     s_errors.Add(ITEM_NOT_FOUND, new CodeType(404, ErrorType.cancel));
     s_errors.Add(JID_MALFORMED, new CodeType(400, ErrorType.modify));
     s_errors.Add(NOT_ACCEPTABLE, new CodeType(406, ErrorType.modify));
     s_errors.Add(NOT_ALLOWED, new CodeType(405, ErrorType.cancel));
     s_errors.Add(NOT_AUTHORIZED, new CodeType(401, ErrorType.auth));
     s_errors.Add(PAYMENT_REQUIRED, new CodeType(402, ErrorType.auth));
     s_errors.Add(RECIPIENT_UNAVAILABLE, new CodeType(404, ErrorType.wait));
     s_errors.Add(REDIRECT, new CodeType(302, ErrorType.modify));
     s_errors.Add(REGISTRATION_REQUIRED, new CodeType(407, ErrorType.auth));
     s_errors.Add(REMOTE_SERVER_NOT_FOUND, new CodeType(404, ErrorType.cancel));
     s_errors.Add(REMOTE_SERVER_TIMEOUT, new CodeType(504, ErrorType.wait));
     s_errors.Add(RESOURCE_CONSTRAINT, new CodeType(500, ErrorType.wait));
     s_errors.Add(SERVICE_UNAVAILABLE, new CodeType(503, ErrorType.cancel));
     s_errors.Add(SUBSCRIPTION_REQUIRED, new CodeType(407, ErrorType.auth));
     s_errors.Add(UNDEFINED_CONDITION, new CodeType(500, ErrorType.NONE));
     s_errors.Add(UNEXPECTED_REQUEST, new CodeType(400, ErrorType.wait));
 }
Exemplo n.º 49
0
        public void Add(Model.manager model, Model.Shop model_shop)
        {
            StringBuilder strSql = new StringBuilder();

            //strSql.Append(" declare @DealerID int ");
            //strSql.Append(" insert into Dealer(DealerCode,DealerName,CreateTime)values(@DealerCode,@DealerName,getdate())");
            //strSql.Append(";set @DealerID= @@IDENTITY");

            strSql.Append(" declare @ShopID int ");
            strSql.Append(" insert into Shop(ShopCode,ShopName,ProvinceCode,CityCode,TownCode,DetailAddress,CreateTime,Postcode)values(@ShopCode,@ShopName,@ProvinceCode,@CityCode,@TownCode,@DetailAddress,getdate(),@Postcode)");
            strSql.Append(";set @ShopID= @@IDENTITY ");

            strSql.Append(" insert into " + databaseprefix + "manager(");
            strSql.Append("role_id,role_type,user_name,password,salt,real_name,telephone,email,is_lock,add_time,ShopID)");
            strSql.Append(" values (");
            strSql.Append("@role_id,@role_type,@user_name,@password,@salt,@real_name,@telephone,@email,@is_lock,@add_time,@ShopID)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@role_id",       SqlDbType.Int,         4),
                new SqlParameter("@role_type",     SqlDbType.Int,         4),
                new SqlParameter("@user_name",     SqlDbType.NVarChar,  100),
                new SqlParameter("@password",      SqlDbType.NVarChar,  100),
                new SqlParameter("@salt",          SqlDbType.NVarChar,   20),
                new SqlParameter("@real_name",     SqlDbType.NVarChar,   50),
                new SqlParameter("@telephone",     SqlDbType.NVarChar,   30),
                new SqlParameter("@email",         SqlDbType.NVarChar,   30),
                new SqlParameter("@is_lock",       SqlDbType.Int,         4),
                new SqlParameter("@add_time",      SqlDbType.DateTime),

                //new SqlParameter("@DealerCode", SqlDbType.VarChar,50),
                //new SqlParameter("@DealerName", SqlDbType.NVarChar,150),

                new SqlParameter("@ShopCode",      SqlDbType.VarChar,    50),
                new SqlParameter("@ShopName",      SqlDbType.NVarChar,  100),
                new SqlParameter("@ProvinceCode",  SqlDbType.VarChar,     6),
                new SqlParameter("@CityCode",      SqlDbType.VarChar,     6),
                new SqlParameter("@TownCode",      SqlDbType.VarChar,     6),
                new SqlParameter("@DetailAddress", SqlDbType.NVarChar,  150),
                new SqlParameter("@Postcode",      SqlDbType.VarChar, 10)
            };
            parameters[0].Value = model.role_id;
            parameters[1].Value = model.role_type;
            parameters[2].Value = model.user_name;
            parameters[3].Value = model.password;
            parameters[4].Value = model.salt;
            parameters[5].Value = model.real_name;
            parameters[6].Value = model.telephone;
            parameters[7].Value = model.email;
            parameters[8].Value = model.is_lock;
            parameters[9].Value = model.add_time;

            //parameters[10].Value = model_dealer.DealerCode;
            //parameters[11].Value = model_dealer.DealerName;

            parameters[10].Value = model_shop.ShopCode;
            parameters[11].Value = model_shop.ShopName;
            parameters[12].Value = model_shop.ProvinceCode;
            parameters[13].Value = model_shop.CityCode;
            parameters[14].Value = model_shop.TownCode;
            parameters[15].Value = model_shop.DetailAddress;
            parameters[16].Value = model_shop.Postcode;
            System.Collections.Hashtable ht = new System.Collections.Hashtable();
            ht.Add(strSql, parameters);

            try
            {
                DbHelperSQL.ExecuteSqlTran(ht);
            }
            catch
            {
                throw;
            }
        }
Exemplo n.º 50
0
 private void initialize()
 {
     caseSensitiveLiterals = true;
     setCaseSensitive(true);
     literals = new Hashtable(null, Comparer.Default);
     literals.Add("otherwise", 50);
     literals.Add("retry", 59);
     literals.Add("internal", 42);
     literals.Add("failure", 34);
     literals.Add("class", 27);
     literals.Add("private", 56);
     literals.Add("def", 29);
     literals.Add("if", 44);
     literals.Add("pass", 51);
     literals.Add("ensure", 31);
     literals.Add("unless", 68);
     literals.Add("self", 61);
     literals.Add("when", 72);
     literals.Add("success", 64);
     literals.Add("in", 45);
     literals.Add("enum", 32);
     literals.Add("continue", 26);
     literals.Add("from", 36);
     literals.Add("given", 40);
     literals.Add("while", 73);
     literals.Add("as", 24);
     literals.Add("not", 47);
     literals.Add("using", 69);
     literals.Add("false", 38);
     literals.Add("namespace", 52);
     literals.Add("super", 62);
     literals.Add("protected", 55);
     literals.Add("null", 48);
     literals.Add("or", 49);
     literals.Add("constructor", 28);
     literals.Add("true", 67);
     literals.Add("void", 71);
     literals.Add("interface", 41);
     literals.Add("kindof", 46);
     literals.Add("raise", 57);
     literals.Add("break", 25);
     literals.Add("final", 35);
     literals.Add("for", 37);
     literals.Add("try", 65);
     literals.Add("except", 33);
     literals.Add("yield", 74);
     literals.Add("else", 30);
     literals.Add("return", 58);
     literals.Add("public", 54);
     literals.Add("static", 63);
     literals.Add("transient", 66);
     literals.Add("is", 43);
     literals.Add("and", 23);
     literals.Add("property", 53);
     literals.Add("until", 70);
     literals.Add("set", 60);
     literals.Add("get", 39);
 }
Exemplo n.º 51
0
        }//init_Code39

        private void init_ExtendedCode39()
        {
            ExtC39_Translation.Clear();
            ExtC39_Translation.Add(Convert.ToChar(0).ToString(), "%U");
            ExtC39_Translation.Add(Convert.ToChar(1).ToString(), "$A");
            ExtC39_Translation.Add(Convert.ToChar(2).ToString(), "$B");
            ExtC39_Translation.Add(Convert.ToChar(3).ToString(), "$C");
            ExtC39_Translation.Add(Convert.ToChar(4).ToString(), "$D");
            ExtC39_Translation.Add(Convert.ToChar(5).ToString(), "$E");
            ExtC39_Translation.Add(Convert.ToChar(6).ToString(), "$F");
            ExtC39_Translation.Add(Convert.ToChar(7).ToString(), "$G");
            ExtC39_Translation.Add(Convert.ToChar(8).ToString(), "$H");
            ExtC39_Translation.Add(Convert.ToChar(9).ToString(), "$I");
            ExtC39_Translation.Add(Convert.ToChar(10).ToString(), "$J");
            ExtC39_Translation.Add(Convert.ToChar(11).ToString(), "$K");
            ExtC39_Translation.Add(Convert.ToChar(12).ToString(), "$L");
            ExtC39_Translation.Add(Convert.ToChar(13).ToString(), "$M");
            ExtC39_Translation.Add(Convert.ToChar(14).ToString(), "$N");
            ExtC39_Translation.Add(Convert.ToChar(15).ToString(), "$O");
            ExtC39_Translation.Add(Convert.ToChar(16).ToString(), "$P");
            ExtC39_Translation.Add(Convert.ToChar(17).ToString(), "$Q");
            ExtC39_Translation.Add(Convert.ToChar(18).ToString(), "$R");
            ExtC39_Translation.Add(Convert.ToChar(19).ToString(), "$S");
            ExtC39_Translation.Add(Convert.ToChar(20).ToString(), "$T");
            ExtC39_Translation.Add(Convert.ToChar(21).ToString(), "$U");
            ExtC39_Translation.Add(Convert.ToChar(22).ToString(), "$V");
            ExtC39_Translation.Add(Convert.ToChar(23).ToString(), "$W");
            ExtC39_Translation.Add(Convert.ToChar(24).ToString(), "$X");
            ExtC39_Translation.Add(Convert.ToChar(25).ToString(), "$Y");
            ExtC39_Translation.Add(Convert.ToChar(26).ToString(), "$Z");
            ExtC39_Translation.Add(Convert.ToChar(27).ToString(), "%A");
            ExtC39_Translation.Add(Convert.ToChar(28).ToString(), "%B");
            ExtC39_Translation.Add(Convert.ToChar(29).ToString(), "%C");
            ExtC39_Translation.Add(Convert.ToChar(30).ToString(), "%D");
            ExtC39_Translation.Add(Convert.ToChar(31).ToString(), "%E");
            ExtC39_Translation.Add("!", "/A");
            ExtC39_Translation.Add("\"", "/B");
            ExtC39_Translation.Add("#", "/C");
            ExtC39_Translation.Add("$", "/D");
            ExtC39_Translation.Add("%", "/E");
            ExtC39_Translation.Add("&", "/F");
            ExtC39_Translation.Add("'", "/G");
            ExtC39_Translation.Add("(", "/H");
            ExtC39_Translation.Add(")", "/I");
            ExtC39_Translation.Add("*", "/J");
            ExtC39_Translation.Add("+", "/K");
            ExtC39_Translation.Add(",", "/L");
            ExtC39_Translation.Add("/", "/O");
            ExtC39_Translation.Add(":", "/Z");
            ExtC39_Translation.Add(";", "%F");
            ExtC39_Translation.Add("<", "%G");
            ExtC39_Translation.Add("=", "%H");
            ExtC39_Translation.Add(">", "%I");
            ExtC39_Translation.Add("?", "%J");
            ExtC39_Translation.Add("[", "%K");
            ExtC39_Translation.Add("\\", "%L");
            ExtC39_Translation.Add("]", "%M");
            ExtC39_Translation.Add("^", "%N");
            ExtC39_Translation.Add("_", "%O");
            ExtC39_Translation.Add("{", "%P");
            ExtC39_Translation.Add("|", "%Q");
            ExtC39_Translation.Add("}", "%R");
            ExtC39_Translation.Add("~", "%S");
            ExtC39_Translation.Add("`", "%W");
            ExtC39_Translation.Add("@", "%V");
            ExtC39_Translation.Add("a", "+A");
            ExtC39_Translation.Add("b", "+B");
            ExtC39_Translation.Add("c", "+C");
            ExtC39_Translation.Add("d", "+D");
            ExtC39_Translation.Add("e", "+E");
            ExtC39_Translation.Add("f", "+F");
            ExtC39_Translation.Add("g", "+G");
            ExtC39_Translation.Add("h", "+H");
            ExtC39_Translation.Add("i", "+I");
            ExtC39_Translation.Add("j", "+J");
            ExtC39_Translation.Add("k", "+K");
            ExtC39_Translation.Add("l", "+L");
            ExtC39_Translation.Add("m", "+M");
            ExtC39_Translation.Add("n", "+N");
            ExtC39_Translation.Add("o", "+O");
            ExtC39_Translation.Add("p", "+P");
            ExtC39_Translation.Add("q", "+Q");
            ExtC39_Translation.Add("r", "+R");
            ExtC39_Translation.Add("s", "+S");
            ExtC39_Translation.Add("t", "+T");
            ExtC39_Translation.Add("u", "+U");
            ExtC39_Translation.Add("v", "+V");
            ExtC39_Translation.Add("w", "+W");
            ExtC39_Translation.Add("x", "+X");
            ExtC39_Translation.Add("y", "+Y");
            ExtC39_Translation.Add("z", "+Z");
            ExtC39_Translation.Add(Convert.ToChar(127).ToString(), "%T"); //also %X, %Y, %Z
        }
Exemplo n.º 52
0
        public Node Load(string runmode, string config)
        {
            //a table for replacing #something# with a stored value (eg #exe# -> C:\docs\)
            System.Collections.Hashtable replacements = new System.Collections.Hashtable();
            replacements.Add("exe", EH.Instance.ApplicationDirectory);

            Node node = Node.FromTabbed(config);

            Node allNode = node["All"];

            node = node[runmode];
            if (node == null)
            {
                node = new Node();
            }

            if (allNode != null)
            {
                node.Merge(allNode);
            }

            Node n = node;

            while (true)
            {
                n = n.NextSpecial;
                if (n == null)
                {
                    break;
                }
                if (n.Name.IndexOf("#") >= 0)
                {
                    System.Text.RegularExpressions.Match m = System.Text.RegularExpressions.Regex.Match(n.Name, @"\#\w+\#");
                    string sKey   = m.Value.Substring(1, m.Value.Length - 2);
                    string sValue = (string)replacements[sKey];
                    if (sValue != null)
                    {
                        string sNewName = System.Text.RegularExpressions.Regex.Replace(n.Name, @"\#\w+\#", sValue);
                        n.Name = sNewName;
                    }
                }
                if (n.Name.IndexOf(@"..\") >= 0)
                {
                    int    nFirst = n.Name.IndexOf(@"..\");
                    string sPath  = n.Name.Remove(0, nFirst);

                    System.Text.RegularExpressions.MatchCollection ms = System.Text.RegularExpressions.Regex.Matches(
                        sPath, @"[.][.]\\");

                    sPath = sPath.Replace(@"..\", "");
                    System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(sPath);
                    for (int i = 0; i < ms.Count; i++)
                    {
                        di = di.Parent;
                    }

                    n.Name = n.Name.Substring(0, nFirst) + di.FullName;
                }

                if (n.Name.IndexOf("=") >= 0)
                {
                    string[] sKV = n.Name.Split("=".ToCharArray());
                    replacements[sKV[0]] = sKV[1];
                }
            }

//			string sTabbed = node.ToTabbed();
//			sTabbed = sTabbed.Replace("\n", "\r\n");
//			System.IO.StreamWriter wr = new System.IO.StreamWriter("Test.txt");
//			wr.Write(sTabbed);
//			wr.Flush();
//			wr.Close();

            return(node);
        }
Exemplo n.º 53
0
        /// <summary>
        /// 更新印章使用记录 GM_SealRecord对象(即:一条记录
        /// </summary>
        public int Update(GM_SealRecord gM_SealRecord)
        {
            StringBuilder sbParameter = new StringBuilder();
            StringBuilder sb          = new StringBuilder();

            sb.Append(@"UPDATE       GM_SealRecord       SET ");
            if (gM_SealRecord.GMSR_Code_IsChanged)
            {
                sbParameter.Append("GMSR_Code=@GMSR_Code, ");
            }
            if (gM_SealRecord.GMSR_SCode_IsChanged)
            {
                sbParameter.Append("GMSR_SCode=@GMSR_SCode, ");
            }
            if (gM_SealRecord.GMSR_SName_IsChanged)
            {
                sbParameter.Append("GMSR_SName=@GMSR_SName, ");
            }
            if (gM_SealRecord.GMSR_Date_IsChanged)
            {
                sbParameter.Append("GMSR_Date=@GMSR_Date, ");
            }
            if (gM_SealRecord.GMSR_Function_IsChanged)
            {
                sbParameter.Append("GMSR_Function=@GMSR_Function, ");
            }
            if (gM_SealRecord.GMSR_Copy_IsChanged)
            {
                sbParameter.Append("GMSR_Copy=@GMSR_Copy, ");
            }
            if (gM_SealRecord.GMSR_Employee_IsChanged)
            {
                sbParameter.Append("GMSR_Employee=@GMSR_Employee, ");
            }
            if (gM_SealRecord.GMSR_Approve_IsChanged)
            {
                sbParameter.Append("GMSR_Approve=@GMSR_Approve, ");
            }
            if (gM_SealRecord.GMSR_RDate_IsChanged)
            {
                sbParameter.Append("GMSR_RDate=@GMSR_RDate, ");
            }
            if (gM_SealRecord.GMSR_UCat_IsChanged)
            {
                sbParameter.Append("GMSR_UCat=@GMSR_UCat, ");
            }
            if (gM_SealRecord.GMSR_Company_IsChanged)
            {
                sbParameter.Append("GMSR_Company=@GMSR_Company, ");
            }
            if (gM_SealRecord.GMSR_Dept_IsChanged)
            {
                sbParameter.Append("GMSR_Dept=@GMSR_Dept, ");
            }
            if (gM_SealRecord.GMSR_Bak_IsChanged)
            {
                sbParameter.Append("GMSR_Bak=@GMSR_Bak, ");
            }
            if (gM_SealRecord.Stat_IsChanged)
            {
                sbParameter.Append("Stat=@Stat, ");
            }
            if (gM_SealRecord.CreateDate_IsChanged)
            {
                sbParameter.Append("CreateDate=@CreateDate, ");
            }
            if (gM_SealRecord.UpdateDate_IsChanged)
            {
                sbParameter.Append("UpdateDate=@UpdateDate, ");
            }
            if (gM_SealRecord.DeleteDate_IsChanged)
            {
                sbParameter.Append("DeleteDate=@DeleteDate ");
            }
            sb.Append(sbParameter.ToString().Trim().TrimEnd(','));
            sb.Append(" WHERE 1=1 AND ((Stat is null) or (Stat=0))   and GMSR_ID=@GMSR_ID; ");
            string sql = sb.ToString();

            if (gM_SealRecord.GMSR_Code_IsChanged)
            {
                if (string.IsNullOrEmpty(gM_SealRecord.GMSR_Code))
                {
                    idb.AddParameter("@GMSR_Code", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@GMSR_Code", gM_SealRecord.GMSR_Code);
                }
            }
            if (gM_SealRecord.GMSR_SCode_IsChanged)
            {
                if (string.IsNullOrEmpty(gM_SealRecord.GMSR_SCode))
                {
                    idb.AddParameter("@GMSR_SCode", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@GMSR_SCode", gM_SealRecord.GMSR_SCode);
                }
            }
            if (gM_SealRecord.GMSR_SName_IsChanged)
            {
                if (string.IsNullOrEmpty(gM_SealRecord.GMSR_SName))
                {
                    idb.AddParameter("@GMSR_SName", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@GMSR_SName", gM_SealRecord.GMSR_SName);
                }
            }
            if (gM_SealRecord.GMSR_Date_IsChanged)
            {
                if (gM_SealRecord.GMSR_Date == DateTime.MinValue)
                {
                    idb.AddParameter("@GMSR_Date", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@GMSR_Date", gM_SealRecord.GMSR_Date);
                }
            }
            if (gM_SealRecord.GMSR_Function_IsChanged)
            {
                if (string.IsNullOrEmpty(gM_SealRecord.GMSR_Function))
                {
                    idb.AddParameter("@GMSR_Function", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@GMSR_Function", gM_SealRecord.GMSR_Function);
                }
            }
            if (gM_SealRecord.GMSR_Copy_IsChanged)
            {
                if (gM_SealRecord.GMSR_Copy == 0)
                {
                    idb.AddParameter("@GMSR_Copy", 0);
                }
                else
                {
                    idb.AddParameter("@GMSR_Copy", gM_SealRecord.GMSR_Copy);
                }
            }
            if (gM_SealRecord.GMSR_Employee_IsChanged)
            {
                if (string.IsNullOrEmpty(gM_SealRecord.GMSR_Employee))
                {
                    idb.AddParameter("@GMSR_Employee", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@GMSR_Employee", gM_SealRecord.GMSR_Employee);
                }
            }
            if (gM_SealRecord.GMSR_Approve_IsChanged)
            {
                if (string.IsNullOrEmpty(gM_SealRecord.GMSR_Approve))
                {
                    idb.AddParameter("@GMSR_Approve", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@GMSR_Approve", gM_SealRecord.GMSR_Approve);
                }
            }
            if (gM_SealRecord.GMSR_RDate_IsChanged)
            {
                if (gM_SealRecord.GMSR_RDate == DateTime.MinValue)
                {
                    idb.AddParameter("@GMSR_RDate", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@GMSR_RDate", gM_SealRecord.GMSR_RDate);
                }
            }
            if (gM_SealRecord.GMSR_UCat_IsChanged)
            {
                if (string.IsNullOrEmpty(gM_SealRecord.GMSR_UCat))
                {
                    idb.AddParameter("@GMSR_UCat", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@GMSR_UCat", gM_SealRecord.GMSR_UCat);
                }
            }
            if (gM_SealRecord.GMSR_Company_IsChanged)
            {
                if (string.IsNullOrEmpty(gM_SealRecord.GMSR_Company))
                {
                    idb.AddParameter("@GMSR_Company", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@GMSR_Company", gM_SealRecord.GMSR_Company);
                }
            }
            if (gM_SealRecord.GMSR_Dept_IsChanged)
            {
                if (string.IsNullOrEmpty(gM_SealRecord.GMSR_Dept))
                {
                    idb.AddParameter("@GMSR_Dept", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@GMSR_Dept", gM_SealRecord.GMSR_Dept);
                }
            }
            if (gM_SealRecord.GMSR_Bak_IsChanged)
            {
                if (string.IsNullOrEmpty(gM_SealRecord.GMSR_Bak))
                {
                    idb.AddParameter("@GMSR_Bak", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@GMSR_Bak", gM_SealRecord.GMSR_Bak);
                }
            }
            if (gM_SealRecord.Stat_IsChanged)
            {
                if (gM_SealRecord.Stat == 0)
                {
                    idb.AddParameter("@Stat", 0);
                }
                else
                {
                    idb.AddParameter("@Stat", gM_SealRecord.Stat);
                }
            }
            if (gM_SealRecord.CreateDate_IsChanged)
            {
                if (gM_SealRecord.CreateDate == DateTime.MinValue)
                {
                    idb.AddParameter("@CreateDate", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@CreateDate", gM_SealRecord.CreateDate);
                }
            }
            if (gM_SealRecord.UpdateDate_IsChanged)
            {
                if (gM_SealRecord.UpdateDate == DateTime.MinValue)
                {
                    idb.AddParameter("@UpdateDate", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@UpdateDate", gM_SealRecord.UpdateDate);
                }
            }
            if (gM_SealRecord.DeleteDate_IsChanged)
            {
                if (gM_SealRecord.DeleteDate == DateTime.MinValue)
                {
                    idb.AddParameter("@DeleteDate", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@DeleteDate", gM_SealRecord.DeleteDate);
                }
            }

            idb.AddParameter("@GMSR_ID", gM_SealRecord.GMSR_ID);


            int Re = 0;
            //SQL日志记录
            var RunMethod = System.Reflection.MethodBase.GetCurrentMethod();

            System.Collections.Hashtable param = new System.Collections.Hashtable();
            string Ex = "0";

            foreach (System.Collections.DictionaryEntry item in idb.GetParameters())
            {
                param.Add(item.Key, item.Value);
            }
            try
            {
                Re = idb.ExeCmd(sql);
                Ex = Re.ToString();
            }
            catch (Exception ex)
            {
                Ex = ex.Message;
            }

            SysRunLog.InsertRunSql(sql, param, RunMethod.DeclaringType + "." + RunMethod.Name, Ex);

            return(Re);
        }
Exemplo n.º 54
0
        /// <summary>
        /// 添加语音播报 PCD_Voice对象(即:一条记录)
        /// </summary>
        public int Add(PCD_Voice pCD_Voice)
        {
            string sql = "INSERT INTO PCD_Voice (PCDV_Code,PCDV_Type,PCDV_OType,PCDV_Object,PCDV_Content,PCDV_Date,PCDV_ODate,PCDV_FType,PCDV_FCode,Stat,CreateDate,UpdateDate,DeleteDate) VALUES (@PCDV_Code,@PCDV_Type,@PCDV_OType,@PCDV_Object,@PCDV_Content,@PCDV_Date,@PCDV_ODate,@PCDV_FType,@PCDV_FCode,@Stat,@CreateDate,@UpdateDate,@DeleteDate)";

            if (string.IsNullOrEmpty(pCD_Voice.PCDV_Code))
            {
                idb.AddParameter("@PCDV_Code", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@PCDV_Code", pCD_Voice.PCDV_Code);
            }
            if (string.IsNullOrEmpty(pCD_Voice.PCDV_Type))
            {
                idb.AddParameter("@PCDV_Type", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@PCDV_Type", pCD_Voice.PCDV_Type);
            }
            if (string.IsNullOrEmpty(pCD_Voice.PCDV_OType))
            {
                idb.AddParameter("@PCDV_OType", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@PCDV_OType", pCD_Voice.PCDV_OType);
            }
            if (string.IsNullOrEmpty(pCD_Voice.PCDV_Object))
            {
                idb.AddParameter("@PCDV_Object", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@PCDV_Object", pCD_Voice.PCDV_Object);
            }
            if (string.IsNullOrEmpty(pCD_Voice.PCDV_Content))
            {
                idb.AddParameter("@PCDV_Content", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@PCDV_Content", pCD_Voice.PCDV_Content);
            }
            if (pCD_Voice.PCDV_Date == DateTime.MinValue)
            {
                idb.AddParameter("@PCDV_Date", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@PCDV_Date", pCD_Voice.PCDV_Date);
            }
            if (pCD_Voice.PCDV_ODate == DateTime.MinValue)
            {
                idb.AddParameter("@PCDV_ODate", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@PCDV_ODate", pCD_Voice.PCDV_ODate);
            }
            if (string.IsNullOrEmpty(pCD_Voice.PCDV_FType))
            {
                idb.AddParameter("@PCDV_FType", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@PCDV_FType", pCD_Voice.PCDV_FType);
            }
            if (string.IsNullOrEmpty(pCD_Voice.PCDV_FCode))
            {
                idb.AddParameter("@PCDV_FCode", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@PCDV_FCode", pCD_Voice.PCDV_FCode);
            }
            if (pCD_Voice.Stat == 0)
            {
                idb.AddParameter("@Stat", 0);
            }
            else
            {
                idb.AddParameter("@Stat", pCD_Voice.Stat);
            }
            if (pCD_Voice.CreateDate == DateTime.MinValue)
            {
                idb.AddParameter("@CreateDate", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@CreateDate", pCD_Voice.CreateDate);
            }
            if (pCD_Voice.UpdateDate == DateTime.MinValue)
            {
                idb.AddParameter("@UpdateDate", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@UpdateDate", pCD_Voice.UpdateDate);
            }
            if (pCD_Voice.DeleteDate == DateTime.MinValue)
            {
                idb.AddParameter("@DeleteDate", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@DeleteDate", pCD_Voice.DeleteDate);
            }


            int Re = 0;
            //SQL日志记录
            var RunMethod = System.Reflection.MethodBase.GetCurrentMethod();

            System.Collections.Hashtable param = new System.Collections.Hashtable();
            string Ex = "0";

            foreach (System.Collections.DictionaryEntry item in idb.GetParameters())
            {
                param.Add(item.Key, item.Value);
            }
            try
            {
                Re = idb.ExeCmd(sql);
                Ex = Re.ToString();
            }
            catch (Exception ex)
            {
                Ex = ex.Message;
            }

            SysRunLog.InsertRunSql(sql, param, RunMethod.DeclaringType + "." + RunMethod.Name, Ex);

            return(Re);
        }
Exemplo n.º 55
0
        public ActionResult PaymentGateway(int DonationId, int DonorId, string DonationStatus, string DonationAmount, string Comments)
        {
            decimal          Amount       = Convert.ToDecimal(DonationAmount);
            Donor_Details    data1        = DonationService.DonationStatus(DonationId, DonorId, Amount, DonationStatus, Comments);
            Donation_Details Donationdata = GenericMethods.GetUserDonations(DonationId);
            View_UserDetails UserDetails  = UserDetailsViewService.GetUserByUserId(DonorId);


            string hash_string = string.Empty;

            string[] hashVarsSeq;
            var      Key     = ConfigurationManager.AppSettings["MERCHANT_KEY"];
            Random   rnd     = new Random();
            string   strHash = Generatehash512(rnd.ToString() + DateTime.Now);

            txnid1 = strHash.ToString().Substring(0, 20);

            hashVarsSeq = ConfigurationManager.AppSettings["hashSequence"].Split('|'); // spliting hash sequence from config
            hash_string = "";
            foreach (string hash_var in hashVarsSeq)
            {
                if (hash_var == "key")
                {
                    hash_string = hash_string + ConfigurationManager.AppSettings["MERCHANT_KEY"];
                    hash_string = hash_string + '|';
                }
                else if (hash_var == "txnid")
                {
                    hash_string = hash_string + txnid1;
                    hash_string = hash_string + '|';
                }
                else if (hash_var == "amount")
                {
                    hash_string = hash_string + Convert.ToDecimal(DonationAmount).ToString("g29");
                    hash_string = hash_string + '|';
                }
                else if (hash_var == "productinfo")
                {
                    hash_string = hash_string + Donationdata.Donation_Title;
                    hash_string = hash_string + '|';
                }
                else if (hash_var == "firstname")
                {
                    hash_string = hash_string + UserDetails.FirstName;
                    hash_string = hash_string + '|';
                }
                else if (hash_var == "email")
                {
                    hash_string = hash_string + "*****@*****.**";
                    hash_string = hash_string + '|';
                }
                else
                {
                    hash_string = hash_string + (Request.Form[hash_var] != null ? Request.Form[hash_var] : "");// isset if else
                    hash_string = hash_string + '|';
                }
            }

            hash_string += ConfigurationManager.AppSettings["SALT"];                        // appending SALT
            hash1        = Generatehash512(hash_string).ToLower();                          //generating hash
            action1      = ConfigurationManager.AppSettings["PAYU_BASE_URL"] + "/_payment"; // setting URL

            System.Collections.Hashtable data = new System.Collections.Hashtable();         // adding values in gash table for data post
            data.Add("hash", hash1);
            data.Add("txnid", txnid1);
            data.Add("key", Key);
            string AmountForm = Convert.ToDecimal(DonationAmount).ToString("g29");// eliminating trailing zeros

            data.Add("amount", AmountForm);
            data.Add("firstname", UserDetails.FirstName);
            data.Add("email", "*****@*****.**");
            data.Add("phone", "8985143792");
            data.Add("productinfo", Donationdata.Donation_Title);
            data.Add("surl", "http://www.google.com");
            data.Add("furl", "http://www.google.com");

            string strForm = PreparePOSTForm(action1, data);

            ViewBag.Form = strForm;
            return(View());
        }
Exemplo n.º 56
0
        public void PTS_2ReachNetwork()
        {
            Debug.WriteLine("\n\n---------------------------------------------------");
            Debug.WriteLine("Testing the Perform Time Step Method for 2 Reaches");
            Debug.WriteLine("---------------------------------------------------");

            //initialize the component
            edu.SC.Models.Routing.Muskingum Routing = new edu.SC.Models.Routing.Muskingum();
            System.Collections.Hashtable    args    = new System.Collections.Hashtable();
            args.Add("ConfigFile", "ConfigTest_2reaches.xml");
            Routing.Initialize(args);


            //Begin Perform Time Step Procedures

            //define the input hydrograph.
            double[,] p = new double[16, 2] {
                { 0.0, 0 }, { 800.0, 0 }, { 2000.0, 0 }, { 4200.0, 0 }, { 5200.0, 0 },
                { 4400.0, 0 }, { 3200.0, 0 }, { 2500.0, 0 }, { 2000.0, 0 }, { 1500.0, 0 },
                { 1000.0, 0 }, { 700.0, 0 }, { 400.0, 0 }, { 0.0, 0 }, { 0.0, 0 }, { 0.0, 0 }
            };

            //define known muskingum routed vals, from example 9.3.2
            double[] vals = new double[16] {
                0, 272, 1178, 2701, 4455, 4886, 4020, 3009, 2359, 1851, 1350, 918, 610, 276, 16, 1
            };
            Queue <double> KnownAnswers = new Queue <double>(vals);

            //loop over all hydrograph values
            for (int j = 0; j <= p.GetLength(0) - 1; j++)
            {
                Console.WriteLine("TimeStep " + Convert.ToString(j + 1));
                double[] Array = new double[p.GetLength(1)];
                for (int k = 0; k <= p.GetLength(1) - 1; k++)
                {
                    //create array to hold the input hydrograph values for this timestep
                    Array[k] = p[j, k];
                }

                //Save input values to the Simple Model Wrappers DataTable using "SetValues"
                IValueSet Precip = new ScalarSet(Array);
                Routing.SetValues("Excess Rainfall", "Smith Branch", Precip);

                //Call Perform Time Step within the Muskingum routing component.
                Routing.PerformTimeStep();

                //Retrieve the calculated outflow from the Simple Model Wrappers DataTable, by calling GetValues()
                ScalarSet Outflow = (ScalarSet)Routing.GetValues("Streamflow", "Smith Branch");

                //Write the output results to the screen
                for (int i = 0; i <= Outflow.Count - 1; i++)
                {
                    Console.WriteLine("Outlet: " + i.ToString() + "\t Outflow [cfs]: " + Outflow.data[i].ToString() + "\n");
                }

                //Check to see if the computed values equal the known ones
                Assert.IsTrue(Math.Round(Outflow.data[1], 0) == KnownAnswers.Dequeue());
            }

            //Teardown the component
            Routing.Finish();
        }
Exemplo n.º 57
0
        static void Main(string[] args)
        {
            System.Collections.ArrayList  arrayList  = new System.Collections.ArrayList();
            System.Collections.SortedList sortedList = new System.Collections.SortedList();
            System.Collections.Hashtable  hashtable  = new System.Collections.Hashtable();
            System.Collections.Stack      stack      = new System.Collections.Stack();
            System.Collections.Queue      queue      = new System.Collections.Queue();

            #region [Non-Generic Collections]

            Console.WriteLine("Non-Generic Colletions::");

            #region ArrayList

            // Array List
            arrayList.Add(1);
            arrayList.Add("Aniket");
            arrayList.Add(10.33);
            arrayList.Add(true);
            arrayList.Add('A');

            Console.WriteLine("******=>ArrayList");

            foreach (var item in arrayList)
            {
                Console.WriteLine(item);
            }

            Console.WriteLine();
            #endregion

            #region SortedList

            sortedList.Add(1, "Aniket");
            sortedList.Add(7, "Pallavi");
            sortedList.Add(5, 10.33);
            sortedList.Add(2, true);
            sortedList.Add(9, 'S');
            Console.WriteLine("******=>Sorted List");
            for (int i = 0; i < sortedList.Count; i++)
            {
                Console.WriteLine(sortedList.GetByIndex(i));
            }

            Console.WriteLine();
            #endregion

            #region HashTable

            hashtable.Add(2, "Aniket");
            hashtable.Add(true, "Pallavi");
            hashtable.Add(1, 12.44);
            hashtable.Add(20, 'Z');
            hashtable.Add(false, 2);

            Console.WriteLine("******=>Hashtable");

            //Console.WriteLine(hashtable.Keys);

            foreach (object item in hashtable.Keys)
            {
                Console.WriteLine(hashtable[item]);
            }

            //for (int i = 0; i < hashtable.Count; i++)
            //{
            //    Console.WriteLine(hashtable[2]);
            //}

            Console.WriteLine();
            #endregion

            #region Stack
            stack.Push(1);
            stack.Push("Aniket");
            stack.Push(3.12);
            stack.Push('C');
            stack.Push(true);
            Console.WriteLine("******=>Stack");
            //Console.WriteLine(stack.Peek());
            //Console.WriteLine(stack.Pop());
            //Console.WriteLine(stack.Peek());

            foreach (object item in stack)
            {
                Console.WriteLine(item);
            }

            Console.WriteLine();

            #endregion

            #region Queue

            queue.Enqueue(1);
            queue.Enqueue(2);
            queue.Enqueue(3);
            queue.Enqueue(4);
            queue.Enqueue(5);
            Console.WriteLine("******=>Queue");
            Console.WriteLine(queue.Peek());
            Console.WriteLine(queue.Dequeue());
            Console.WriteLine(queue.Count);


            foreach (object item in queue)
            {
                Console.WriteLine(item);
            }

            Console.WriteLine();
            #endregion

            #endregion

            #region [Generic Colletions]

            Console.WriteLine();
            Console.WriteLine("Generic Colletions::");
            Console.WriteLine();

            System.Collections.Generic.List <int> list = new List <int>();
            System.Collections.Generic.SortedList <double, string>    sortedListGenric = new SortedList <double, string>();
            System.Collections.Generic.HashSet <double>               hashSet          = new HashSet <double>();
            System.Collections.Generic.SortedSet <string>             sortedSet        = new SortedSet <string>();
            System.Collections.Generic.Dictionary <int, string>       dictionary       = new Dictionary <int, string>();
            System.Collections.Generic.SortedDictionary <int, string> sortedDictionary = new SortedDictionary <int, string>();
            System.Collections.Generic.Stack <int>  stackGenric  = new Stack <int>();
            System.Collections.Generic.Queue <bool> queueGeneric = new Queue <bool>();

            #region List

            Console.WriteLine("******=>List");

            list.Add(10);
            list.Add(9);
            list.Add(12);
            list.Add(13);

            foreach (var item in list)
            {
                Console.WriteLine(item);
            }

            Console.WriteLine();

            #endregion

            #region SortedList

            Console.WriteLine("******=>Sorted List");
            sortedListGenric.Add(16, "Aniket");
            sortedListGenric.Add(9, "Pallavi");
            sortedListGenric.Add(5, "Shubham");
            sortedListGenric.Add(8, "Nakul");

            foreach (var item in sortedListGenric)
            {
                Console.WriteLine(item);
            }

            Console.WriteLine();

            #endregion

            #region HashSet

            Console.WriteLine("******=>HashSet");
            hashSet.Add(11.11);
            hashSet.Add(44.22);
            hashSet.Add(33.33);

            for (int i = 0; i < hashSet.Count; i++)
            {
                Console.WriteLine(hashSet.ElementAt(i));
            }

            Console.WriteLine();

            #endregion

            #region SortedSet

            Console.WriteLine("******=>SortedSet");

            sortedSet.Add("Brad");
            sortedSet.Add("Pallavi");
            sortedSet.Add("Aniket");

            for (int i = 0; i < sortedSet.Count; i++)
            {
                Console.WriteLine(sortedSet.ElementAt(i));
            }

            Console.WriteLine();

            #endregion


            #endregion

            Console.ReadKey();
        }
Exemplo n.º 58
0
 public void Add(object key, object value)
 {
     _dictionary.Add(key, value);
     _insertionOrderList.Add(key);
     _version++;
 }
Exemplo n.º 59
0
        public ActionResult Indicadores(string fechaInicio, string fechaFinal)
        {
            DateTime Inicio  = DateTime.Today.AddMonths(-1);
            DateTime Termino = DateTime.Today;

            if (fechaInicio != null || fechaFinal != null)
            {
                string[] inicioSeparado  = fechaInicio.Split('-');
                string[] terminoSeparado = fechaFinal.Split('-');

                Inicio  = new DateTime(int.Parse(inicioSeparado[2]), int.Parse(inicioSeparado[1]), int.Parse(inicioSeparado[0]));
                Termino = new DateTime(int.Parse(terminoSeparado[2]), int.Parse(terminoSeparado[1]), int.Parse(terminoSeparado[0]));
            }

            List <equipos> Equipos = db.Equipos.ToList();

            System.Collections.Hashtable Disponibilidad                   = new System.Collections.Hashtable();
            System.Collections.Hashtable Confiabilidad                    = new System.Collections.Hashtable();
            System.Collections.Hashtable TiempoMedioEntreFallas           = new System.Collections.Hashtable();
            System.Collections.Hashtable TiempoMedioParaReparar           = new System.Collections.Hashtable();
            System.Collections.Hashtable TiempoMedioOperacionAntesDeFalla = new System.Collections.Hashtable();
            System.Collections.Hashtable Utilizacion = new System.Collections.Hashtable();


            foreach (equipos Equip in Equipos)
            {
                disponibilidad disponibilidad = new disponibilidad(Inicio, Termino, Equip);
                double         disp           = Math.Round(disponibilidad.tiempoDisponible, 2);
                Disponibilidad.Add(Equip.ID, disp);


                tiempoMedioEntreFallas tMedioEntreFallas = new Models.tiempoMedioEntreFallas(Equip, Inicio, Termino);
                double tMedioFallas = Math.Round(tMedioEntreFallas.MTBF, 2);
                TiempoMedioEntreFallas.Add(Equip.ID, tMedioFallas);

                confiabilidad confiabilidad = new confiabilidad(Equip, Inicio, Termino, tMedioEntreFallas);
                double        conf          = Math.Round(confiabilidad.RazonDeFallas, 2);
                Confiabilidad.Add(Equip.ID, conf);

                tiempoMedioParaReparar MTTR = new tiempoMedioParaReparar(Inicio, Termino, Equip);
                double mttr = Math.Round(MTTR.MTTR, 2);
                TiempoMedioParaReparar.Add(Equip.ID, mttr);

                tiempoMedioDeOperacionAntesDeFalla tMedioOperacion =
                    new tiempoMedioDeOperacionAntesDeFalla(Equip, Inicio, Termino, MTTR.cantidadTotalDetenciones, confiabilidad.tMedioEntreFallas.totalHorasOperacionales);
                double tMedioOp = Math.Round(tMedioOperacion.MTBS, 2);
                TiempoMedioOperacionAntesDeFalla.Add(Equip.ID, tMedioOp);

                utilizacion Utiliz = new utilizacion(Equip, Inicio, Termino, disponibilidad.tiempoTranscurrido, disponibilidad.tiemposDeBaja, tMedioEntreFallas.totalHorasOperacionales);
                double      utiliz = Math.Round(Utiliz.Utilizacion, 2);
                Utilizacion.Add(Equip.ID, utiliz);
            }
            ViewBag.Inicio                               = Inicio;
            ViewBag.Termino                              = Termino;
            ViewData["Disponibilidad"]                   = Disponibilidad;
            ViewData["Confiabilidad"]                    = Confiabilidad;
            ViewData["TiempoMedioEntreFallas"]           = TiempoMedioEntreFallas;
            ViewData["tiempoMedioParaReparar"]           = TiempoMedioParaReparar;
            ViewData["TiempoMedioOperacionAntesDeFalla"] = TiempoMedioOperacionAntesDeFalla;
            ViewData["Utilizacion"]                      = Utilizacion;

            return(View(Equipos));
        }
Exemplo n.º 60
0
        internal void ProcessRecord(int flags, EmfPlusRecordType recordType, byte[] RecordData)
        {
            switch (recordType)
            {
            case EmfPlusRecordType.Header:
                break;

            case EmfPlusRecordType.SetPageTransform:
                EMFSetPageTransform P = EMFSetPageTransform.getTransform(flags, RecordData);
                break;

            case EmfPlusRecordType.Object:
                EMFRecordObject O = EMFRecordObject.getObject(flags, RecordData);
                if (O != null)
                {
                    if (ObjectTable.Contains(O.ObjectID))
                    {
                        ObjectTable[O.ObjectID] = O;
                    }
                    else
                    {
                        ObjectTable.Add(O.ObjectID, O);
                    }
                }
                break;

            case EmfPlusRecordType.DrawLines:
                //After each instruction we must do something, as the object table is constantly being changed...
                //and we need to use what is currently in the table!
                DrawLines DL = new DrawLines(X, Y, Width, Height, ObjectTable);
                PageItems.AddRange(DL.Process(flags, RecordData));
                break;

            case EmfPlusRecordType.DrawString:
                DrawString DS = new DrawString(X, Y, Width, Height, ObjectTable);
                PageItems.AddRange(DS.Process(flags, RecordData));
                break;

            case EmfPlusRecordType.FillRects:
                FillRects FR = new FillRects(X, Y, Width, Height, ObjectTable);
                PageItems.AddRange(FR.Process(flags, RecordData));
                break;

            case EmfPlusRecordType.DrawRects:
                DrawRects DR = new DrawRects(X, Y, Width, Height, ObjectTable);
                PageItems.AddRange(DR.Process(flags, RecordData));
                break;

            case EmfPlusRecordType.FillPolygon:
                FillPolygon FPo = new FillPolygon(X, Y, Width, Height, ObjectTable);
                PageItems.AddRange(FPo.Process(flags, RecordData));
                break;

            case EmfPlusRecordType.DrawEllipse:
                DrawEllipse DE = new DrawEllipse(X, Y, Width, Height, ObjectTable);
                PageItems.AddRange(DE.Process(flags, RecordData));
                break;

            case EmfPlusRecordType.FillEllipse:
                FillEllipse FE = new FillEllipse(X, Y, Width, Height, ObjectTable);
                PageItems.AddRange(FE.Process(flags, RecordData));
                break;

            case EmfPlusRecordType.FillPie:
                FillPie FP = new FillPie(X, Y, Width, Height, ObjectTable);
                PageItems.AddRange(FP.Process(flags, RecordData));
                break;

            case EmfPlusRecordType.DrawPie:
                DrawPie DP = new DrawPie(X, Y, Width, Height, ObjectTable);
                PageItems.AddRange(DP.Process(flags, RecordData));
                break;

            case EmfPlusRecordType.DrawCurve:
                DrawCurve DC = new DrawCurve(X, Y, Width, Height, ObjectTable);
                PageItems.AddRange(DC.Process(flags, RecordData));
                break;

            case EmfPlusRecordType.Comment:
                Comment CM = new Comment(X, Y, Width, Height, ObjectTable);
                PageItems.AddRange(CM.Process(flags, RecordData));
                break;

            default:
                break;
            }
        }