Inheritance: System.Collections.ICollection, System.Collections.IDictionary, System.Collections.IEnumerable, System.Runtime.Serialization.ISerializable, System.Runtime.Serialization.IDeserializationCallback, System.ICloneable
        /// <summary>
        /// 新增基本檔資料(使用交易)
        /// </summary>
        /// <param name="htParams">放入輸入的參數</param>
        /// <param name="DBT">交易變數</param>
        /// <returns>回傳影響筆數</returns>
        public void doCreate(Hashtable htParams,
                            DbTransaction DBT
                            )
        {
            try
            {
                DbCommand cmd = db.GetStoredProcCommand("PKG_VDS_ALO_PATTERNSPEC_DETL.ADD_PATTERNSPEC_DETL");
                db.AddInParameter(cmd, "ID", DbType.VarNumeric, htParams["ID"]);
                db.AddInParameter(cmd, "PID", DbType.VarNumeric, htParams["PID"]);
                db.AddInParameter(cmd, "vCreateDate", DbType.Date, htParams["CREATEDATE"]);
                db.AddInParameter(cmd, "vCreateUID", DbType.String, htParams["CREATEUID"]);
                db.AddInParameter(cmd, "vUpdateDate", DbType.Date, htParams["UPDATEDATE"]);
                db.AddInParameter(cmd, "vUpdateUID", DbType.String, htParams["UPDATEUID"]);
                db.AddInParameter(cmd, "nSTART_RANKQTY", DbType.VarNumeric, htParams["START_RANKQTY"]);
                db.AddInParameter(cmd, "nEND_RANKQTY", DbType.VarNumeric, htParams["END_RANKQTY"]);
                db.AddInParameter(cmd, "nADJ_QTY", DbType.VarNumeric, htParams["ADJ_QTY"]);

                int ProcessRecord = (DBT == null) ? db.ExecuteNonQuery(cmd) : db.ExecuteNonQuery(cmd, DBT);

                if (ProcessRecord == 0)
                {
                    throw new Exception("輸入資料失敗!");
                }
            }
            catch (Exception ex)
            {
                throw new Exception("呼叫VDS_ALO_PATTERNSPEC_DETL_DBO.doCreate()發生錯誤,錯誤訊息:"
                                    + OracleExceptionProcess.OracleExceptionStringCut(ex.Message));
            }
        }
Beispiel #2
1
        public static Hashtable loadParamFile(string Filename)
        {
            Hashtable param = new Hashtable();

            StreamReader sr = new StreamReader(Filename);
            while (!sr.EndOfStream)
            {
                string line = sr.ReadLine();

                if (line.Contains("NOTE:"))
                {
                    CustomMessageBox.Show(line, "Saved Note");
                    continue;
                }

                if (line.StartsWith("#"))
                    continue;

                string[] items = line.Split(new char[] { ' ', ',', '\t' }, StringSplitOptions.RemoveEmptyEntries);

                if (items.Length != 2)
                    continue;

                string name = items[0];
                float value = 0;
                try
                {
                    value = float.Parse(items[1], System.Globalization.CultureInfo.InvariantCulture);// new System.Globalization.CultureInfo("en-US"));
                }
                catch (Exception ex) { log.Error(ex); throw new FormatException("Invalid number on param " + name + " : " + items[1].ToString()); }

                if (name == "SYSID_SW_MREV")
                    continue;
                if (name == "WP_TOTAL")
                    continue;
                if (name == "CMD_TOTAL")
                    continue;
                if (name == "FENCE_TOTAL")
                    continue;
                if (name == "SYS_NUM_RESETS")
                    continue;
                if (name == "ARSPD_OFFSET")
                    continue;
                if (name == "GND_ABS_PRESS")
                    continue;
                if (name == "GND_TEMP")
                    continue;
                if (name == "CMD_INDEX")
                    continue;
                if (name == "LOG_LASTFILE")
                    continue;
                if (name == "FORMAT_VERSION")
                    continue;

                param[name] = value;
            }
            sr.Close();

            return param;
        }
        private IResponse GenerateAuditHistory(ICruiseRequest request)
        {
            var velocityContext = new Hashtable();
            var links = new List<IAbsoluteLink>();
            links.Add(new ServerLink(request.UrlBuilder, request.ServerSpecifier, "Server", ActionName));

            ProjectStatusListAndExceptions projects = farmService.GetProjectStatusListAndCaptureExceptions(request.ServerSpecifier, request.RetrieveSessionToken());
            foreach (ProjectStatusOnServer projectStatusOnServer in projects.StatusAndServerList)
            {
                DefaultProjectSpecifier projectSpecifier = new DefaultProjectSpecifier(projectStatusOnServer.ServerSpecifier, projectStatusOnServer.ProjectStatus.Name);
                links.Add(new ProjectLink(request.UrlBuilder, projectSpecifier, projectSpecifier.ProjectName, ServerAuditHistoryServerPlugin.ActionName));
            }
            velocityContext["projectLinks"] = links;
            string sessionToken = request.RetrieveSessionToken(sessionRetriever);
            if (!string.IsNullOrEmpty(request.ProjectName))
            {
                velocityContext["currentProject"] = request.ProjectName;
                AuditFilterBase filter = AuditFilters.ByProject(request.ProjectName);
                velocityContext["auditHistory"] = farmService.ReadAuditRecords(request.ServerSpecifier, sessionToken, 0, 100, filter);
            }
            else
            {
                velocityContext["auditHistory"] = new ServerLink(request.UrlBuilder, request.ServerSpecifier, string.Empty, DiagnosticsActionName);
                velocityContext["auditHistory"] = farmService.ReadAuditRecords(request.ServerSpecifier, sessionToken, 0, 100);
            }

            return viewGenerator.GenerateView(@"AuditHistory.vm", velocityContext);
        }
Beispiel #4
1
 public ActionResult GetBmCodes(string codes)
 {
     Hashtable ht = new Hashtable();
     string[] str = codes.Split(',');
     foreach (var temp in str)
     {
         switch (temp)
         {
             case "xtzylx":
                 ht.Add(temp, UtilCodeInfo.xtzylx);
                 break;
             case "xtzyzt":
                 ht.Add(temp, UtilCodeInfo.xtzyzt);
                 break;
             case "usRole":
                 ht.Add(temp, UtilCodeInfo.usRole);
                 break;
             case "usstate":
                 ht.Add(temp, UtilCodeInfo.usstate);
                 break;
             case "rolestate":
               //  ht.Add(temp, UtilCodeInfo.rolestate);
                 break;
             case "recode":
                 //ht.Add(temp, UtilCodeInfo.recode);
                 break;
         }
     }
     return Json(ht, JsonRequestBehavior.AllowGet);
 }
		private string CheckConsistency()
		{
			this.PrepareBones();
			Hashtable hashtable = new Hashtable();
			foreach (RagdollBuilder.BoneInfo boneInfo in this.bones)
			{
				if (boneInfo.anchor)
				{
					if (hashtable[boneInfo.anchor] != null)
					{
						RagdollBuilder.BoneInfo boneInfo2 = (RagdollBuilder.BoneInfo)hashtable[boneInfo.anchor];
						string result = string.Format("{0} and {1} may not be assigned to the same bone.", boneInfo.name, boneInfo2.name);
						return result;
					}
					hashtable[boneInfo.anchor] = boneInfo;
				}
			}
			foreach (RagdollBuilder.BoneInfo boneInfo3 in this.bones)
			{
				if (boneInfo3.anchor == null)
				{
					string result = string.Format("{0} has not been assigned yet.\n", boneInfo3.name);
					return result;
				}
			}
			return string.Empty;
		}
 public JsonObject GetDiskInfo()
 {
   try
   {
     var diskinfo = new JsonObject();
     var volumes = new ArrayList();
     foreach (var vi in VolumeInfo.GetVolumes())
     {
       var v = new Hashtable();
       v.Add("root", vi.RootDirectory);
       v.Add("size", vi.TotalSize);
       v.Add("free", vi.TotalFreeSpace);
       v.Add("formatted", vi.IsFormatted);
       v.Add("volumeid", vi.VolumeID);
       v.Add("content", GetRootFolderInfo(vi.RootDirectory));
       volumes.Add(v);
     }
     diskinfo.Add("volumes", volumes);
     return diskinfo;
   }
   catch (Exception ex)
   {
     var error = new JsonObject();
     error.Add("error", ex.ToString());
     error.Add("stacktrace", ex.StackTrace);
     return error;
   }
 }
Beispiel #7
1
 private static void FillEventArgs(Hashtable mapArgs, Dictionary<string, string> additionalInfo)
 {
     if (additionalInfo == null)
     {
         for (int i = 0; i < 3; i++)
         {
             string str = (i + 1).ToString("d1", CultureInfo.CurrentCulture);
             mapArgs["AdditionalInfo_Name" + str] = "";
             mapArgs["AdditionalInfo_Value" + str] = "";
         }
     }
     else
     {
         string[] array = new string[additionalInfo.Count];
         string[] strArray2 = new string[additionalInfo.Count];
         additionalInfo.Keys.CopyTo(array, 0);
         additionalInfo.Values.CopyTo(strArray2, 0);
         for (int j = 0; j < 3; j++)
         {
             string str2 = (j + 1).ToString("d1", CultureInfo.CurrentCulture);
             if (j < array.Length)
             {
                 mapArgs["AdditionalInfo_Name" + str2] = array[j];
                 mapArgs["AdditionalInfo_Value" + str2] = strArray2[j];
             }
             else
             {
                 mapArgs["AdditionalInfo_Name" + str2] = "";
                 mapArgs["AdditionalInfo_Value" + str2] = "";
             }
         }
     }
 }
Beispiel #8
1
 /// <summary>
 /// 構造
 /// </summary>
 protected ESData()
 {
     dict = new Hashtable();
     dict.Add("itemno", "物品編號");
     dict.Add("item", "產品");
     dict.Add("model", "型號");
 }
		public HtmlFragmentResponse Execute()
		{
			Hashtable velocityContext = new Hashtable();

			string serverName = request.ServerName;
			string categoryName = GetCategory();
            string projectName = request.ProjectName;
			string buildName = request.BuildName;

			velocityContext["serverName"] = serverName;
			velocityContext["categoryName"] = categoryName;
			velocityContext["projectName"] = projectName;
			velocityContext["buildName"] = buildName;

			velocityContext["farmLink"] = linkFactory.CreateFarmLink("Dashboard", FarmReportFarmPlugin.ACTION_NAME);

			if (serverName != string.Empty)
			{
				velocityContext["serverLink"] = linkFactory.CreateServerLink(request.ServerSpecifier, ServerReportServerPlugin.ACTION_NAME);
			}

            if (categoryName != string.Empty)
            {
                IServerSpecifier serverSpecifier;
                try
                {
                    serverSpecifier = request.ServerSpecifier;
                }
                catch (ThoughtWorks.CruiseControl.Core.CruiseControlException)
                {
                    serverSpecifier = null;
                }

                if (serverSpecifier != null)
                {
                    velocityContext["categoryLink"] = new GeneralAbsoluteLink(categoryName, linkFactory
                        .CreateServerLink(serverSpecifier, "ViewServerReport")
                        .Url + "?Category=" + HttpUtility.UrlEncode(categoryName));
                }
                else
                {
                    velocityContext["categoryLink"] = new GeneralAbsoluteLink(categoryName, linkFactory
                        .CreateFarmLink( "Dashboard", FarmReportFarmPlugin.ACTION_NAME )
                        .Url + "?Category=" + HttpUtility.UrlEncode(categoryName));
                }
            }


			if (projectName != string.Empty)
			{
				velocityContext["projectLink"] = linkFactory.CreateProjectLink(request.ProjectSpecifier,  ProjectReportProjectPlugin.ACTION_NAME);
			}

			if (buildName != string.Empty)
			{
				velocityContext["buildLink"] = linkFactory.CreateBuildLink(request.BuildSpecifier,  BuildReportBuildPlugin.ACTION_NAME);
			}

			return velocityViewGenerator.GenerateView("TopMenu.vm", velocityContext);
		}
        public IResponse Execute(ICruiseRequest request)
        {
            Hashtable velocityContext = new Hashtable();
            ArrayList links = new ArrayList();
            links.Add(new ServerLink(urlBuilder, request.ServerSpecifier, "Server Log", ActionName));

            ProjectStatusListAndExceptions projects = farmService.GetProjectStatusListAndCaptureExceptions(request.ServerSpecifier,
                request.RetrieveSessionToken());
            foreach (ProjectStatusOnServer projectStatusOnServer in projects.StatusAndServerList)
            {
                DefaultProjectSpecifier projectSpecifier = new DefaultProjectSpecifier(projectStatusOnServer.ServerSpecifier, projectStatusOnServer.ProjectStatus.Name);
                links.Add(new ProjectLink(urlBuilder, projectSpecifier, projectSpecifier.ProjectName, ServerLogProjectPlugin.ActionName));
            }
            velocityContext["projectLinks"] = links;
            if (string.IsNullOrEmpty(request.ProjectName))
            {
                velocityContext["log"] = HttpUtility.HtmlEncode(farmService.GetServerLog(request.ServerSpecifier, request.RetrieveSessionToken()));
            }
            else
            {
                velocityContext["currentProject"] = request.ProjectSpecifier.ProjectName;
                velocityContext["log"] = HttpUtility.HtmlEncode(farmService.GetServerLog(request.ProjectSpecifier, request.RetrieveSessionToken()));
            }

            return viewGenerator.GenerateView(@"ServerLog.vm", velocityContext);
        }
        /// <summary>
        /// Puts new values into xively feed.
        /// </summary>
        /// <param name="ids">The ids.</param>
        /// <param name="values">The values.</param>
        /// <exception cref="System.ApplicationException">The xively server returned invalid status code.</exception>
        public void Put(string[] ids, object[] values)
        {
            var datastreams = new Hashtable[ids.Length];
            for (int i = 0; i < ids.Length; i++)
                datastreams[i] = new Hashtable
                                    {
                                        {"id",ids[i]},
                                        {"current_value",values[i]},
                                    };

            var json = new Hashtable
            {
                {"version","1.0.0"},
                {"datastreams",datastreams},
            };


            var request = new HttpRequest
            {
                Method = "PUT",
                Url = url,
                Content = JSON.JsonEncode(json),
            };

            request.AddHeader("X-ApiKey", apiKey);

            var response = httpClient.ExecuteRequest(request);

            if (response.StatusCode != 200)
                throw new ApplicationException("Xively server returned invalid status code : " + response.StatusCode);
        }
	    /// <summary>
	    ///     Gets the item price model.
	    /// </summary>
	    /// <param name="item">The item.</param>
	    /// <param name="lowestPrice">The lowest price.</param>
	    /// <param name="tags">Additional tags for promotion evaluation</param>
	    /// <returns>price model</returns>
	    /// <exception cref="System.ArgumentNullException">item</exception>
	    public PriceModel GetItemPriceModel(Item item, Price lowestPrice, Hashtable tags)
        {
            if (item == null)
            {
                throw new ArgumentNullException("item");
            }

            if (lowestPrice == null)
            {
                return new PriceModel();
            }

            var price = lowestPrice.Sale ?? lowestPrice.List;
            var discount = _client.GetItemDiscountPrice(item, lowestPrice, tags);
            var priceModel = CreatePriceModel(price, price - discount, UserHelper.CustomerSession.Currency);
	        priceModel.ItemId = item.ItemId;
            //If has any variations
            /* performance too slow with this method, need to store value on indexing instead
	        if (CatalogHelper.CatalogClient.GetItemRelations(item.ItemId).Any())
	        {
	            priceModel.PriceTitle = "Starting from:".Localize();
	        }
             * */
            return priceModel;
        }
 private CollaboratingWorkbooksEnvironment(String[] workbookNames, WorkbookEvaluator[] evaluators, int nItems)
 {
     Hashtable m = new Hashtable(nItems * 3 / 2);
     Hashtable uniqueEvals = new Hashtable(nItems * 3 / 2);
     for (int i = 0; i < nItems; i++)
     {
         String wbName = workbookNames[i];
         WorkbookEvaluator wbEval = evaluators[i];
         if (m.ContainsKey(wbName))
         {
             throw new ArgumentException("Duplicate workbook name '" + wbName + "'");
         }
         if (uniqueEvals.ContainsKey(wbEval))
         {
             String msg = "Attempted To register same workbook under names '"
                 + uniqueEvals[(wbEval) + "' and '" + wbName + "'"];
             throw new ArgumentException(msg);
         }
         uniqueEvals[wbEval]=wbName;
         m[wbName] = wbEval;
     }
     UnhookOldEnvironments(evaluators);
     //HookNewEnvironment(evaluators, this); - moved to Setup method above
     _unhooked = false;
     _evaluators = evaluators;
     _evaluatorsByName = m;
 }
Beispiel #14
1
		protected override Type[] CreateInOutParamTypes(Uiml.Param[] parameters, out Hashtable outputPlaceholder)
		{
			outputPlaceholder = null;
			Type[] tparamTypes =  new Type[parameters.Length]; 
			int i=0;
			try
			{
				for(i=0; i<parameters.Length; i++)
				{
					tparamTypes[i] = Type.GetType(parameters[i].Type);
					int j = 0;
					while(tparamTypes[i] == null)	
						tparamTypes[i] = ((Assembly)ExternalLibraries.Instance.Assemblies[j++]).GetType(parameters[i].Type);
					//also prepare a placeholder when this is an output parameter
					if(parameters[i].IsOut)
					{
						if(outputPlaceholder == null)
							outputPlaceholder = new Hashtable();
						outputPlaceholder.Add(parameters[i].Identifier, null);
					}
				}
				return tparamTypes;
			}
				catch(ArgumentOutOfRangeException aore)
				{
					Console.WriteLine("Can not resolve type {0} of parameter {1} while calling method {2}",parameters[i].Type ,i , Call.Name);
					Console.WriteLine("Trying to continue without executing {0}...", Call.Name);
					throw aore;					
				}
		}
Beispiel #15
1
        public static Hashtable GetImportedDate(IList<VDMS.I.Entity.ShippingDetail> shippingList)
        {
            Hashtable data = new Hashtable();
            if ((shippingList == null) || shippingList.Count == 0) return data;

            List<string> listEngines = new List<string>();
            foreach (VDMS.I.Entity.ShippingDetail item in shippingList)
            {
                listEngines.Add(item.EngineNumber);
            }

            //IDao<Iteminstance, long> IISdao = DaoFactory.GetDao<Iteminstance, long>();
            //IISdao.SetCriteria(new ICriterion[] { Expression.In("Enginenumber", listEngines) });
            //IList listIIS = IISdao.GetAll();

            //foreach (Iteminstance item in listIIS)
            //{
            //    data.Add(item.Enginenumber, item.Importeddate);
            //}
            using( var db = new VehicleDataContext() )
            {
                var query = from ii in db.ItemInstances
                            where
                                listEngines.Contains(ii.EngineNumber)
                            select ii;
                foreach (var itemInstance in query)
                {
                    data.Add(itemInstance.EngineNumber, itemInstance.ImportedDate);
                }
                return data;
            }
        }
Beispiel #16
1
 protected void Save_Click(object sender, EventArgs e)
 {
     string s = this.Session["dt_session_code"].ToString().ToLower();
     if (this.txtCode.Value.ToLower() != this.Session["dt_session_code"].ToString().ToLower())
     {
         this.txtCode.Focus();
         this.errorMsg.InnerHtml = "验证码输入不正确!";
     }
     else
     {
         int i = 0;
         if (this.txtUserName.Value != "Administrator")
         {
             Hashtable ht_User = new Hashtable();
             ht_User["User_Pwd"] = Md5Helper.MD5(this.txtUserPwd.Value, 32);
             i = system_idao.UpdateByHashtable("Base_UserInfo", "User_ID", RequestSession.GetSessionUser().UserId.ToString(), ht_User);
         }
         if (i > 0)
         {
             this.Session.Abandon();
             this.Session.Clear();
             base.Response.Write("<script>alert('登陆修改成功,请重新登陆');top.location.href='../../Index.htm'</script>");
         }
         else
         {
             this.errorMsg.InnerHtml = "修改登录密码失败";
         }
     }
 }
Beispiel #17
1
 /// <summary>
 /// Carga una hashtable que contiene los permisos del usuario (menu desplegable)
 /// </summary>
 /// <returns></returns>
 public Hashtable CargarPermisos()
 {
     MedDAL.DAL.permisos_usuarios permisoUsuario;
     Hashtable htPermisos = new Hashtable();
     int count=1;
     char cPermiso;
     string[] listaPermisos = { "usuarios", "perfiles", 
                                "clientes", "vendedores", "proveedores", "estados", "municipios", "poblaciones", "colonias", 
                                "almacenes", "productos", "inventarios", 
                                "pedidos", "recetas", "remisiones", "facturas", 
                                "causes", "bitacora", 
                                "configuracion", "campos editables", "tipos", "cuentas x cobrar", 
                                "tipos de iva", "ensambles", "lineas de credito"};
        
     foreach (string permiso in listaPermisos) {
         permisoUsuario = (MedDAL.DAL.permisos_usuarios)blPermisosUsuarios.RecuperarPermisos(idUsuario, count);
         cPermiso = (permisoUsuario.TipoAcceso.ToString().ToCharArray())[0];
         if (cPermiso!='N')
             htPermisos.Add(permiso, cPermiso);
         count++;
     }
     permisoUsuario = (MedDAL.DAL.permisos_usuarios)blPermisosUsuarios.RecuperarPermisos(idUsuario, 16);
     cPermiso = (permisoUsuario.TipoAcceso.ToString().ToCharArray())[0];
     if (cPermiso != 'N')
         htPermisos.Add("facturas x receta", cPermiso);
     htPermisos.Add("reportes",'T');
     htPermisos.Add("cambiar contraseña", 'T');
     htPermisos.Add("movimientos", 'T');
     return htPermisos;
 }
        private void buttonResetSendTime_Click(object sender, EventArgs e)
        {

       
            Hashtable ht = new Hashtable();
            DateTime dtSelected = dtTradeDate.Value;
            if (comboAssetClass.SelectedIndex < 0)
            {
                MessageBox.Show("Please select asset class","Asset Class", MessageBoxButtons.OK,MessageBoxIcon.Warning);
                return;
            }

            ht["destination"] = txtDestination.Text;
            ht["tradedateid"] = dtSelected.Year * 10000 + dtSelected.Month*100+dtSelected.Day;
            ht["assetclass"] = comboAssetClass.SelectedItem.ToString();

            DataSet ds = (DataSet)BrokerConnection.Request("SetResetTime", ht);

            if (ds != null && ds.Tables.Count > 0)
            {
                ds.Tables[0].TableName = "SetResetTime";
                MessageBox.Show(String.Format("Successfully updated {0} records",ds.Tables[0].Rows[0][0]),"Updated Records",MessageBoxButtons.OK,MessageBoxIcon.Information);
            }
                

           
        }
        public void Init()
        {
            tblSettings = new Hashtable();
              tblSettings.Add("LogPath", "Test LogPath");
              tblSettings.Add("LogToFile", "false");
              tblSettings.Add("LogErrorsOnly", "false");
              tblSettings.Add("ProxyServer", "http://localhost/");
              tblSettings.Add("ProxyUser", "ProxyUser");
              tblSettings.Add("ProxyPassword", "ProxyPassword");
              tblSettings.Add("ProxyDomain", "ProxyDomain");
              tblSettings.Add("MaskCredentials", "false");
              tblSettings.Add("Timeout", "20");
              tblSettings.Add("RetryCount", "5");

              tblSettings.Add("OAuth2ClientId", "OAuth2ClientId");
              tblSettings.Add("OAuth2ClientSecret", "OAuth2ClientSecret");
              tblSettings.Add("OAuth2ServiceAccountEmail", "OAuth2ServiceAccountEmail");
              tblSettings.Add("OAuth2PrnEmail", "OAuth2PrnEmail");
              tblSettings.Add("OAuth2JwtCertificatePath", "OAuth2JwtCertificatePath");
              tblSettings.Add("OAuth2JwtCertificatePassword", "OAuth2JwtCertificatePassword");
              tblSettings.Add("OAuth2AccessToken", "OAuth2AccessToken");
              tblSettings.Add("OAuth2RefreshToken", "OAuth2RefreshToken");
              tblSettings.Add("OAuth2Scope", "OAuth2Scope");
              tblSettings.Add("OAuth2RedirectUri", "OAuth2RedirectUri");
              tblSettings.Add("OAuth2Mode", "SERVICE_ACCOUNT");

              tblSettings.Add("Email", "Email");
              tblSettings.Add("Password", "Password");
              tblSettings.Add("AuthToken", "AuthToken");
              tblSettings.Add("EnableGzipCompression", "false");
        }
Beispiel #20
0
        public void Insert()
        {
            TableBatchOperation batchOperation = new TableBatchOperation();
            Hashtable barcode = new Hashtable();
            StringBuilder sb = new StringBuilder();
            for (int i = id; i < id + 100 && i < Program._DATA_TABLE.Rows.Count; i++)
            {
                if (!barcode.ContainsKey(Program._DATA_TABLE.Rows[i]["Barcode"].ToString().Trim()))
                {
                    try
                    {
                        sb.Append(Program._DATA_TABLE.Rows[i]["Barcode"].ToString().Trim() + "|");
                        ShopBarcodeEntity data = new ShopBarcodeEntity(Program._DATA_TABLE.Rows[i]["Shop"].ToString().Trim(), Program._DATA_TABLE.Rows[i]["Barcode"].ToString().Trim());
                        data.OrderNo = Program._DATA_TABLE.Rows[i]["BillNumber"].ToString().Trim();
                        data.Product = Program._DATA_TABLE.Rows[i]["Product"].ToString().Trim().PadLeft(8, '0');
                        data.Cost = double.Parse(Program._DATA_TABLE.Rows[i]["SellPrice"].ToString().Trim());
                        data.SellFinished = false;
                        batchOperation.InsertOrMerge(data);
                        barcode[Program._DATA_TABLE.Rows[i]["Barcode"].ToString().Trim()] = true;
                    }
                    catch { }
                }
            }

            try
            {
                Program._RECORD++;
                Console.WriteLine("Insert Record {0}-{1}\t\tTotal {2} Records", id + 1, id + 100, Program._RECORD*100);
                Program._CLOUD_TABLE.ExecuteBatch(batchOperation);
            }
            catch (Exception e)
            {
                Program.WriteErrorLog("Record " + (id + 1) + "-" + (id + 100) + " Error \n" + sb.ToString() + "\n" + e.Message + "\n" + e.StackTrace);
            }
        }
Beispiel #21
0
        internal XmlQueryContext(XmlQueryRuntime runtime, object defaultDataSource, XmlResolver dataSources, XsltArgumentList argList, WhitespaceRuleLookup wsRules) {
            this.runtime = runtime;
            this.dataSources = dataSources;
            this.dataSourceCache = new Hashtable();
            this.argList = argList;
            this.wsRules = wsRules;

            if (defaultDataSource is XmlReader) {
                this.readerSettings = new QueryReaderSettings((XmlReader) defaultDataSource);
            }
            else {
                // Consider allowing users to set DefaultReaderSettings in XsltArgumentList
                // readerSettings = argList.DefaultReaderSettings;
                this.readerSettings = new QueryReaderSettings(new NameTable());
            }

            if (defaultDataSource is string) {
                // Load the default document from a Uri
                this.defaultDataSource = GetDataSource(defaultDataSource as string, null);

                if (this.defaultDataSource == null)
                    throw new XslTransformException(Res.XmlIl_UnknownDocument, defaultDataSource as string);
            }
            else if (defaultDataSource != null) {
                this.defaultDataSource = ConstructDocument(defaultDataSource, null, null);
            }
        }
Beispiel #22
0
 public MainForm()
 {
     InitializeComponent();
     context = SynchronizationContext.Current;
     actions = new List<ActionEntry>();
     schedualeList = new Hashtable();
 }
        } // HttpChannel

        public HttpChannel(IDictionary properties, 
                           IClientChannelSinkProvider clientSinkProvider,
                           IServerChannelSinkProvider serverSinkProvider)
        {
            Hashtable clientData = new Hashtable();
            Hashtable serverData = new Hashtable();
        
            // divide properties up for respective channels
            if (properties != null)
            {            
                foreach (DictionaryEntry entry in properties)
                {
                    switch ((String)entry.Key)
                    {
                    // general channel properties
                    case "name": _channelName = (String)entry.Value; break;
                    case "priority": _channelPriority = Convert.ToInt32((String)entry.Value, CultureInfo.InvariantCulture); break;
                    case "secure": _secure = Convert.ToBoolean(entry.Value, CultureInfo.InvariantCulture); 
                                    clientData["secure"] = entry.Value;
                                    serverData["secure"] = entry.Value;
                                    break;
                    default: 
                        clientData[entry.Key] = entry.Value;
                        serverData[entry.Key] = entry.Value;
                        break;
                    }
                }
            }

            _clientChannel = new HttpClientChannel(clientData, clientSinkProvider);
            _serverChannel = new HttpServerChannel(serverData, serverSinkProvider);
        } // HttpChannel
Beispiel #24
0
 public ETClient(Edge e)
 {
   _sync = new object();
   _sent_blocks = new Hashtable();
   _e = e;
   _e.Subscribe(this, null );
 }
Beispiel #25
0
        ///
        public LogRMC(string[] filenames)
        {
            Hashtable methods = new Hashtable();
            methods["StatusInvalid"] = false;
            methods["NullValues"]    = false;
            methods["InvalidCoords"] = false;
            methods["ValidChecksum"] = false;

            LogRMC[] rmcLogs = new LogRMC[filenames.Length];

            for (int i = 0; i < filenames.Length; i++)
            {
                rmcLogs[i] = new LogRMC();
                rmcLogs[i].ReadFile(filenames[i]);
                rmcLogs[i].Clean(methods);
            }

            Array.Sort(rmcLogs);

            this.logBegin = rmcLogs[0].logBegin;
            this.logEnd   = rmcLogs[0].logEnd;
            this.rmcData  = new ArrayList();

            foreach (LogRMC rmc in rmcLogs)
            {
                if (this.logBegin > rmc.logBegin)
                    this.logBegin = rmc.logBegin;

                if (this.logEnd < rmc.logEnd)
                    this.logEnd = rmc.logEnd;

                foreach (Hashtable fields in rmc.rmcData)
                    this.rmcData.Add(this.GetRMCSentence(fields));
            }
        }
        private void LoadSettings()
        {
            moduleId = WebUtils.ParseInt32FromQueryString("mid", moduleId);
            pageId = WebUtils.ParseInt32FromQueryString("pageid", pageId);
            module = GetModule(moduleId, Forum.FeatureGuid);
            settings = ModuleSettings.GetModuleSettings(moduleId);
            config = new ForumConfiguration(settings);

            forumList.Config = config;
            forumList.ModuleId = moduleId;
            forumList.PageId = pageId;
            forumList.SiteRoot = SiteRoot;
            forumList.ImageSiteRoot = ImageSiteRoot;
            //forumList.IsEditable = IsEditable;

            forumListAlt.Config = config;
            forumListAlt.ModuleId = moduleId;
            forumListAlt.PageId = pageId;
            forumListAlt.SiteRoot = SiteRoot;
            forumListAlt.ImageSiteRoot = ImageSiteRoot;
            //forumListAlt.IsEditable = IsEditable;

            if (displaySettings.UseAltForumList)
            {
                forumList.Visible = false;
                forumListAlt.Visible = true;
            }

            AddClassToBody("editforumsubscriptions");
        }
		public void Constructor_SendInDictionaryWithNonStringKey_ThrowsArgumentException() {
			var attributeValueCollection = A.Fake<IAttributeValueCollection>();
			var dictionary = new Hashtable();
			dictionary.Add(new object(), attributeValueCollection);

			Assert.Throws<ArgumentException>(() => new AttributeCollection(dictionary));
		}
Beispiel #28
0
        static void Main() {
#if EASYTEST
			DevExpress.ExpressApp.Win.EasyTest.EasyTestRemotingRegistration.Register();
#endif
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            EditModelPermission.AlwaysGranted = Debugger.IsAttached;
            var winApplication =
                new SecuritySystemExampleWindowsFormsApplication();
            const string connectionString = "tcp://localhost:1426/DataServer";
            winApplication.ConnectionString = connectionString;
            try {
                var t = new Hashtable{{"secure", true}, {"tokenImpersonationLevel", "impersonation"}};
                var channel = new TcpChannel(t, null, null);
                ChannelServices.RegisterChannel(channel, true);
                var clientDataServer = (IDataServer) Activator.GetObject(
                    typeof (RemoteSecuredDataServer), connectionString);
                var securityClient =
                    new ServerSecurityClient(clientDataServer, new ClientInfoFactory()){IsSupportChangePassword = true};
                winApplication.ApplicationName = "SecuritySystemExample";
                winApplication.Security = securityClient;
                winApplication.CreateCustomObjectSpaceProvider +=
                    delegate(object sender, CreateCustomObjectSpaceProviderEventArgs e) {
                        e.ObjectSpaceProvider =
                            new DataServerObjectSpaceProvider(clientDataServer, securityClient);
                    };
                winApplication.Setup();
                winApplication.Start();
            }
            catch (Exception e) {
                winApplication.HandleException(e);
            }
        }
Beispiel #29
0
        /// <summary>
        /// Create a new person entity and set
        /// the given values on it.
        /// </summary>
        /// <param name="values">The values which the person entity should be created with.</param>
        public PersonEntity(Hashtable values)
            : this()
        {
            Contract.Requires(values != null);

            this.ValueObject.SetValues(values);
        }
Beispiel #30
0
        public static string FormatTagsTable(Hashtable tags)
        {
            if (tags == null || tags.Count == 0)
            {
                return null;
            }

            StringBuilder resourcesTable = new StringBuilder();

            var tagsDictionary = TagsConversionHelper.CreateTagDictionary(tags, false);

            int maxNameLength = Math.Max("Name".Length, tagsDictionary.Max(tag => tag.Key.Length));
            int maxValueLength = Math.Max("Value".Length, tagsDictionary.Max(tag => tag.Value.Length));

            string rowFormat = "{0, -" + maxNameLength + "}  {1, -" + maxValueLength + "}\r\n";
            resourcesTable.AppendLine();
            resourcesTable.AppendFormat(rowFormat, "Name", "Value");
            resourcesTable.AppendFormat(rowFormat,
                GeneralUtilities.GenerateSeparator(maxNameLength, "="),
                GeneralUtilities.GenerateSeparator(maxValueLength, "="));

            foreach (var tag in tagsDictionary)
            {
                if (tag.Key.StartsWith(ExcludedTagPrefix))
                {
                    continue;
                }

                resourcesTable.AppendFormat(rowFormat, tag.Key, tag.Value);
            }

            return resourcesTable.ToString();
        }
Beispiel #31
0
        public ApiResp Execute(System.Collections.Hashtable params_ht)
        {
            ApiResp resp = new ApiResp();

            resp.Code    = "0";
            resp.Message = "success";
            string jsonData = params_ht["json"].ToString();
            ICache cache    = null;

            try
            {
                dynamic jsonObj = DynamicJson.Parse(jsonData);
                string  carId   = "";
                if (jsonObj.IsDefined("carId"))
                {
                    carId = jsonObj.carId;
                }
                double alarm = 0;
                if (jsonObj.IsDefined("alarm"))
                {
                    alarm = jsonObj.alarm;
                }
                Logger.Warn("告警信息:" + carId + ",参数:" + jsonData);

                VehicleManager      vm           = new VehicleManager();
                VehicleAlarmManager alarmManager = new VehicleAlarmManager();
                Hashtable           vehicle_ht   = vm.GetVehicleIByGPSNum(carId);
                if (alarm == 6 && vehicle_ht != null && vehicle_ht.Keys.Count > 0)
                {
                    string cacheKey = "alarm_" + carId + "_" + alarm;
                    cache = CacheFactory.GetCache();
                    if (!string.IsNullOrEmpty(cache.Get <string>(cacheKey)))
                    {
                        cache.Dispose();
                        Logger.Warn("断电告警10分钟内," + carId);
                        resp.Code    = "1";
                        resp.Message = "";
                        return(resp);
                    }
                    int alarmType = 0;
                    //if (alarm == 3)
                    //{
                    //    振动
                    //    alarmType = 7;
                    //}
                    if (alarm == 6)
                    {
                        //断电
                        alarmType = 2;
                    }
                    string vid = vehicle_ht["ID"].ToString();
                    //车辆使用状态 1空闲,2预约中,3客户使用中,4运维操作中
                    string    useState = SiteHelper.GetHashTableValueByKey(vehicle_ht, "UseState");
                    Hashtable ht       = new Hashtable();
                    ht["ID"]          = Guid.NewGuid().ToString();
                    ht["VehicleID"]   = vid;
                    ht["IMEI"]        = carId;
                    ht["AlarmType"]   = alarmType;
                    ht["AlarmTime"]   = DateTime.Now;
                    ht["AlarmStatus"] = 0;
                    ht["CreateTime"]  = DateTime.Now;

                    bool result = false;
                    if (ht.Keys.Count > 0 && !"4".Equals(useState))
                    {
                        Logger.Warn("告警信息,参数:" + jsonData + ",车辆状态:" + useState + "(1空闲,2预约中,3客户使用中,4运维操作中)");
                        result = alarmManager.AddOrEdit(ht, null);
                        if (result)
                        {
                            DateTime dt = DateTime.Now.AddMinutes(10);
                            cache.Set(cacheKey, carId, dt - DateTime.Now);
                            cache.Dispose();
                        }
                    }
                    resp.Code    = result ? "0" : "1";
                    resp.Message = result ? "success" : "fail";
                }
                if (cache != null)
                {
                    cache.Dispose();
                }
                return(resp);
            }
            catch (Exception e)
            {
                if (cache != null)
                {
                    cache.Dispose();
                }
                Logger.Error("告警信息,参数:" + jsonData + ",异常:" + e);
                resp.Code    = "1";
                resp.Message = e.Message;
                return(resp);
            }
        }
Beispiel #32
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            IUser user = Users.GetUser(0, Users.GetLoggedOnUsername(), true, true);

            if (user.UserRole != UserRole.SiteManager)
            {
                this.showError("您没有权限执行此操作!");
                return;
            }
            string a = "false";

            if (base.Request.Form["isAdvPositions"] != null)
            {
                a = base.Request.Form["isAdvPositions"].ToString().ToLower().Trim();
            }
            if (a == "false")
            {
                this.savePath = "~/Storage/master/gallery/";
                this.saveUrl  = "/Storage/master/gallery/";
            }
            else
            {
                this.savePath = string.Format("{0}/fckfiles/Files/Image/", HiContext.Current.GetSkinPath());
                if (base.Request.ApplicationPath != "/")
                {
                    this.saveUrl = this.savePath.Substring(base.Request.ApplicationPath.Length);
                }
                else
                {
                    this.saveUrl = this.savePath;
                }
            }
            int num = 0;

            if (base.Request.Form["fileCategory"] != null)
            {
                int.TryParse(base.Request.Form["fileCategory"], out num);
            }
            string text = string.Empty;

            if (base.Request.Form["imgTitle"] != null)
            {
                text = base.Request.Form["imgTitle"];
            }
            System.Web.HttpPostedFile httpPostedFile = base.Request.Files["imgFile"];
            if (httpPostedFile == null)
            {
                this.showError("请先选择文件!");
                return;
            }
            if (!ResourcesHelper.CheckPostedFile(httpPostedFile))
            {
                this.showError("不能上传空文件,且必须是有效的图片文件!");
                return;
            }
            string text2 = base.Server.MapPath(this.savePath);

            if (!System.IO.Directory.Exists(text2))
            {
                this.showError("上传目录不存在。");
                return;
            }
            if (a == "false")
            {
                text2        += string.Format("{0}/", System.DateTime.Now.ToString("yyyyMM"));
                this.saveUrl += string.Format("{0}/", System.DateTime.Now.ToString("yyyyMM"));
            }
            if (!System.IO.Directory.Exists(text2))
            {
                System.IO.Directory.CreateDirectory(text2);
            }
            string fileName = httpPostedFile.FileName;

            if (text.Length == 0)
            {
                text = fileName;
            }
            string str      = System.IO.Path.GetExtension(fileName).ToLower();
            string str2     = System.DateTime.Now.ToString("yyyyMMddHHmmss_ffff", System.Globalization.DateTimeFormatInfo.InvariantInfo) + str;
            string filename = text2 + str2;
            string text3    = this.saveUrl + str2;

            try
            {
                httpPostedFile.SaveAs(filename);
                if (a == "false")
                {
                    Database database = DatabaseFactory.CreateDatabase();
                    System.Data.Common.DbCommand sqlStringCommand = database.GetSqlStringCommand("insert into Ecshop_PhotoGallery(CategoryId,PhotoName,PhotoPath,FileSize,UploadTime,LastUpdateTime)values(@cid,@name,@path,@size,@time,@time1)");
                    database.AddInParameter(sqlStringCommand, "cid", System.Data.DbType.Int32, num);
                    database.AddInParameter(sqlStringCommand, "name", System.Data.DbType.String, text);
                    database.AddInParameter(sqlStringCommand, "path", System.Data.DbType.String, text3);
                    database.AddInParameter(sqlStringCommand, "size", System.Data.DbType.Int32, httpPostedFile.ContentLength);
                    database.AddInParameter(sqlStringCommand, "time", System.Data.DbType.DateTime, System.DateTime.Now);
                    database.AddInParameter(sqlStringCommand, "time1", System.Data.DbType.DateTime, System.DateTime.Now);
                    database.ExecuteNonQuery(sqlStringCommand);
                }
            }
            catch
            {
                this.showError("保存文件出错!");
            }
            System.Collections.Hashtable hashtable = new System.Collections.Hashtable();
            hashtable["error"] = 0;
            hashtable["url"]   = Globals.ApplicationPath + text3;
            base.Response.AddHeader("Content-Type", "text/html; charset=UTF-8");
            base.Response.Write(JsonMapper.ToJson(hashtable));
            base.Response.End();
        }
Beispiel #33
0
 /// <summary> Method loadAndMergeMetaMap.</summary>
 /// <returns> MultiMap
 /// </returns>
 public static MultiMap LoadAndMergeMetaMap(Element classElement, MultiMap inheritedMeta)
 {
     return(MergeMetaMaps(loadMetaMap(classElement), inheritedMeta));
 }
Beispiel #34
0
    protected void GoToPayment()
    {
        try
        {
            string[] hashVarsSeq;
            string   hash_string    = string.Empty;
            string   strVirtualPath = Request.Url.GetLeftPart(UriPartial.Authority) + Request.ApplicationPath;

            Session["Description"] = TxtDesc.Text;
            //if(!strVirtualPath.Contains("https:"))
            //    strVirtualPath=strVirtualPath.Replace("http:", "https:");
            string surl = strVirtualPath + "PaymentSuccess.aspx";
            string furl = strVirtualPath + "PaymentFailure.aspx";
            string curl = strVirtualPath + "PayDetails.aspx";


            //string surl = ConfigurationManager.AppSettings["PAYU_SUC_URL"];
            //string furl = ConfigurationManager.AppSettings["PAYU_FAIL_URL"];
            //string curl = ConfigurationManager.AppSettings["PAYU_CURR_URL"];
            string email = payDetails.GetAdminParamsDetails().Rows[0]["MailIDs"].ToString();///Please get mail id from tblwmadmin
            //string sms = "";
            if (string.IsNullOrEmpty(txnid1))
            {
                Random rnd     = new Random();
                string strHash = Generatehash512(rnd.ToString() + DateTime.Now);
                txnid1 = strHash.ToString().Substring(0, 20);
            }
            hashVarsSeq = payDetails.GetAdminParamsDetails().Rows[0]["HashSequence"].ToString().Split('|');
            //ConfigurationManager.AppSettings["hashSequence"].Split('|');
            hash_string = "";
            foreach (string hash_var in hashVarsSeq)
            {
                if (hash_var == "key")
                {
                    hash_string = hash_string + payDetails.GetAdminParamsDetails().Rows[0]["MerchantKey"].ToString();
                    //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 + Math.Round(Convert.ToDecimal(TxtAmt.Text)).ToString("g29");
                    hash_string = hash_string + '|';
                }
                else if (hash_var.Equals("productinfo"))
                {
                    hash_string = hash_string + "MoSeMaSo";
                    hash_string = hash_string + '|';
                }
                else if (hash_var.Equals("firstname"))
                {
                    hash_string = hash_string + (payDetails.billingDetails.Rows[0]["AddressLine1"].ToString() != null ? payDetails.billingDetails.Rows[0]["AddressLine1"].ToString() : "");
                    hash_string = hash_string + '|';
                }
                else if (hash_var.Equals("email"))
                {
                    hash_string = hash_string + (email != null ? email : "");
                    hash_string = hash_string + '|';
                }
                //else if (hash_var.Equals("phone"))
                //{
                //    hash_string = hash_string + (LblContactNo.Text != null ? LblContactNo.Text : "");
                //    hash_string = hash_string + '|';
                //}
                else if (hash_var.Equals("udf1"))
                {
                    hash_string = hash_string + (TxtServiceTax.Text != null ? TxtServiceTax.Text : "");
                    hash_string = hash_string + '|';
                }
                else if (hash_var.Equals("udf2"))
                {
                    hash_string = hash_string + (TxtSBCess.Text != null ? TxtSBCess.Text : "");
                    hash_string = hash_string + '|';
                }
                else if (hash_var.Equals("udf3"))
                {
                    hash_string = hash_string + (TxtFinalAmt.Text != null ? TxtFinalAmt.Text : "");
                    hash_string = hash_string + '|';
                }
                else if (hash_var.Equals("udf4"))
                {
                    hash_string = hash_string + (TxtDesc.Text != null ? TxtDesc.Text : "");
                    hash_string = hash_string + '|';
                }
                else if (hash_var.Equals("udf5"))
                {
                    if (payDetails.rechargeDetails.Rows.Count > 0)
                    {
                        hash_string = hash_string + ((Math.Round(Convert.ToDouble(payDetails.rechargeDetails.Rows[0]["BALANCE"])).ToString() != null ? Math.Round(Convert.ToDouble(payDetails.rechargeDetails.Rows[0]["BALANCE"])).ToString() : ""));
                    }
                    else
                    {
                        hash_string = hash_string + "0";
                    }
                    hash_string = hash_string + '|';
                }
                else if (hash_var.Equals("udf6"))
                {
                    hash_string = hash_string + (payDetails.billingDetails.Rows[0]["InvoiceTo"].ToString() != null ? payDetails.billingDetails.Rows[0]["InvoiceTo"].ToString() : "");
                    hash_string = hash_string + '|';
                }
                else if (hash_var.Equals("udf7"))
                {
                    hash_string = hash_string + (payDetails.billingDetails.Rows[0]["AddressLine2"].ToString() != null ? payDetails.billingDetails.Rows[0]["AddressLine2"].ToString() : "");
                    hash_string = hash_string + '|';
                }
                else if (hash_var.Equals("udf10"))
                {
                    hash_string = hash_string + Convert.ToString(Session["PayUser"]);
                    hash_string = hash_string + '|';
                }
                else
                {
                    hash_string = hash_string + "";
                    hash_string = hash_string + '|';
                }
            }
            hash_string += payDetails.GetAdminParamsDetails().Rows[0]["Salt"].ToString();
            //ConfigurationManager.AppSettings["SALT"];

            hash1   = Generatehash512(hash_string).ToLower();
            action1 = payDetails.GetAdminParamsDetails().Rows[0]["PaybaseUrl"].ToString();
            //ConfigurationManager.AppSettings["PAYU_BASE_URL"] + "/_payment";

            if (!string.IsNullOrEmpty(hash1))
            {
                System.Collections.Hashtable data = new System.Collections.Hashtable();
                data.Add("hash", hash1);
                data.Add("txnid", txnid1);
                data.Add("key", payDetails.GetAdminParamsDetails().Rows[0]["MERCHANTKEY"].ToString());
                //ConfigurationManager.AppSettings["MERCHANT_KEY"]);
                string AmountForm = Math.Round(Convert.ToDecimal(TxtAmt.Text.Trim())).ToString("g29");
                TxtAmt.Text = AmountForm;

                //Recharge Details
                //paymentDetails.RechargeDate;



                data.Add("amount", AmountForm);
                data.Add("firstname", payDetails.billingDetails.Rows[0]["AddressLine1"].ToString().Trim());
                data.Add("email", email);
                //data.Add("phone", LblContactNo.Text.Trim());
                data.Add("productinfo", "MoSeMaSo");
                data.Add("surl", surl);
                data.Add("furl", furl);
                data.Add("lastname", "");
                data.Add("curl", curl);
                data.Add("address1", "");
                data.Add("address2", "");
                data.Add("city", "");
                data.Add("state", "");
                data.Add("country", "");
                data.Add("zipcode", "");

                /*paymentDetails.Amount = Math.Round(Convert.ToDecimal(AmountForm));
                 * paymentDetails.STax = Math.Round(Convert.ToDecimal(TxtServiceTax.Text));
                 * paymentDetails.SBCess = Math.Round(Convert.ToDecimal(TxtSBCess.Text));
                 * paymentDetails.FAmt = Math.Round(Convert.ToDecimal(TxtFinalAmt.Text));
                 * paymentDetails.Description = TxtDesc.Text;*/

                data.Add("udf1", TxtServiceTax.Text);
                data.Add("udf2", TxtSBCess.Text);
                data.Add("udf3", TxtFinalAmt.Text);
                data.Add("udf4", TxtDesc.Text);

                if (payDetails.rechargeDetails.Rows.Count > 0)
                {
                    data.Add("udf5", Math.Round(Convert.ToDouble(payDetails.rechargeDetails.Rows[0]["BALANCE"])).ToString());
                }
                else
                {
                    data.Add("udf5", "0");
                }

                //data.Add("udf5", Math.Round(Convert.ToDouble(payDetails.rechargeDetails.Rows[0]["BALANCE"])).ToString());
                data.Add("udf6", payDetails.billingDetails.Rows[0]["InvoiceTo"].ToString());
                data.Add("udf7", payDetails.billingDetails.Rows[0]["AddressLine2"].ToString());
                data.Add("udf8", "");
                data.Add("udf9", "");
                data.Add("udf10", Convert.ToString(Session["PayUser"]));

                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>");
        }
    }
Beispiel #35
0
    protected void gvProgramLeader_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        string idStr;

        Label lblIdTemp = null;

        lblIdTemp = (Label)gvProgramLeader.Rows[e.RowIndex].FindControl("lblId");
        if (lblIdTemp != null)
        {
            idStr = lblIdTemp.Text;
        }
        else
        {
            return;
        }

        DropDownList ddlProgramTemp = null;

        ddlProgramTemp = (DropDownList)gvProgramLeader.Rows[e.RowIndex].FindControl("ddlProgram");
        if (ddlProgramTemp == null)
        {
            return;
        }
        DropDownList ddlMemberTemp = null;

        ddlMemberTemp = (DropDownList)gvProgramLeader.Rows[e.RowIndex].FindControl("ddlMember");
        if (ddlMemberTemp == null)
        {
            return;
        }

        string sqlStatement =
            "Update program_leader" +
            " SET l_program_id=@l_program_id," +
            " client_id=@client_id" +
            " WHERE (program_leader_id = @program_leader_id)";

        //idStr;

        string        connectionStr = ConfigurationManager.ConnectionStrings["UcccPubMedDB"].ConnectionString;
        SqlConnection myConnection  = new SqlConnection(connectionStr);
        SqlCommand    command       = new SqlCommand(sqlStatement, myConnection);

        SqlParameter l_program_idParameter = new SqlParameter();

        l_program_idParameter.ParameterName = "@l_program_id";
        l_program_idParameter.SqlDbType     = SqlDbType.Int;
        l_program_idParameter.Value         = ddlProgramTemp.SelectedValue;
        command.Parameters.Add(l_program_idParameter);

        SqlParameter client_idParameter = new SqlParameter();

        client_idParameter.ParameterName = "@client_id";
        client_idParameter.SqlDbType     = SqlDbType.Int;
        client_idParameter.Value         = ddlProgramTemp.SelectedValue;
        command.Parameters.Add(client_idParameter);

        SqlParameter program_leader_idParameter = new SqlParameter();

        program_leader_idParameter.ParameterName = "@program_leader_id";
        program_leader_idParameter.SqlDbType     = SqlDbType.Int;
        program_leader_idParameter.Value         = System.Convert.ToInt32(lblIdTemp.Text);
        command.Parameters.Add(program_leader_idParameter);

        myConnection.Open();
        command.ExecuteNonQuery();
        myConnection.Close();

        gvProgramLeader.EditIndex = -1;

        FillProgramLeaderGrid();

        if (e.RowIndex > 0)
        {
            return; // RowIndex=0 is the row we want to insert
        }
        System.Collections.Hashtable h =
            new System.Collections.Hashtable();

        foreach (System.Collections.DictionaryEntry x in e.NewValues)
        {
            h[x.Key] = x.Value;
        }
    }
Beispiel #36
0
    static int Main(string[] args)
    {
        Tracer.EnableTraceConsoleListener();
        Tracer.EnableTraceForDebug();
        System.Collections.Hashtable props = new System.Collections.Hashtable();
        string classpath = Environment.GetEnvironmentVariable("CLASSPATH");

        if (classpath == null || classpath == "")
        {
            classpath = ".";
        }
        props["java.class.path"] = classpath;
        bool   jar           = false;
        bool   saveAssembly  = false;
        bool   saveAssemblyX = false;
        bool   waitOnExit    = false;
        bool   showVersion   = false;
        string mainClass     = null;
        int    vmargsIndex   = -1;
        bool   debug         = false;
        String debugArg      = null;
        bool   noglobbing    = false;

        for (int i = 0; i < args.Length; i++)
        {
            String arg = args[i];
            if (arg[0] == '-')
            {
                if (arg == "-help" || arg == "-?")
                {
                    PrintHelp();
                    return(1);
                }
                else if (arg == "-X")
                {
                    PrintXHelp();
                    return(1);
                }
                else if (arg == "-Xsave")
                {
                    saveAssembly = true;
                    IKVM.Internal.Starter.PrepareForSaveDebugImage();
                }
                else if (arg == "-XXsave")
                {
                    saveAssemblyX = true;
                    IKVM.Internal.Starter.PrepareForSaveDebugImage();
                }
                else if (arg == "-Xtime")
                {
                    new Timer();
                }
                else if (arg == "-Xwait")
                {
                    waitOnExit = true;
                }
                else if (arg == "-Xbreak")
                {
                    System.Diagnostics.Debugger.Break();
                }
                else if (arg == "-Xnoclassgc")
                {
                    IKVM.Internal.Starter.ClassUnloading = false;
                }
                else if (arg == "-Xverify")
                {
                    IKVM.Internal.Starter.RelaxedVerification = false;
                }
                else if (arg == "-jar")
                {
                    jar = true;
                }
                else if (arg == "-version")
                {
                    Console.WriteLine(Startup.getVersionAndCopyrightInfo());
                    Console.WriteLine();
                    Console.WriteLine("CLR version: {0} ({1} bit)", Environment.Version, IntPtr.Size * 8);
                    System.Type type = System.Type.GetType("Mono.Runtime");
                    if (type != null)
                    {
                        Console.WriteLine("Mono version: {0}", type.InvokeMember("GetDisplayName", BindingFlags.InvokeMethod | BindingFlags.Static | BindingFlags.NonPublic, null, null, new object[0]));
                    }
                    foreach (Assembly asm in AppDomain.CurrentDomain.GetAssemblies())
                    {
                        Console.WriteLine("{0}: {1}", asm.GetName().Name, asm.GetName().Version);
                    }
                    string ver = java.lang.System.getProperty("openjdk.version");
                    if (ver != null)
                    {
                        Console.WriteLine("OpenJDK version: {0}", ver);
                    }
                    return(0);
                }
                else if (arg == "-showversion")
                {
                    showVersion = true;
                }
                else if (arg.StartsWith("-D"))
                {
                    arg = arg.Substring(2);
                    string[] keyvalue = arg.Split('=');
                    string   value;
                    if (keyvalue.Length == 2)                    // -Dabc=x
                    {
                        value = keyvalue[1];
                    }
                    else if (keyvalue.Length == 1) // -Dabc
                    {
                        value = "";
                    }
                    else // -Dabc=x=y
                    {
                        value = arg.Substring(keyvalue[0].Length + 1);
                    }
                    props[keyvalue[0]] = value;
                }
                else if (arg == "-ea" || arg == "-enableassertions")
                {
                    IKVM.Runtime.Assertions.EnableAssertions();
                }
                else if (arg == "-da" || arg == "-disableassertions")
                {
                    IKVM.Runtime.Assertions.DisableAssertions();
                }
                else if (arg == "-esa" || arg == "-enablesystemassertions")
                {
                    IKVM.Runtime.Assertions.EnableSystemAssertions();
                }
                else if (arg == "-dsa" || arg == "-disablesystemassertions")
                {
                    IKVM.Runtime.Assertions.DisableSystemAssertions();
                }
                else if (arg.StartsWith("-ea:") || arg.StartsWith("-enableassertions:"))
                {
                    IKVM.Runtime.Assertions.EnableAssertions(arg.Substring(arg.IndexOf(':') + 1));
                }
                else if (arg.StartsWith("-da:") || arg.StartsWith("-disableassertions:"))
                {
                    IKVM.Runtime.Assertions.DisableAssertions(arg.Substring(arg.IndexOf(':') + 1));
                }
                else if (arg == "-cp" || arg == "-classpath")
                {
                    props["java.class.path"] = args[++i];
                }
                else if (arg.StartsWith("-Xtrace:"))
                {
                    Tracer.SetTraceLevel(arg.Substring(8));
                }
                else if (arg.StartsWith("-Xmethodtrace:"))
                {
                    Tracer.HandleMethodTrace(arg.Substring(14));
                }
                else if (arg == "-Xdebug")
                {
                    debug = true;
                }
                else if (arg == "-Xnoagent")
                {
                    //ignore it, disable support for oldjdb
                }
                else if (arg.StartsWith("-Xrunjdwp") || arg.StartsWith("-agentlib:jdwp"))
                {
                    debugArg = arg;
                    debug    = true;
                }
                else if (arg.StartsWith("-Xreference:"))
                {
                    Startup.addBootClassPathAssembly(Assembly.LoadFrom(arg.Substring(12)));
                }
                else if (arg == "-Xnoglobbing")
                {
                    noglobbing = true;
                }
                else if (arg == "-XX:+AllowNonVirtualCalls")
                {
                    IKVM.Internal.Starter.AllowNonVirtualCalls = true;
                }
                else if (arg.StartsWith("-Xms") ||
                         arg.StartsWith("-Xmx") ||
                         arg.StartsWith("-Xmn") ||
                         arg.StartsWith("-Xss") ||
                         arg.StartsWith("-XX:") ||
                         arg == "-Xmixed" ||
                         arg == "-Xint" ||
                         arg == "-Xincgc" ||
                         arg == "-Xbatch" ||
                         arg == "-Xfuture" ||
                         arg == "-Xrs" ||
                         arg == "-Xcheck:jni" ||
                         arg == "-Xshare:off" ||
                         arg == "-Xshare:auto" ||
                         arg == "-Xshare:on"
                         )
                {
                    Console.Error.WriteLine("Unsupported option ignored: {0}", arg);
                }
                else if (arg.StartsWith("-Xoptimize:"))
                {
                    try{
                        Helper.optpasses = (int)Convert.ToUInt32(arg.Replace("-Xoptimize:", ""));
                    } catch {
                        Console.Error.WriteLine("SORRY, IKVM.NET experimental optimizations disabled, reason: negative or invalid number of optimization passes.");
                    }
                }
                else if (arg == "-Xextremeoptimize")
                {
                    Helper.extremeOptimizations = true;
                }
                else if (arg == "-Xpreoptimize")
                {
                    Helper.enableJITPreOptimization = true;
                }
                else
                {
                    Console.Error.WriteLine("{0}: illegal argument", arg);
                    break;
                }
            }
            else
            {
                mainClass   = arg;
                vmargsIndex = i + 1;
                break;
            }
        }
        if (mainClass == null || showVersion)
        {
            Console.Error.WriteLine(Startup.getVersionAndCopyrightInfo());
            Console.Error.WriteLine();
        }
        if (mainClass == null)
        {
            PrintHelp();
            return(1);
        }
        try
        {
            if (debug)
            {
                // Starting the debugger
                Assembly asm       = Assembly.GetExecutingAssembly();
                String   arguments = debugArg + " -pid:" + System.Diagnostics.Process.GetCurrentProcess().Id;
                String   program   = new FileInfo(asm.Location).DirectoryName + "\\debugger.exe";
                try
                {
                    ProcessStartInfo info = new ProcessStartInfo(program, arguments);
                    info.UseShellExecute = false;
                    Process debugger = new Process();
                    debugger.StartInfo = info;
                    debugger.Start();
                }
                catch (Exception ex)
                {
                    Console.Error.WriteLine(program + " " + arguments);
                    throw ex;
                }
            }
            if (jar)
            {
                props["java.class.path"] = mainClass;
            }
            // like the JDK we don't quote the args (even if they contain spaces)
            props["sun.java.command"]  = String.Join(" ", args, vmargsIndex - 1, args.Length - (vmargsIndex - 1));
            props["sun.java.launcher"] = "SUN_STANDARD";
            Startup.setProperties(props);
            Startup.enterMainThread();
            string[] vmargs;
            if (noglobbing)
            {
                vmargs = new string[args.Length - vmargsIndex];
                System.Array.Copy(args, vmargsIndex, vmargs, 0, vmargs.Length);
            }
            else
            {
                // Startup.glob() uses Java code, so we need to do this after we've initialized
                vmargs = Startup.glob(args, vmargsIndex);
            }
            try
            {
                java.lang.Class clazz = sun.launcher.LauncherHelper.checkAndLoadMain(true, jar ? 2 : 1, mainClass);
                // we don't need to do any checking on the main method, as that was already done by checkAndLoadMain
                Method method = clazz.getMethod("main", typeof(string[]));
                // if clazz isn't public, we can still call main
                method.setAccessible(true);
                if (saveAssembly)
                {
                    java.lang.Runtime.getRuntime().addShutdownHook(new SaveAssemblyShutdownHook(clazz));
                }
                if (waitOnExit)
                {
                    java.lang.Runtime.getRuntime().addShutdownHook(new WaitShutdownHook());
                }
                try
                {
                    method.invoke(null, new object[] { vmargs });
                    return(0);
                }
                catch (InvocationTargetException x)
                {
                    throw x.getCause();
                }
            }
            finally
            {
                if (saveAssemblyX)
                {
                    IKVM.Internal.Starter.SaveDebugImage();
                }
            }
        }
        catch (System.Exception x)
        {
            java.lang.Thread thread = java.lang.Thread.currentThread();
            thread.getThreadGroup().uncaughtException(thread, ikvm.runtime.Util.mapException(x));
        }
        finally
        {
            Startup.exitMainThread();
        }
        return(1);
    }
Beispiel #37
0
 /// <summary>
 /// 判断当前给予角色的权限,是否在登录用户的权限树中
 /// </summary>
 /// <param name="perId">权限编号</param>
 /// <param name="context"></param>
 /// <returns></returns>
 public static bool CheckDeptRolePermission(int perId, HttpContext context)
 {
     System.Collections.Hashtable htb = (System.Collections.Hashtable)context.Session["permission"];
     return(htb.Contains(perId));
 }
Beispiel #38
0
    // $ANTLR end method


    // $ANTLR start body
    // T.g:44:1: body : lcurly= '{' ( stat )* '}' ;
    public void body() // throws RecognitionException [1]
    {
        body_stack.Push(new body_scope());
        IToken lcurly = null;


        $body::decls = new Hashtable();

        try
        {
            // T.g:55:5: (lcurly= '{' ( stat )* '}' )
            // T.g:55:9: lcurly= '{' ( stat )* '}'
            {
                lcurly = (IToken)input.LT(1);
                Match(input, 10, FOLLOW_10_in_body127);
                // T.g:55:20: ( stat )*
                do
                {
                    int alt2  = 2;
                    int LA2_0 = input.LA(1);

                    if ((LA2_0 == ID))
                    {
                        alt2 = 1;
                    }


                    switch (alt2)
                    {
                    case 1:
                        // T.g:55:20: stat
                    {
                        PushFollow(FOLLOW_stat_in_body129);
                        stat();
                        state.followingStackPointer--;
                    }
                    break;

                    default:
                        goto loop2;
                    }
                } while (true);

loop2:
                ;               // Stops C# compiler whining that label 'loop2' has no statements

                Match(input, 11, FOLLOW_11_in_body132);

                // dump declarations for all identifiers seen in statement list
                foreach (DictionaryEntry e in $body::decls)
                {
                    tokens.InsertAfter(lcurly, "\nint " + e.Value + ";");
                }
            }
        }
        catch (RecognitionException re)
        {
            ReportError(re);
            Recover(input, re);
        }
        finally
        {
            body_stack.Pop();
        }
        return;
    }
Beispiel #39
0
    /// <summary>
    /// Move the unit to the specified target node. Will make a callback with
    /// eventCode=1 when done moving if a callback was set in Init()
    /// iTween (free on Unity Asset Store) is used to move the Unit
    /// </summary>
    /// <param name="map">NavMap to use</param>
    /// <param name="targetNode">Node to reach</param>
    /// <param name="moves">
    /// Number of moves that can be use to reach target. Pass (-1) to ignore this.
    /// The unit will move as close as possible if not enough moves given.
    /// Moves will be set to moves - actual_moves_use; or if -1 passed, it will be set to number of moves that was taken.
    /// </param>
    /// <returns>True is the unit started moving towards the target</returns>
    public bool MoveTo(MapNav map, TileNode targetNode, ref int moves)
    {
        if (moves == 0)
        {
            return(false);
        }

        TileNode[] path = map.GetPath(this.node, targetNode, this.tileLevel);
        if (path == null)
        {
            return(false);
        }
        if (path.Length == 0)
        {
            return(false);
        }

        // check if enough moves to reach destination
        int useMoves = path.Length;

        if (moves >= 0)
        {
            if (moves <= useMoves)
            {
                useMoves = moves; moves = 0;
            }
            else
            {
                moves -= useMoves;
            }
        }
        else
        {
            moves = path.Length;
        }

        // unlink with current node and link with destination node
        this.node.units.Remove(this);
        this.node = path[useMoves - 1];
        this.node.units.Add(this);

        isMoving = true;

        // *** start jumping from tile to tile
        if (jumpMovement)
        {
            _jump_points   = new Vector3[useMoves];
            _jump_pointIdx = 0;
            for (int i = 0; i < useMoves; i++)
            {
                _jump_points[i] = path[i].transform.position;
            }
            _JumpToNextPoint();
        }

        // *** start normal movement from tile to tile
        else
        {
            System.Collections.Hashtable opt = iTween.Hash(
                "orienttopath", true,
                "easetype", "linear",
                "oncomplete", "_OnCompleteMoveTo",
                "oncompletetarget", gameObject);

            if (!tiltToPath)
            {
                opt.Add("axis", "y");
            }

            if ((adjustNormals || adjustToCollider) && adjustmentLayerMask != 0)
            {
                opt.Add("onupdate", "_OnMoveToUpdate");
                opt.Add("onupdatetarget", gameObject);
            }

            if (path.Length > 1)
            {
                Vector3[] points = new Vector3[useMoves];
                for (int i = 0; i < useMoves; i++)
                {
                    points[i] = path[i].transform.position;
                }
                endPointToReach = points[points.Length - 1];
                opt.Add("path", points);
                opt.Add("speed", ((moveSpeedMulti * useMoves) + 1f) * moveSpeed);
                iTween.MoveTo(this.gameObject, opt);
            }
            else
            {
                endPointToReach = path[0].transform.position;
                opt.Add("position", endPointToReach);
                opt.Add("speed", moveSpeed);
                iTween.MoveTo(this.gameObject, opt);
            }
        }

        return(true);
    }
 static public int constructor(IntPtr l)
 {
     try {
         int argc = LuaDLL.lua_gettop(l);
         System.Collections.Hashtable o;
         if (argc == 1)
         {
             o = new System.Collections.Hashtable();
             pushValue(l, true);
             pushValue(l, o);
             return(2);
         }
         else if (matchType(l, argc, 2, typeof(int), typeof(float)))
         {
             System.Int32 a1;
             checkType(l, 2, out a1);
             System.Single a2;
             checkType(l, 3, out a2);
             o = new System.Collections.Hashtable(a1, a2);
             pushValue(l, true);
             pushValue(l, o);
             return(2);
         }
         else if (matchType(l, argc, 2, typeof(int)))
         {
             System.Int32 a1;
             checkType(l, 2, out a1);
             o = new System.Collections.Hashtable(a1);
             pushValue(l, true);
             pushValue(l, o);
             return(2);
         }
         else if (matchType(l, argc, 2, typeof(System.Collections.IDictionary), typeof(float)))
         {
             System.Collections.IDictionary a1;
             checkType(l, 2, out a1);
             System.Single a2;
             checkType(l, 3, out a2);
             o = new System.Collections.Hashtable(a1, a2);
             pushValue(l, true);
             pushValue(l, o);
             return(2);
         }
         else if (matchType(l, argc, 2, typeof(System.Collections.IDictionary)))
         {
             System.Collections.IDictionary a1;
             checkType(l, 2, out a1);
             o = new System.Collections.Hashtable(a1);
             pushValue(l, true);
             pushValue(l, o);
             return(2);
         }
         else if (matchType(l, argc, 2, typeof(System.Collections.IDictionary), typeof(System.Collections.IEqualityComparer)))
         {
             System.Collections.IDictionary a1;
             checkType(l, 2, out a1);
             System.Collections.IEqualityComparer a2;
             checkType(l, 3, out a2);
             o = new System.Collections.Hashtable(a1, a2);
             pushValue(l, true);
             pushValue(l, o);
             return(2);
         }
         else if (matchType(l, argc, 2, typeof(System.Collections.IDictionary), typeof(float), typeof(System.Collections.IEqualityComparer)))
         {
             System.Collections.IDictionary a1;
             checkType(l, 2, out a1);
             System.Single a2;
             checkType(l, 3, out a2);
             System.Collections.IEqualityComparer a3;
             checkType(l, 4, out a3);
             o = new System.Collections.Hashtable(a1, a2, a3);
             pushValue(l, true);
             pushValue(l, o);
             return(2);
         }
         else if (matchType(l, argc, 2, typeof(System.Collections.IEqualityComparer)))
         {
             System.Collections.IEqualityComparer a1;
             checkType(l, 2, out a1);
             o = new System.Collections.Hashtable(a1);
             pushValue(l, true);
             pushValue(l, o);
             return(2);
         }
         else if (matchType(l, argc, 2, typeof(int), typeof(System.Collections.IEqualityComparer)))
         {
             System.Int32 a1;
             checkType(l, 2, out a1);
             System.Collections.IEqualityComparer a2;
             checkType(l, 3, out a2);
             o = new System.Collections.Hashtable(a1, a2);
             pushValue(l, true);
             pushValue(l, o);
             return(2);
         }
         else if (matchType(l, argc, 2, typeof(int), typeof(float), typeof(System.Collections.IEqualityComparer)))
         {
             System.Int32 a1;
             checkType(l, 2, out a1);
             System.Single a2;
             checkType(l, 3, out a2);
             System.Collections.IEqualityComparer a3;
             checkType(l, 4, out a3);
             o = new System.Collections.Hashtable(a1, a2, a3);
             pushValue(l, true);
             pushValue(l, o);
             return(2);
         }
         return(error(l, "New object failed."));
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Beispiel #41
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            Amount      = Session["Amount"].ToString();
            FirstName   = Session["FirstName"].ToString();
            Email       = Session["Email"].ToString();
            PhoneNo     = Session["PhoneNo"].ToString();
            ProductInfo = Session["ProductInfo"].ToString();
            SURL        = Session["SuccessURL"].ToString();
            FURL        = Session["FailureURL"].ToString();

            //set merchant key from web.config or AppSettings
            Key = MERCHANT_KEY;

            if (!IsPostBack)
            {
                frmError.Visible = false; // error form
            }
            else
            {
                //frmError.Visible = true;
            }
            //if (string.IsNullOrEmpty(Request.Form["hash"]))
            //{
            //    submit.Visible = true;
            //}
            //else
            //{
            //    submit.Visible = false;
            //}
            //Button1_Click(this.submit,e);
            #region ButtonClick

            try
            {
                string[] hashVarsSeq;
                string   hash_string = string.Empty;


                if (string.IsNullOrEmpty(TxnID)) // generating txnid
                {
                    Random rnd     = new Random();
                    string strHash = Generatehash512(rnd.ToString() + DateTime.Now);
                    txnid1 = strHash.ToString().Substring(0, 20);
                }
                else
                {
                    txnid1 = TxnID;
                }
                if (string.IsNullOrEmpty(Hash)) // generating hash value
                {
                    if (
                        string.IsNullOrEmpty(MERCHANT_KEY) ||
                        string.IsNullOrEmpty(txnid1) ||
                        string.IsNullOrEmpty(Amount) ||
                        string.IsNullOrEmpty(FirstName) ||
                        string.IsNullOrEmpty(Email) ||
                        string.IsNullOrEmpty(PhoneNo) ||
                        string.IsNullOrEmpty(ProductInfo) ||
                        string.IsNullOrEmpty(SURL) ||
                        string.IsNullOrEmpty(FURL)
                        )
                    {
                        //error

                        frmError.Visible = true;
                        return;
                    }

                    else
                    {
                        frmError.Visible = false;
                        hashVarsSeq      = hashSequence.Split('|'); // spliting hash sequence from config
                        hash_string      = "";
                        foreach (string hash_var in hashVarsSeq)
                        {
                            if (hash_var == "key")
                            {
                                hash_string = hash_string + 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(Amount).ToString("g29");
                                hash_string = hash_string + '|';
                            }
                            else if (hash_var == "productinfo")
                            {
                                hash_string = hash_string + ProductInfo;
                                hash_string = hash_string + '|';
                            }
                            else if (hash_var == "firstname")
                            {
                                hash_string = hash_string + FirstName;
                                hash_string = hash_string + '|';
                            }
                            else if (hash_var == "email")
                            {
                                hash_string = hash_string + Email;
                                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 += SALT;                              // appending SALT

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

                else if (!string.IsNullOrEmpty(Hash))
                {
                    hash1   = Hash;
                    action1 = PAYU_BASE_URL + "/_payment";
                }



                if (!string.IsNullOrEmpty(hash1))
                {
                    Hash  = hash1;
                    TxnID = txnid1;

                    System.Collections.Hashtable data = new System.Collections.Hashtable(); // adding values in gash table for data post
                    data.Add("hash", Hash);
                    data.Add("txnid", TxnID);
                    data.Add("key", Key);
                    string AmountForm = Convert.ToDecimal(Amount.Trim()).ToString("g29");// eliminating trailing zeros
                    //amount.Text = AmountForm;
                    data.Add("amount", AmountForm);
                    data.Add("firstname", FirstName.Trim());
                    data.Add("email", Email.Trim());
                    data.Add("phone", PhoneNo.Trim());
                    data.Add("productinfo", ProductInfo.Trim());
                    data.Add("surl", SURL.Trim());
                    data.Add("furl", FURL.Trim());
                    data.Add("lastname", LastName.Trim());
                    data.Add("curl", CURL.Trim());
                    data.Add("address1", Address1.Trim());
                    data.Add("address2", Address2.Trim());
                    data.Add("city", City.Trim());
                    data.Add("state", State.Trim());
                    data.Add("country", Country.Trim());
                    data.Add("zipcode", ZipCode.Trim());
                    data.Add("udf1", UDF1.Trim());
                    data.Add("udf2", UDF2.Trim());
                    data.Add("udf3", UDF3.Trim());
                    data.Add("udf4", UDF4.Trim());
                    data.Add("udf5", UDF5.Trim());
                    data.Add("pg", PG.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>");
            }
            #endregion
            // Button Click
        }
        catch (Exception ex)
        {
            Response.Write("<span style='color:red'>" + ex.Message + "</span>");
        }
    }
Beispiel #42
0
        /// <summary>
        /// 多表查询 - 分页
        /// </summary>
        /// <param name="key">主键字段</param>
        /// <param name="field">要查询的字段,如:* | Id,Field</param>
        /// <param name="table">表名</param>
        /// <param name="htCondition">条件字符串</param>
        /// <param name="order">排序,包括排序字段和排序方式(如:id desc)</param>
        /// <param name="pageIndex">当前页码</param>
        /// <param name="pageSize">每页显示行数</param>
        /// <param name="recordCount">总行数</param>
        /// <param name="pageCount">总共页码数</param>
        /// <returns></returns>
        public System.Data.DataTable GetDataTable(string key, string field, string table, System.Collections.Hashtable htCondition,
                                                  string order, int pageIndex, int pageSize, out int recordCount, out int pageCount)
        {
            Array  args;
            string condition = GetConditionString(htCondition, out args);

            return(GetDataTable(key, field, table, condition, order, args, pageIndex, pageSize, out recordCount, out pageCount));
        }
Beispiel #43
0
        protected void savedata()
        {
            try
            {
                int colpos     = 1;
                int val        = 0;
                int firstindex = 0;
                int dayid      = 0;

                System.Collections.Hashtable hsLeavePos = new System.Collections.Hashtable();
                colpos++;
                hsLeavePos.Add(colpos, 1);
                colpos++;
                hsLeavePos.Add(colpos, 1);
                colpos++;
                hsLeavePos.Add(colpos, 2);
                colpos++;
                hsLeavePos.Add(colpos, 2);
                colpos++;
                hsLeavePos.Add(colpos, 3);
                colpos++;
                hsLeavePos.Add(colpos, 3);
                colpos++;
                hsLeavePos.Add(colpos, 4);
                colpos++;
                hsLeavePos.Add(colpos, 4);
                colpos++;
                hsLeavePos.Add(colpos, 5);
                colpos++;
                hsLeavePos.Add(colpos, 5);
                colpos++;
                hsLeavePos.Add(colpos, 6);
                colpos++;
                hsLeavePos.Add(colpos, 6);
                colpos++;
                hsLeavePos.Add(colpos, 7);
                colpos++;
                hsLeavePos.Add(colpos, 7);
                objmysqldb.ConnectToDatabase();
                objmysqldb.OpenSQlConnection();
                foreach (GridViewRow row in grdEmplist.Rows)
                {
                    Label    EmpId       = (Label)grdEmplist.Rows[row.RowIndex].FindControl("lblEmp_id");
                    Label    Empname     = (Label)grdEmplist.Rows[row.RowIndex].FindControl("lblEmp_Name");
                    TextBox  txtmonhalf  = (TextBox)grdEmplist.Rows[row.RowIndex].FindControl("txtmonhalf");
                    TextBox  txtmonfull  = (TextBox)grdEmplist.Rows[row.RowIndex].FindControl("txtmonfull");
                    TextBox  txttuehalf  = (TextBox)grdEmplist.Rows[row.RowIndex].FindControl("txttuehalf");
                    TextBox  txttuefull  = (TextBox)grdEmplist.Rows[row.RowIndex].FindControl("txttuefull");
                    TextBox  txtwedhalf  = (TextBox)grdEmplist.Rows[row.RowIndex].FindControl("txtwedhalf");
                    TextBox  txtwedfull  = (TextBox)grdEmplist.Rows[row.RowIndex].FindControl("txtwedfull");
                    TextBox  txtthuhalf  = (TextBox)grdEmplist.Rows[row.RowIndex].FindControl("txtthuhalf");
                    TextBox  txtthufull  = (TextBox)grdEmplist.Rows[row.RowIndex].FindControl("txtthufull");
                    TextBox  txtfrihalf  = (TextBox)grdEmplist.Rows[row.RowIndex].FindControl("txtfrihalf");
                    TextBox  txtfrifull  = (TextBox)grdEmplist.Rows[row.RowIndex].FindControl("txtfrifull");
                    TextBox  txtsathalf  = (TextBox)grdEmplist.Rows[row.RowIndex].FindControl("txtsathalf");
                    TextBox  txtsatfull  = (TextBox)grdEmplist.Rows[row.RowIndex].FindControl("txtsatfull");
                    TextBox  txtsunhalf  = (TextBox)grdEmplist.Rows[row.RowIndex].FindControl("txtsunhalf");
                    TextBox  txtsunfull  = (TextBox)grdEmplist.Rows[row.RowIndex].FindControl("txtsunfull");
                    DateTime currenttime = Logger.getIndiantimeDT();
                    int      empidint    = int.Parse(EmpId.Text.ToString());
                    string   monhalf     = txtmonhalf.Text.ToString();
                    string   monfull     = txtmonfull.Text.ToString();
                    string   tuehalf     = txttuehalf.Text.ToString();
                    string   tuefull     = txttuefull.Text.ToString();
                    string   wedhalf     = txtwedhalf.Text.ToString();
                    string   wedfull     = txtwedfull.Text.ToString();
                    string   thuhalf     = txtthuhalf.Text.ToString();
                    string   thufull     = txtthufull.Text.ToString();
                    string   frihalf     = txtfrihalf.Text.ToString();
                    string   frifull     = txtfrifull.Text.ToString();
                    string   sathalf     = txtsathalf.Text.ToString();
                    string   satfull     = txtsatfull.Text.ToString();
                    string   sunhalf     = txtsunhalf.Text.ToString();
                    string   sunfull     = txtsunfull.Text.ToString();
                    string   Total_half  = "";
                    string   Total_full  = "";
                    if (txtmonhalf.Text != "" || txtmonfull.Text != "" || txttuehalf.Text != "" || txttuefull.Text != "" || txtwedhalf.Text != "" || txtwedfull.Text != "" || txtthuhalf.Text != "" || txtthufull.Text != "" || txtfrihalf.Text != "" || txtfrifull.Text != "" || txtsathalf.Text != "" || txtsatfull.Text != "" || txtsunhalf.Text != "" || txtsunfull.Text != "")
                    {
                        foreach (DictionaryEntry KeyId in hsLeavePos)
                        {
                            dayid      = (int)KeyId.Key;
                            firstindex = (int)KeyId.Value;
                            string ColName = grdEmplist.Columns[dayid].HeaderText.ToString();


                            if (ColName == "Mon Half")
                            {
                                Total_half = monhalf;
                            }
                            if (ColName == "Mon Full")
                            {
                                Total_full = monfull;
                            }
                            if (ColName == "Tue Half")
                            {
                                Total_half = tuehalf;
                            }
                            if (ColName == "Tue Full")
                            {
                                Total_full = tuefull;
                            }
                            if (ColName == "Wed Half")
                            {
                                Total_half = wedhalf;
                            }
                            if (ColName == "Wed Full")
                            {
                                Total_full = wedfull;
                            }
                            if (ColName == "Thu Half")
                            {
                                Total_half = thuhalf;
                            }
                            if (ColName == "Thu Full")
                            {
                                Total_full = thufull;
                            }
                            if (ColName == "Fri Half")
                            {
                                Total_half = frihalf;
                            }
                            if (ColName == "Fri Full")
                            {
                                Total_full = frifull;
                            }
                            if (ColName == "Sat Half")
                            {
                                Total_half = sathalf;
                            }
                            if (ColName == "Sat Full")
                            {
                                Total_full = satfull;
                            }
                            if (ColName == "Sun Half")
                            {
                                Total_half = sunhalf;
                            }
                            if (ColName == "Sun Full")
                            {
                                Total_full = sunfull;
                            }
                            if (Total_full != "" || Total_half != "")
                            {
                                val = objmysqldb.InsertUpdateDeleteData("update employee_half_full_day_configuration set empid=" + empidint + ",half_hour='" + Total_half + "',full_hour='" + Total_full + "',modify_datetime=" + currenttime.Ticks + ",IsUpdate=1 where empid=" + empidint + " and dayid=" + firstindex + "");

                                if (val == 0)
                                {
                                    val = objmysqldb.InsertUpdateDeleteData("insert into employee_half_full_day_configuration(empid,dayid,half_hour,full_hour,modify_datetime,DOC,IsUpdate,UserID)values(" + empidint + "," + firstindex + ",'" + Total_half + "','" + Total_full + "'," + currenttime.Ticks + "," + currenttime.Ticks + ",0," + user_id + ")");
                                }
                                if (val == 1)
                                {
                                    ltrErr.Text = "Data Save Successfully..";
                                }
                            }
                        }
                    }
                    else
                    {
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.WriteCriticalLog("EmployeeHalfFullDayConfiguration_savedata() 275: exception:" + ex.Message + "::::::::" + ex.StackTrace);
            }
            finally
            {
                objmysqldb.CloseSQlConnection();
                objmysqldb.disposeConnectionObj();
            }
        }
Beispiel #44
0
    public override void ProcessActivity(WebRequest request, WebResponse response)
    {
        var user = UMC.Security.Identity.Current;

        if (request.SendValue == "Info")
        {
            var pri  = UMC.Security.Principal.Current;
            var info = new System.Collections.Hashtable();
            if (user.IsAuthenticated)
            {
                info["Alias"] = user.Alias;
                info["Src"]   = UMC.Data.WebResource.Instance().ResolveUrl(user.Id.Value, "1", 4);// user.Alias;
            }
            info["IsCashier"] = request.IsCashier;
            info["TimeSpan"]  = UMC.Data.Utility.TimeSpan();
            info["Device"]    = UMC.Data.Utility.Guid(UMC.Security.AccessToken.Token.Value);

            var ContentType = pri.SpecificData.ContentType;
            if (String.IsNullOrEmpty(ContentType) == false)
            {
                if (ContentType.StartsWith("WeiXin"))
                {
                    info["IsWeiXin"] = true;
                }
                else if (ContentType.StartsWith("Client"))
                {
                    info["IsClient"] = true;
                }
                else if (ContentType.StartsWith("Corp"))
                {
                    info["IsCorp"] = true;
                }
            }
            response.Redirect(info);
        }
        else if (request.SendValue == "Login")
        {
            if (user.IsAuthenticated == false)
            {
                this.Context.Send("Login", true);
            }
            return;
        }
        else if (request.SendValue == "User")
        {
            if (request.IsCashier == false)
            {
                response.Redirect("Settings", "Login");
            }
        }
        else if (request.SendValue == "Client")
        {
            if (user.IsAuthenticated == false)
            {
                response.Redirect("Account", "Login");
            }
            else
            {
                response.Redirect("Account", "Self");
            }
        }
        else if (request.SendValue == "Cashier")
        {
            if (request.IsCashier == false)
            {
                response.Redirect("Settings", "Login");
            }
            else
            {
                response.Redirect("Account", "Self");
            }
        }

        if (user.IsAuthenticated == false)
        {
            if (request.SendValue == "Event")
            {
                this.Context.Send(new UMC.Web.WebMeta().Put("type", "Login"), true);
            }
            else
            {
                response.Redirect("Account", "Login");
            }
        }
        this.Context.Send(new UMC.Web.WebMeta().UIEvent("Login", this.AsyncDialog("UI", "none"), new UMC.Web.WebMeta().Put("icon", "\uE91c", "format", "{icon}").Put("Alias", user.Alias).Put("click", new UIClick()
        {
            Command = "Self", Model = "Account"
        }).Put("style", new UIStyle().Name("icon", new UIStyle().Font("wdk")))), true);
    }
 private void InitializeComponent()
 {
     this.CanModifyActivities = true;
     System.Workflow.Activities.Rules.RuleConditionReference ruleconditionreference1 = new System.Workflow.Activities.Rules.RuleConditionReference();
     System.Collections.Hashtable hashtable1 = new System.Collections.Hashtable();
     System.Collections.Hashtable hashtable2 = new System.Collections.Hashtable();
     this.generateReport2       = new Easynet.Edge.Services.Alerts.AlertCustomActivities.GenerateReport();
     this.generateReport1       = new Easynet.Edge.Services.Alerts.AlertCustomActivities.GenerateReport();
     this.ifElseBranchActivity2 = new System.Workflow.Activities.IfElseBranchActivity();
     this.ifElseBranchActivity1 = new System.Workflow.Activities.IfElseBranchActivity();
     this.sendMail1             = new Easynet.Edge.Services.Alerts.AlertCustomActivities.SendMail();
     this.sendMessage1          = new Easynet.Edge.Core.Workflow.SendMessage();
     this.masterReport1         = new Easynet.Edge.Services.Alerts.AlertCustomActivities.MasterReport();
     this.ifElseActivity1       = new System.Workflow.Activities.IfElseActivity();
     this.account1 = new Easynet.Edge.Services.Alerts.AlertCustomActivities.Account();
     //
     // generateReport2
     //
     this.generateReport2.Name              = "generateReport2";
     this.generateReport2.ReportEntityType  = Easynet.Edge.Alerts.Core.EntityTypes.Account;
     this.generateReport2.ReportHeading     = "Falling";
     this.generateReport2.ReportHeadings    = "Account,";
     this.generateReport2.ReportMeasureDiff = Easynet.Edge.Alerts.Core.MeasureDiff.Smaller;
     //
     // generateReport1
     //
     this.generateReport1.Name              = "generateReport1";
     this.generateReport1.ReportEntityType  = Easynet.Edge.Alerts.Core.EntityTypes.Account;
     this.generateReport1.ReportHeading     = "Rising";
     this.generateReport1.ReportHeadings    = "Account,";
     this.generateReport1.ReportMeasureDiff = Easynet.Edge.Alerts.Core.MeasureDiff.Large;
     //
     // ifElseBranchActivity2
     //
     this.ifElseBranchActivity2.Activities.Add(this.generateReport2);
     this.ifElseBranchActivity2.Name = "ifElseBranchActivity2";
     //
     // ifElseBranchActivity1
     //
     this.ifElseBranchActivity1.Activities.Add(this.generateReport1);
     ruleconditionreference1.ConditionName = "check_clicks";
     this.ifElseBranchActivity1.Condition  = ruleconditionreference1;
     this.ifElseBranchActivity1.Name       = "ifElseBranchActivity1";
     //
     // sendMail1
     //
     this.sendMail1.Enabled     = false;
     this.sendMail1.MessageBody = null;
     this.sendMail1.Name        = "sendMail1";
     this.sendMail1.Override    = false;
     this.sendMail1.Recipient   = null;
     //
     // sendMessage1
     //
     this.sendMessage1.Attachments = null;
     this.sendMessage1.Name        = "sendMessage1";
     this.sendMessage1.Recipients  = null;
     this.sendMessage1.Text        = null;
     this.sendMessage1.Title       = null;
     this.sendMessage1.Urgency     = Easynet.Edge.Core.Messaging.MessageUrgency.Low;
     //
     // masterReport1
     //
     this.masterReport1.HasReport = false;
     this.masterReport1.Name      = "masterReport1";
     //
     // ifElseActivity1
     //
     this.ifElseActivity1.Activities.Add(this.ifElseBranchActivity1);
     this.ifElseActivity1.Activities.Add(this.ifElseBranchActivity2);
     this.ifElseActivity1.Name = "ifElseActivity1";
     //
     // account1
     //
     this.account1.Name = "account1";
     //
     // AdminAlerts2
     //
     this.Activities.Add(this.account1);
     this.Activities.Add(this.ifElseActivity1);
     this.Activities.Add(this.masterReport1);
     this.Activities.Add(this.sendMessage1);
     this.Activities.Add(this.sendMail1);
     this.ConditionValues     = hashtable1;
     this.ConnectionString    = "";
     this.Name                = "AdminAlerts2";
     this.Parameters          = hashtable2;
     this.Template            = false;
     this.WorkflowGUID        = new System.Guid("7ae59c40-b584-4ff3-8f4f-871fea384180");
     this.WorkflowID          = -1;
     this.WorkflowName        = "";
     this.WorkflowType        = typeof(Easynet.Edge.Core.Workflow.BaseSequentialWorkflow);
     this.CanModifyActivities = false;
 }
Beispiel #46
0
        /// <summary>
        ///  Gets the properties for a given Com2 Object.  The returned Com2Properties
        ///  Object contains the properties and relevant data about them.
        /// </summary>
        public static Com2Properties GetProperties(object obj)
        {
            Debug.WriteLineIf(DbgTypeInfoProcessorSwitch.TraceVerbose, "Com2TypeInfoProcessor.GetProperties");

            if (obj == null || !Marshal.IsComObject(obj))
            {
                Debug.WriteLineIf(DbgTypeInfoProcessorSwitch.TraceVerbose, "Com2TypeInfoProcessor.GetProperties returning null: Object is not a com Object");
                return(null);
            }

            UnsafeNativeMethods.ITypeInfo[] typeInfos = FindTypeInfos(obj, false);

            // oops, looks like this guy doesn't surface any type info
            // this is okay, so we just say it has no props
            if (typeInfos == null || typeInfos.Length == 0)
            {
                Debug.WriteLineIf(DbgTypeInfoProcessorSwitch.TraceVerbose, "Com2TypeInfoProcessor.GetProperties :: Didn't get typeinfo");
                return(null);
            }

            int       defaultProp = -1;
            int       temp        = -1;
            ArrayList propList    = new ArrayList();

            Guid[] typeGuids = new Guid[typeInfos.Length];

            for (int i = 0; i < typeInfos.Length; i++)
            {
                UnsafeNativeMethods.ITypeInfo ti = typeInfos[i];

                if (ti == null)
                {
                    continue;
                }

                int[] versions             = new int[2];
                Guid  typeGuid             = GetGuidForTypeInfo(ti, versions);
                PropertyDescriptor[] props = null;
                bool dontProcess           = typeGuid != Guid.Empty && processedLibraries != null && processedLibraries.Contains(typeGuid);

                if (dontProcess)
                {
                    CachedProperties cp = (CachedProperties)processedLibraries[typeGuid];

                    if (versions[0] == cp.MajorVersion && versions[1] == cp.MinorVersion)
                    {
                        props = cp.Properties;
                        if (i == 0 && cp.DefaultIndex != -1)
                        {
                            defaultProp = cp.DefaultIndex;
                        }
                    }
                    else
                    {
                        dontProcess = false;
                    }
                }

                if (!dontProcess)
                {
                    props = InternalGetProperties(obj, ti, NativeMethods.MEMBERID_NIL, ref temp);

                    // only save the default property from the first type Info
                    if (i == 0 && temp != -1)
                    {
                        defaultProp = temp;
                    }

                    if (processedLibraries == null)
                    {
                        processedLibraries = new Hashtable();
                    }

                    if (typeGuid != Guid.Empty)
                    {
                        processedLibraries[typeGuid] = new CachedProperties(props, i == 0 ? defaultProp : -1, versions[0], versions[1]);
                    }
                }

                if (props != null)
                {
                    propList.AddRange(props);
                }
            }

            Debug.WriteLineIf(DbgTypeInfoProcessorSwitch.TraceVerbose, "Com2TypeInfoProcessor.GetProperties : returning " + propList.Count.ToString(CultureInfo.InvariantCulture) + " properties");

            // done!
            Com2PropertyDescriptor[] temp2 = new Com2PropertyDescriptor[propList.Count];
            propList.CopyTo(temp2, 0);

            return(new Com2Properties(obj, temp2, defaultProp));
        }
Beispiel #47
0
        /// <summary>
        /// Writes the declaration/definitions of 'F' to StringBuffer 'SB', taking into account parameters specified in specification 'S'.
        /// </summary>
        public override void WriteFunction()
        {
            foreach (string floatName in m_fgs.FloatNames)
            {
                FloatType FT = m_specification.GetFloatType(floatName);

                if (IsRandom(m_specification, m_fgs)) // generate function for point from random coordinates
                {
                    StringBuilder declSB = m_cgd.m_declSB;
                    StringBuilder defSB  = (m_specification.m_inlineFunctions) ? m_cgd.m_inlineDefSB : m_cgd.m_defSB;

                    string funcName = m_fgs.OutputName;
                    if (m_specification.OutputC())
                    {
                        funcName = FT.GetMangledName(m_specification, m_fgs.OutputName);
                    }

                    System.Collections.Hashtable argTable = new System.Collections.Hashtable();
                    argTable["S"]                    = m_specification;
                    argTable["functionName"]         = funcName;
                    argTable["pointType"]            = FT.GetMangledName(m_specification, m_fgs.m_returnTypeName);
                    argTable["FT"]                   = FT;
                    argTable["randomScalarFuncName"] = m_randomScalarFunc[floatName];
                    argTable["cgaPointFunc"]         = m_cgaPointFunc[floatName];

                    m_funcName[FT.type] = funcName;

                    // header
                    m_cgd.m_cog.EmitTemplate(declSB, "randomCgaPointHeader", argTable);
                    // source
                    m_cgd.m_cog.EmitTemplate(defSB, "randomCgaPoint", argTable);
                }
                else // generate function for point from vector or from coordinates
                {
                    bool computeMultivectorValue    = true;
                    G25.CG.Shared.FuncArgInfo[] FAI = G25.CG.Shared.FuncArgInfo.GetAllFuncArgInfo(m_specification, m_fgs, NB_ARGS, FT,
                                                                                                  m_specification.m_GMV.Name, computeMultivectorValue);

                    // because of lack of overloading, function names include names of argument types
                    G25.fgs CF = G25.CG.Shared.Util.AppendTypenameToFuncName(m_specification, FT, m_fgs, FAI);

                    m_funcName[FT.type] = CF.OutputName;

                    // generate comment
                    Comment comment = new Comment(m_fgs.AddUserComment("Returns conformal point."));

                    int  nbTabs   = 1;
                    bool mustCast = false;
                    List <G25.CG.Shared.Instruction> I = new List <G25.CG.Shared.Instruction>();

                    if (IsFlatPointBased(m_specification, m_fgs, FT))
                    {
                        string smvTypeName = FT.GetMangledName(m_specification, m_vectorType.GetName());
                        if (m_specification.OutputCppOrC())
                        {
                            I.Add(new G25.CG.Shared.VerbatimCodeInstruction(nbTabs, smvTypeName + " " + VECTOR_NAME + ";"));
                        }
                        else
                        {
                            I.Add(new G25.CG.Shared.VerbatimCodeInstruction(nbTabs, smvTypeName + " " + VECTOR_NAME + " = new " + smvTypeName + "();"));
                        }
                        bool ptr     = false;
                        bool declare = false;
                        I.Add(new G25.CG.Shared.AssignInstruction(nbTabs, m_vectorType, FT, mustCast, m_pointPairVectorValue, VECTOR_NAME, ptr, declare));
                    }
                    I.Add(new G25.CG.Shared.ReturnInstruction(nbTabs, m_specification.GetType(m_fgs.m_returnTypeName), FT, mustCast, m_returnValue));

                    bool staticFunc = Functions.OutputStaticFunctions(m_specification);
                    G25.CG.Shared.Functions.WriteFunction(m_specification, m_cgd, CF, m_specification.m_inlineFunctions, staticFunc, CF.OutputName, FAI, I, comment);

                    // write out the function:
                    //G25.CG.Shared.Functions.WriteSpecializedFunction(m_specification, m_cgd, CF, FT, FAI, m_returnValue, comment);
                }
            }
        } // end of WriteFunction
Beispiel #48
0
    //بدنه مربوط به ذخیره فایل و یا صفحه
    #region SavePages_btnSave_Click(object sender, EventArgs e)

    /// <summary>
    /// متد ذخیره فایل صفحه توسط ادمین
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnSave_Click(object sender, EventArgs e)
    {
        //تریم کردن تکست باکس
        txtFileName.Text =
            txtFileName.Text.Trim();

        //اگر تکست باکس خالی بود
        if (txtFileName.Text == string.Empty)
        {
            //نمایش پیغام خطا
            string strErrorMessage =
                string.Format(Resources.Messages.ErrorMessage003);
            DisplayErrorMessage(strErrorMessage);
            return;
        }
        //در غیر اینصورت مراحل مسیر نسبی و تبدیل به مسیر فیزیکی
        string strFileName             = txtFileName.Text;
        string strRootRelativePath     = "~/App_Data/PageContents";
        string strRootRelativePathName =
            string.Format("{0}/{1}", strRootRelativePath, strFileName);

        string strPathName = Server.MapPath(strRootRelativePathName);

        //ایجاد یک شی از کلاس استریم رایتر
        System.IO.StreamWriter oStreamWriter = null;

        try
        {
            //نیو کردن استریم رایتر
            oStreamWriter = new System.IO.StreamWriter
                                (strPathName, false, System.Text.Encoding.UTF8);
            oStreamWriter.Write(txtEditContent.Text);

            //اگر فایل وجود نداشت
            if (System.IO.File.Exists(strPathName) == false)
            {
                //نمایش پیغام خطا
                string strErrorMessage =
                    string.Format(Resources.Messages.ErrorMessage004, txtFileName.Text);
                DisplayErrorMessage(strErrorMessage);
                return;
            }

            //در غیر اینصورت نمایش پیغام موفقیت در عملیات
            string strInformationMessage =
                string.Format(Resources.Messages.InformationMessage002, txtFileName.Text);
            DisplayInformationMessage(strInformationMessage);


            //تکست باکس فایل نیم را نمایان میکنیم
            txtFileName.Visible = true;
            //لینک گذر از این مرحله را فعال میکنیم
            lnbCancel.Visible = true;
            //دراب دان لیست فایل نیم را غیر فعال میکنیم
            DropDownList1.Enabled = false;
        }

        //در صورتی که عملیات ترای با خطا مواجه گردد
        catch (Exception ex)
        {
            //نمایش خطای ایجاد شده
            string strErrorMessage =
                Resources.Messages.ErrorMessage006;
            DisplayErrorMessage(strErrorMessage);

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

            //اگر در داخل یک تابع غیر استاتیک  این تابع رو صدا میزنیم از دیس تا گت تایپ استفاده میکنیم
            //در غیر اینصورت از این روش استفاده میکنیم یعنی تایپ اف نام کلاس
            //پارامتر دوم مجموعه ای از اطلاعاتی که میتونه کمک کنه رو هم لاگ میکنیم
            //پارامتر سوم هم که ای ایکس هست رو لاگ میکنیم

            return;
        }

        finally
        {
            //بستن استریم رایتر
            if (oStreamWriter != null)
            {
                oStreamWriter.Dispose();
                oStreamWriter = null;
            }
        }
    }
 public DatabaseResourceManager()
     : base()
 {
     this.dsn     = ConfigurationManager.AppSettings["Gettext.ConnectionString"] ?? ConfigurationManager.ConnectionStrings["Gettext"].ConnectionString;
     ResourceSets = new System.Collections.Hashtable();
 }
Beispiel #50
0
    static int Main(string[] args)
    {
        Tracer.EnableTraceConsoleListener();
        Tracer.EnableTraceForDebug();
        System.Collections.Hashtable props = new System.Collections.Hashtable();
        string classpath = Environment.GetEnvironmentVariable("CLASSPATH");

        if (classpath == null || classpath == "")
        {
            classpath = ".";
        }
        props["java.class.path"] = classpath;
        bool   jar           = false;
        bool   saveAssembly  = false;
        bool   saveAssemblyX = false;
        bool   waitOnExit    = false;
        bool   showVersion   = false;
        string mainClass     = null;
        int    vmargsIndex   = -1;
        bool   debug         = false;
        String debugArg      = null;

        for (int i = 0; i < args.Length; i++)
        {
            String arg = args[i];
            if (arg[0] == '-')
            {
                if (arg == "-help" || arg == "-?")
                {
                    break;
                }
                else if (arg == "-Xsave")
                {
                    saveAssembly = true;
                    IKVM.Internal.Starter.PrepareForSaveDebugImage();
                }
                else if (arg == "-XXsave")
                {
                    saveAssemblyX = true;
                    IKVM.Internal.Starter.PrepareForSaveDebugImage();
                }
                else if (arg == "-Xtime")
                {
                    new Timer();
                }
                else if (arg == "-Xwait")
                {
                    waitOnExit = true;
                }
                else if (arg == "-Xbreak")
                {
                    System.Diagnostics.Debugger.Break();
                }
                else if (arg == "-Xnoclassgc")
                {
                    IKVM.Internal.Starter.ClassUnloading = false;
                }
                else if (arg == "-jar")
                {
                    jar = true;
                }
                else if (arg == "-version")
                {
                    Console.WriteLine(Startup.getVersionAndCopyrightInfo());
                    Console.WriteLine();
                    Console.WriteLine("CLR version: {0} ({1} bit)", Environment.Version, IntPtr.Size * 8);
                    System.Type type = System.Type.GetType("Mono.Runtime");
                    if (type != null)
                    {
                        Console.WriteLine("Mono version: {0}", type.InvokeMember("GetDisplayName", BindingFlags.InvokeMethod | BindingFlags.Static | BindingFlags.NonPublic, null, null, new object[0]));
                    }
                    foreach (Assembly asm in AppDomain.CurrentDomain.GetAssemblies())
                    {
                        Console.WriteLine("{0}: {1}", asm.GetName().Name, asm.GetName().Version);
                    }
                    string ver = java.lang.System.getProperty("openjdk.version");
                    if (ver != null)
                    {
                        Console.WriteLine("OpenJDK version: {0}", ver);
                    }
                    return(0);
                }
                else if (arg == "-showversion")
                {
                    showVersion = true;
                }
                else if (arg.StartsWith("-D"))
                {
                    arg = arg.Substring(2);
                    string[] keyvalue = arg.Split('=');
                    string   value;
                    if (keyvalue.Length == 2)                    // -Dabc=x
                    {
                        value = keyvalue[1];
                    }
                    else if (keyvalue.Length == 1) // -Dabc
                    {
                        value = "";
                    }
                    else // -Dabc=x=y
                    {
                        value = arg.Substring(keyvalue[0].Length + 1);
                    }
                    props[keyvalue[0]] = value;
                }
                else if (arg == "-ea" || arg == "-enableassertions")
                {
                    IKVM.Runtime.Assertions.EnableAssertions();
                }
                else if (arg == "-da" || arg == "-disableassertions")
                {
                    IKVM.Runtime.Assertions.DisableAssertions();
                }
                else if (arg == "-esa" || arg == "-enablesystemassertions")
                {
                    IKVM.Runtime.Assertions.EnableSystemAssertions();
                }
                else if (arg == "-dsa" || arg == "-disablesystemassertions")
                {
                    IKVM.Runtime.Assertions.DisableSystemAssertions();
                }
                else if (arg.StartsWith("-ea:") || arg.StartsWith("-enableassertions:"))
                {
                    IKVM.Runtime.Assertions.EnableAssertions(arg.Substring(arg.IndexOf(':') + 1));
                }
                else if (arg.StartsWith("-da:") || arg.StartsWith("-disableassertions:"))
                {
                    IKVM.Runtime.Assertions.DisableAssertions(arg.Substring(arg.IndexOf(':') + 1));
                }
                else if (arg == "-cp" || arg == "-classpath")
                {
                    props["java.class.path"] = args[++i];
                }
                else if (arg.StartsWith("-Xtrace:"))
                {
                    Tracer.SetTraceLevel(arg.Substring(8));
                }
                else if (arg.StartsWith("-Xmethodtrace:"))
                {
                    Tracer.HandleMethodTrace(arg.Substring(14));
                }
                else if (arg == "-Xdebug")
                {
                    debug = true;
                }
                else if (arg == "-Xnoagent")
                {
                    //ignore it, disable support for oldjdb
                }
                else if (arg.StartsWith("-Xrunjdwp") || arg.StartsWith("-agentlib:jdwp"))
                {
                    debugArg = arg;
                    debug    = true;
                }
                else if (arg.StartsWith("-Xreference:"))
                {
                    Startup.addBootClassPathAssemby(Assembly.LoadFrom(arg.Substring(12)));
                }
                else if (arg.StartsWith("-Xms") ||
                         arg.StartsWith("-Xmx") ||
                         arg.StartsWith("-Xss") ||
                         arg == "-Xmixed" ||
                         arg == "-Xint" ||
                         arg == "-Xnoclassgc" ||
                         arg == "-Xincgc" ||
                         arg == "-Xbatch" ||
                         arg == "-Xfuture" ||
                         arg == "-Xrs" ||
                         arg == "-Xcheck:jni" ||
                         arg == "-Xshare:off" ||
                         arg == "-Xshare:auto" ||
                         arg == "-Xshare:on"
                         )
                {
                    Console.Error.WriteLine("Unsupported option ignored: {0}", arg);
                }
                else
                {
                    Console.Error.WriteLine("{0}: illegal argument", arg);
                    break;
                }
            }
            else
            {
                mainClass   = arg;
                vmargsIndex = i + 2;
                break;
            }
        }
        if (mainClass == null || showVersion)
        {
            Console.Error.WriteLine(Startup.getVersionAndCopyrightInfo());
            Console.Error.WriteLine();
        }
        if (mainClass == null)
        {
            Console.Error.WriteLine("usage: ikvm [-options] <class> [args...]");
            Console.Error.WriteLine("          (to execute a class)");
            Console.Error.WriteLine("    or ikvm -jar [-options] <jarfile> [args...]");
            Console.Error.WriteLine("          (to execute a jar file)");
            Console.Error.WriteLine();
            Console.Error.WriteLine("where options include:");
            Console.Error.WriteLine("    -? -help          Display this message");
            Console.Error.WriteLine("    -version          Display IKVM and runtime version");
            Console.Error.WriteLine("    -showversion      Display version and continue running");
            Console.Error.WriteLine("    -cp -classpath <directories and zip/jar files separated by {0}>", Path.PathSeparator);
            Console.Error.WriteLine("                      Set search path for application classes and resources");
            Console.Error.WriteLine("    -D<name>=<value>  Set a system property");
            Console.Error.WriteLine("    -ea[:<packagename>...|:<classname>]");
            Console.Error.WriteLine("    -enableassertions[:<packagename>...|:<classname>]");
            Console.Error.WriteLine("                      Enable assertions.");
            Console.Error.WriteLine("    -da[:<packagename>...|:<classname>]");
            Console.Error.WriteLine("    -disableassertions[:<packagename>...|:<classname>]");
            Console.Error.WriteLine("                      Disable assertions");
            Console.Error.WriteLine("    -Xsave            Save the generated assembly (for debugging)");
            Console.Error.WriteLine("    -Xtime            Time the execution");
            Console.Error.WriteLine("    -Xtrace:<string>  Displays all tracepoints with the given name");
            Console.Error.WriteLine("    -Xmethodtrace:<string>");
            Console.Error.WriteLine("                      Builds method trace into the specified output methods");
            Console.Error.WriteLine("    -Xwait            Keep process hanging around after exit");
            Console.Error.WriteLine("    -Xbreak           Trigger a user defined breakpoint at startup");
            Console.Error.WriteLine("    -Xnoclassgc       Disable class garbage collection");
            return(1);
        }
        try
        {
            if (debug)
            {
                // Starting the debugger
                Assembly asm       = Assembly.GetExecutingAssembly();
                String   arguments = debugArg + " -pid:" + System.Diagnostics.Process.GetCurrentProcess().Id;
                String   program   = new FileInfo(asm.Location).DirectoryName + "\\debugger.exe";
                try
                {
                    ProcessStartInfo info = new ProcessStartInfo(program, arguments);
                    info.UseShellExecute = false;
                    Process debugger = new Process();
                    debugger.StartInfo = info;
                    debugger.Start();
                }
                catch (Exception ex)
                {
                    Console.Error.WriteLine(program + " " + arguments);
                    throw ex;
                }
            }
            if (jar)
            {
                props["java.class.path"] = mainClass;
            }
            Startup.setProperties(props);
            Startup.enterMainThread();
            // HACK Starup.glob() uses Java code, so we need to do this after we've initialized
            string[] vmargs = Startup.glob(vmargsIndex);
            if (jar)
            {
                mainClass = GetMainClassFromJarManifest(mainClass);
                if (mainClass == null)
                {
                    return(1);
                }
            }
            java.lang.Class clazz = java.lang.Class.forName(mainClass, true, java.lang.ClassLoader.getSystemClassLoader());
            try
            {
                Method method = IKVM.Internal.Starter.FindMainMethod(clazz);
                if (method == null)
                {
                    throw new java.lang.NoSuchMethodError("main");
                }
                else if (!Modifier.isPublic(method.getModifiers()))
                {
                    Console.Error.WriteLine("Main method not public.");
                }
                else
                {
                    // if clazz isn't public, we can still call main
                    method.setAccessible(true);
                    if (saveAssembly)
                    {
                        java.lang.Runtime.getRuntime().addShutdownHook(new SaveAssemblyShutdownHook(clazz));
                    }
                    if (waitOnExit)
                    {
                        java.lang.Runtime.getRuntime().addShutdownHook(new WaitShutdownHook());
                    }
                    try
                    {
                        method.invoke(null, new object[] { vmargs });
                        return(0);
                    }
                    catch (InvocationTargetException x)
                    {
                        throw x.getCause();
                    }
                }
            }
            finally
            {
                if (saveAssemblyX)
                {
                    IKVM.Internal.Starter.SaveDebugImage();
                }
            }
        }
        catch (System.Exception x)
        {
            java.lang.Thread thread = java.lang.Thread.currentThread();
            thread.getThreadGroup().uncaughtException(thread, ikvm.runtime.Util.mapException(x));
        }
        finally
        {
            Startup.exitMainThread();
        }
        return(1);
    }
Beispiel #51
0
 /*******************************/
 public static System.Object PutElement(System.Collections.Hashtable hashTable, System.Object key, System.Object newValue)
 {
     System.Object element = hashTable[key];
     hashTable[key] = newValue;
     return(element);
 }
    static int _CreateSystem_Collections_Hashtable(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 0)
            {
                System.Collections.Hashtable obj = new System.Collections.Hashtable();
                ToLua.PushObject(L, obj);
                return(1);
            }
            else if (count == 1 && TypeChecker.CheckTypes(L, 1, typeof(System.Collections.IDictionary)))
            {
                System.Collections.IDictionary arg0 = (System.Collections.IDictionary)ToLua.CheckObject(L, 1, typeof(System.Collections.IDictionary));
                System.Collections.Hashtable   obj  = new System.Collections.Hashtable(arg0);
                ToLua.PushObject(L, obj);
                return(1);
            }
            else if (count == 1 && TypeChecker.CheckTypes(L, 1, typeof(System.Collections.IEqualityComparer)))
            {
                System.Collections.IEqualityComparer arg0 = (System.Collections.IEqualityComparer)ToLua.CheckObject(L, 1, typeof(System.Collections.IEqualityComparer));
                System.Collections.Hashtable         obj  = new System.Collections.Hashtable(arg0);
                ToLua.PushObject(L, obj);
                return(1);
            }
            else if (count == 1 && TypeChecker.CheckTypes(L, 1, typeof(int)))
            {
                int arg0 = (int)LuaDLL.luaL_checknumber(L, 1);
                System.Collections.Hashtable obj = new System.Collections.Hashtable(arg0);
                ToLua.PushObject(L, obj);
                return(1);
            }
            else if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(int), typeof(float)))
            {
                int   arg0 = (int)LuaDLL.luaL_checknumber(L, 1);
                float arg1 = (float)LuaDLL.luaL_checknumber(L, 2);
                System.Collections.Hashtable obj = new System.Collections.Hashtable(arg0, arg1);
                ToLua.PushObject(L, obj);
                return(1);
            }
            else if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(int), typeof(System.Collections.IEqualityComparer)))
            {
                int arg0 = (int)LuaDLL.luaL_checknumber(L, 1);
                System.Collections.IEqualityComparer arg1 = (System.Collections.IEqualityComparer)ToLua.CheckObject(L, 2, typeof(System.Collections.IEqualityComparer));
                System.Collections.Hashtable         obj  = new System.Collections.Hashtable(arg0, arg1);
                ToLua.PushObject(L, obj);
                return(1);
            }
            else if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(System.Collections.IDictionary), typeof(float)))
            {
                System.Collections.IDictionary arg0 = (System.Collections.IDictionary)ToLua.CheckObject(L, 1, typeof(System.Collections.IDictionary));
                float arg1 = (float)LuaDLL.luaL_checknumber(L, 2);
                System.Collections.Hashtable obj = new System.Collections.Hashtable(arg0, arg1);
                ToLua.PushObject(L, obj);
                return(1);
            }
            else if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(System.Collections.IDictionary), typeof(System.Collections.IEqualityComparer)))
            {
                System.Collections.IDictionary       arg0 = (System.Collections.IDictionary)ToLua.CheckObject(L, 1, typeof(System.Collections.IDictionary));
                System.Collections.IEqualityComparer arg1 = (System.Collections.IEqualityComparer)ToLua.CheckObject(L, 2, typeof(System.Collections.IEqualityComparer));
                System.Collections.Hashtable         obj  = new System.Collections.Hashtable(arg0, arg1);
                ToLua.PushObject(L, obj);
                return(1);
            }
            else if (count == 3 && TypeChecker.CheckTypes(L, 1, typeof(int), typeof(float), typeof(System.Collections.IEqualityComparer)))
            {
                int   arg0 = (int)LuaDLL.luaL_checknumber(L, 1);
                float arg1 = (float)LuaDLL.luaL_checknumber(L, 2);
                System.Collections.IEqualityComparer arg2 = (System.Collections.IEqualityComparer)ToLua.CheckObject(L, 3, typeof(System.Collections.IEqualityComparer));
                System.Collections.Hashtable         obj  = new System.Collections.Hashtable(arg0, arg1, arg2);
                ToLua.PushObject(L, obj);
                return(1);
            }
            else if (count == 3 && TypeChecker.CheckTypes(L, 1, typeof(System.Collections.IDictionary), typeof(float), typeof(System.Collections.IEqualityComparer)))
            {
                System.Collections.IDictionary arg0 = (System.Collections.IDictionary)ToLua.CheckObject(L, 1, typeof(System.Collections.IDictionary));
                float arg1 = (float)LuaDLL.luaL_checknumber(L, 2);
                System.Collections.IEqualityComparer arg2 = (System.Collections.IEqualityComparer)ToLua.CheckObject(L, 3, typeof(System.Collections.IEqualityComparer));
                System.Collections.Hashtable         obj  = new System.Collections.Hashtable(arg0, arg1, arg2);
                ToLua.PushObject(L, obj);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to ctor method: System.Collections.Hashtable.New"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
        public override void Initialize(System.Collections.Hashtable properties)
        {
            //string configFile = null; string output_elementset; string output_quantity;
            string configFile = null; string inputfile = null;

            //set initial conditions through *.omi file. (optional)
            if (properties.ContainsKey("ConfigFile"))
            {
                configFile = (string)properties["ConfigFile"];
            }

            if (properties.ContainsKey("Inputs"))
            {
                inputfile = (string)properties["Inputs"];
            }


            if (properties.ContainsKey("OutputDir"))
            {
                outputPath = System.IO.Path.Combine(System.IO.Directory.GetCurrentDirectory(), (string)properties["OutputDir"]);
            }


            //lookup model's configuration file to determine interface properties
            SetVariablesFromConfigFile(configFile);
            SetValuesTableFields();

            int num_inputs = this.GetInputExchangeItemCount();

            if (inputfile != null)
            {
                //read input Ux,Uy,and concentration matrix
                StreamReader sr   = new StreamReader(inputfile);
                string       line = sr.ReadLine();
                u = Convert.ToDouble(line.Split(',')[1]);

                line = sr.ReadLine();
                D    = Convert.ToDouble(line.Split(',')[1]);

                line   = sr.ReadLine();
                rows_S = Convert.ToInt32(line.Split(',')[1]);

                line   = sr.ReadLine();
                cols_S = Convert.ToInt32(line.Split(',')[1]);

                line   = sr.ReadLine();
                rows_W = Convert.ToInt32(line.Split(',')[1]);

                line   = sr.ReadLine();
                cols_W = Convert.ToInt32(line.Split(',')[1]);

                cs = new double[rows_S, cols_S]; cw = new double[rows_W, cols_W];

                //get elementset from smw
                ElementSet ein  = (ElementSet)this.Inputs[0].ElementSet;
                ElementSet eout = (ElementSet)this.Outputs[0].ElementSet;

                //change element type from id to point
                ein.ElementType  = ElementType.XYPoint;
                eout.ElementType = ElementType.XYPoint;

                //initialize cw to intial values (importating the data from the txt file(.models\sediment\inputs.csv)
                line = sr.ReadLine();
                int i = 0;
                while (line != null)
                {
                    string[] values = line.Split(',');
                    for (int j = 0; j <= values.Length - 1; j++)
                    {
                        cs[i, j] = Convert.ToDouble(values[j]);

                        //Build Element Set from first row only!
                        if (i == 0)
                        {
                            //create new element
                            Element e = new Element();
                            int     x, y;
                            x = j;
                            y = -i;
                            Vertex v = new Vertex(x, y, 0);
                            e.AddVertex(v);

                            //add element to elementset
                            ein.AddElement(e);
                            eout.AddElement(e);
                        }
                    }
                    i++;
                    line = sr.ReadLine();
                }
            }
            else
            {
            }


            //output exchange item attributes
            int num_outputs           = this.GetOutputExchangeItemCount();
            OutputExchangeItem output = this.GetOutputExchangeItem(num_outputs - 1);

            output_elementset = output.ElementSet.ID;
            output_quantity   = output.Quantity.ID;

            //defining the equation constants
            _dt = this.GetTimeStep();
            _h  = u * _dt / 0.85533;   // l / (rows - 2);

            //setup the intial value of diff_prev= upper row of cs since cs contain 9 rows
            diff_prev = new double[cs.GetUpperBound(1) + 1];
            for (int i = 0; i <= cs.GetLength(1) - 1; i++)
            {
                diff_prev[i] = cs[cs.GetUpperBound(0), i];
            }
            //this sets the initial cond.

            this.SetValues("Concentration", "sed", new ScalarSet(diff_prev));

            // intiating am matrix that contain the intial values to bypass the open mi setting
            initial = new double[cs.GetUpperBound(1) + 1];
            for (int i = 0; i <= cs.GetLength(1) - 1; i++)
            {
                initial[i] = cs[cs.GetUpperBound(0), i];
            }

            //calling the intial value of adv_prev=cw from water component
            adv_prev = new double[1, cw.GetUpperBound(1) + 1];
            for (int j = 0; j <= cw.GetLength(1) - 1; j++)
            {
                adv_prev[0, j] = cw[cw.GetUpperBound(0), j];
            }
        }
Beispiel #54
0
    protected void gvAuthor_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        string idStr;

        Label lblIdTemp = null;

        lblIdTemp = (Label)gvAuthor.Rows[e.RowIndex].FindControl("lblId");
        if (lblIdTemp != null)
        {
            idStr = lblIdTemp.Text;
        }
        else
        {
            return;
        }

        TextBox txtLastNameTemp = null;

        txtLastNameTemp = (TextBox)gvAuthor.Rows[e.RowIndex].FindControl("txtLastName");
        if (txtLastNameTemp == null)
        {
            return;
        }
        TextBox txtForeNameTemp = null;

        txtForeNameTemp = (TextBox)gvAuthor.Rows[e.RowIndex].FindControl("txtForeName");
        if (txtForeNameTemp == null)
        {
            return;
        }
        TextBox txtInitialsTemp = null;

        txtInitialsTemp = (TextBox)gvAuthor.Rows[e.RowIndex].FindControl("txtInitials");
        if (txtInitialsTemp == null)
        {
            return;
        }
        DropDownList ddlMemberTemp = null;

        ddlMemberTemp = (DropDownList)gvAuthor.Rows[e.RowIndex].FindControl("ddlMember");
        if (ddlMemberTemp == null)
        {
            return;
        }

        string sqlStatement =
            "Update author" +
            " SET LastName=@LastName," +
            " ForeName=@ForeName," +
            " Initials=@Initials," +
            " client_id=@client_id" +
            " WHERE (author_id = @author_id)";

        //idStr;

        //string connectionStr = ConfigurationManager.AppSettings.Get("ConnectionString");
        string        connectionStr = ConfigurationManager.ConnectionStrings["UcccPubMedDB"].ConnectionString;
        SqlConnection myConnection  = new SqlConnection(connectionStr);
        SqlCommand    command       = new SqlCommand(sqlStatement, myConnection);

        SqlParameter LastNameParameter = new SqlParameter();

        LastNameParameter.ParameterName = "@LastName";
        LastNameParameter.SqlDbType     = SqlDbType.Int;
        if (txtLastNameTemp.Text != "")
        {
            LastNameParameter.Value = txtLastNameTemp.Text;
        }
        else
        {
            LastNameParameter.Value = DBNull.Value;
        }
        command.Parameters.Add(LastNameParameter);

        SqlParameter ForeNameParameter = new SqlParameter();

        ForeNameParameter.ParameterName = "@ForeName";
        ForeNameParameter.SqlDbType     = SqlDbType.Int;
        if (txtForeNameTemp.Text != "")
        {
            if (txtInitialsTemp.Text != "")
            {
                string init = txtInitialsTemp.Text;
                ForeNameParameter.Value = txtForeNameTemp.Text + " " + init[0];
            }
            else
            {
                ForeNameParameter.Value = txtForeNameTemp.Text;
            }
        }
        else
        {
            ForeNameParameter.Value = DBNull.Value;
        }
        command.Parameters.Add(ForeNameParameter);

        SqlParameter InitialsParameter = new SqlParameter();

        InitialsParameter.ParameterName = "@Initials";
        InitialsParameter.SqlDbType     = SqlDbType.Int;
        if (txtInitialsTemp.Text != "")
        {
            InitialsParameter.Value = txtInitialsTemp.Text;
        }
        else
        {
            InitialsParameter.Value = DBNull.Value;
        }
        command.Parameters.Add(InitialsParameter);

        SqlParameter client_idParameter = new SqlParameter();

        client_idParameter.ParameterName = "@client_id";
        client_idParameter.SqlDbType     = SqlDbType.Int;
        client_idParameter.Value         = ddlMemberTemp.SelectedValue;
        command.Parameters.Add(client_idParameter);

        SqlParameter author_idParameter = new SqlParameter();

        author_idParameter.ParameterName = "@author_id";
        author_idParameter.SqlDbType     = SqlDbType.Int;
        author_idParameter.Value         = System.Convert.ToInt32(lblIdTemp.Text);
        command.Parameters.Add(author_idParameter);

        myConnection.Open();
        command.ExecuteNonQuery();
        myConnection.Close();

        gvAuthor.EditIndex = -1;

        string pubIdStr = hdnPubId.Value;
        int    pubId    = Convert.ToInt32(pubIdStr);

        FillAuthorGrid(pubId);

        if (e.RowIndex > 0)
        {
            return; // RowIndex=0 is the row we want to insert
        }
        System.Collections.Hashtable h =
            new System.Collections.Hashtable();

        foreach (System.Collections.DictionaryEntry x in e.NewValues)
        {
            h[x.Key] = x.Value;
        }
    }