예제 #1
0
파일: ComObject.cs 프로젝트: plats98/TI
        public void ChangeValueForm(string name)
        {
            ChangeValue cv = new ChangeValue();

            cv.Text = name;
            cv.ShowDialog();
        }
예제 #2
0
 private static void OnChanged(ChangeValue value, string name)
 {
     KafkaTarget.Topic = value.topic;
     KafkaTarget.Producer?.Flush(TimeSpan.FromSeconds(60));
     KafkaTarget.Producer?.Dispose();
     KafkaTarget.Producer = new ProducerBuilder <Null, string>(value.producerConfig).Build();
 }
예제 #3
0
 /// <summary>
 /// Raises event 'ChangeValue'
 /// </summary>
 protected virtual void OnChangeValue()
 {
     if (ChangeValue != null)
     {
         ChangeValue.Invoke(this, System.EventArgs.Empty);
     }
 }
예제 #4
0
 public ActionResult IndexModel(int Id)
 {
     try
     {
         ViewBag.lishow   = lishow;
         ViewBag.ashow    = "war";
         ViewBag.LfetShow = LfetShow;
         ViewBag.ashow    = "war";
         ViewBag.location = "所在位置:<a href='" + Url.Content("~/Warning/Index") + "'>布控管理</a> >>布控项详情";
         UserInfo       user  = (UserInfo)Session["userInfo"];
         BKBJ.AuditInfo audit = new AuditDAL().GetAuditInfoById(Id, user.ID);
         ViewBag.NetbarType = ChangeValue.GetLocaTypeList();
         ViewBag.deploy     = audit;
         ViewBag.DSArea     = new AuditDAL().GetAreaList();
     }
     catch (SqlException sqlex)
     {
         Logger.ErrorLog(sqlex, null);
     }
     catch (Exception ex)
     {
         Logger.ErrorLog(ex, null);
     }
     return(View());
 }
예제 #5
0
        //This function make minor changes in the value of input like strikeprice, price of underlying etc so that they can be used for calculating value of greeks
        #region Change value for calculating greeks
        public static void changeValues(Options option, Double del, ChangeValue change)
        {
            switch (change)
            {
            case ChangeValue.UPRICE:
                option.Underlying.Price += del;
                break;

            case ChangeValue.TIME:
                option.ExpiryDate = option.ExpiryDate.AddDays(del);
                break;

            case ChangeValue.RATE:
                yieldCurve[0].Rate += del;
                break;

            case ChangeValue.VOLATILITY:
                option.HistoricalVolatility += del;
                break;

            case ChangeValue.NONE:
                break;

            default:
                break;
            }
        }
예제 #6
0
        private void ChangeComponents_OnClick(object sender, RoutedEventArgs e)
        {
            try
            {
                ChangeValue cv = new ChangeValue();
                cv.WindowStartupLocation = WindowStartupLocation.CenterScreen;
                List <Component> components = compCollection.ToList <Component>();
                cv.valuesList.ItemsSource   = components;
                cv.valuesList.SelectionMode = SelectionMode.Multiple;

                cv.Title = "Change Components";
                DataTemplate componentTemplate = cv.FindResource("componentTemplate") as DataTemplate;
                cv.valuesList.ItemTemplate  = componentTemplate;
                cv.valuesList.SelectedIndex = -1;
                if (SelectedComponents != null && SelectedComponents.Any())
                {
                    foreach (var o in SelectedComponents)
                    {
                        var selindex = components.IndexOf(o);
                        if (selindex != -1)
                        {
                            cv.valuesList.SelectedItems.Add(cv.valuesList.Items[selindex]);
                        }
                    }
                }


                // ChangeStatus ChangSt = new ChangeStatus(jira.issuesCollection[jiraPan.issueList.SelectedIndex].transitions);
                cv.ShowDialog();
                if (cv.DialogResult.HasValue && cv.DialogResult.Value)
                {
                    SelectedComponents = new List <Component>();

                    foreach (var c in cv.valuesList.SelectedItems)
                    {
                        Component cc = c as Component;
                        SelectedComponents.Add(cc);
                    }

                    string componentsout = "none";

                    if (SelectedComponents != null && SelectedComponents.Any())
                    {
                        componentsout = "";
                        foreach (var c in SelectedComponents)
                        {
                            componentsout += c.name + ", ";
                        }
                        componentsout = componentsout.Remove(componentsout.Count() - 2);
                    }
                    ChangeComponents.Content = componentsout;
                }
            }
            catch (System.Exception ex1)
            {
                MessageBox.Show("exception: " + ex1);
            }
        }
예제 #7
0
 public Button(String label, Player play, Rectangle rectangle, Texture2D texture, ChangeValue changeValue): base(rectangle, texture)
 {
     this.label = label;
     this.rectangle = rectangle;
     returnValue = false;
     this.texture = texture;
     lastKeyPress = 0;
     this.changeValue = changeValue;
     this.play = play;
 }
예제 #8
0
    static void Main(string[] args)
    {
        ChangeValue changeValue1 = new ChangeValue(increment);
        ChangeValue changeValue2 = new ChangeValue(decrement);

        changeValue1(10);
        Console.WriteLine("The value of the number is {0}", getValue());
        changeValue2(15);
        Console.WriteLine("The value of the number is {0}", getValue());
    }
예제 #9
0
 public ActionResult AddIndex()
 {
     ViewBag.lishow     = lishow;
     ViewBag.ashow      = "war";
     ViewBag.LfetShow   = LfetShow;
     ViewBag.ashow      = "war";
     ViewBag.location   = "所在位置:<a href='" + Url.Content("~/Warning/Index") + "'>布控管理</a> >>添加布控项";
     ViewBag.DSArea     = new AuditDAL().GetAreaList();
     ViewBag.NetbarType = ChangeValue.GetLocaTypeList();
     return(View());
 }
예제 #10
0
        static void Main(string[] args)
        {
            ChangeValue cv1 = new ChangeValue(AddNum);
            ChangeValue cv2 = new ChangeValue(MulNum);

            cv1(20);
            Console.WriteLine("Addnum ={0}", initialNumber);
            cv2(2);
            Console.WriteLine("Addnum ={0}", initialNumber);

            Console.ReadKey();
        }
예제 #11
0
        private void SetMaxValueBar(int maxValue)
        {
            if (progressBar == null)
            {
                return;
            }
            ChangeValue changeValue = new ChangeValue(value => progressBar.Value = value);
            SetMaxValue setMaxValue = new SetMaxValue(value => progressBar.Maximum = value);

            progressBar.Invoke(changeValue, progressBar.Minimum);
            progressBar.Invoke(setMaxValue, maxValue);
        }
예제 #12
0
        /// <summary>
        /// 添加操作日志
        /// </summary>
        /// <param name="log"></param>
        /// <returns></returns>
        public int InsertLog(OPLog log)
        {
            string sql = "";

            sql = "INSERT INTO OPLog(UID,Module,What,IpAddress,CreateTime) VALUES(@UID,@Module,@What,@IpAddress,GETDATE())";
            SqlParameter[] param = new SqlParameter[]
            {
                new SqlParameter("@UID", log.UID),
                new SqlParameter("@Module", log.Module),
                new SqlParameter("@What", ChangeValue.Base64Str(1, log.What)),
                new SqlParameter("@IpAddress", log.IpAddress)
            };
            return(SqlHelper.ExecuteNonQuery(SqlHelper.DBConnStr, CommandType.Text, sql, param));
        }
예제 #13
0
        internal ICollection <ChangeValue> Compare(object source, object target)
        {
            if (target == null)
            {
                return(null);
            }
            if (source == null)
            {
                return(null);
            }

            if (target.GetType() != source.GetType())
            {
                throw new Exception("Source and Target must be of the same type.");
            }

            HashSet <ChangeValue> changes = new HashSet <ChangeValue>();

            PropertyMap[] mapping = target.GetMappings();

            for (int index = 0; index < mapping.Length; index++)
            {
                PropertyMap map         = mapping[index];
                dynamic     sourceValue = map.Key.GetValue(source);
                dynamic     targetValue = map.Key.GetValue(target);

                if (sourceValue != null && sourceValue.GetType() != typeof(DBNull))
                {
                    if (HasEquality(sourceValue, targetValue))
                    {
                        continue;
                    }
                    ChangeValue dbChange = new ChangeValue(map.Value.Name, sourceValue, targetValue);
                    changes.Add(dbChange);
                }
                else if (targetValue != null)
                {
                    ChangeValue dbChange = new ChangeValue(map.Value.Name, null, targetValue);
                    changes.Add(dbChange);
                }
            }

            return(changes);
        }
예제 #14
0
        protected override void OnPaint(PaintEventArgs e)
        {
            Rectangle rect = ClientRectangle;

            Graphics g = e.Graphics;

            Brush brush = new SolidBrush(Color.Red);

            ProgressBarRenderer.DrawHorizontalBar(g, rect);
            rect.Inflate(-4, -4);

            if (Value > 0)
            {
                // As we doing this ourselves we need to draw the chunks on the progress bar
                Rectangle clip = new Rectangle(rect.X, rect.Y, (int)Math.Round(((float)Value / Maximum) * rect.Width), rect.Height);

                g.FillRectangle(brush, clip);
                ProgressBarRenderer.DrawHorizontalChunks(g, clip);
            }

            // Set the Display text (Either a % amount or our custom text
            string text = DisplayStyle == ProgressBarDisplayText.Percentage ? Value.ToString() + '%' : CustomText;


            using (Font f = new Font(FontFamily.GenericSerif, 8))
            {
                SizeF len = g.MeasureString(text, f);
                // Calculate the location of the text (the middle of progress bar)
                // Point location = new Point(Convert.ToInt32((rect.Width / 2) - (len.Width / 2)), Convert.ToInt32((rect.Height / 2) - (len.Height / 2)));
                Point location = new Point(Convert.ToInt32(((Width / 2) - len.Width / 2) + 5), Convert.ToInt32((Height / 2) - len.Height / 2));
                // The commented-out code will centre the text into the highlighted area only. This will centre the text regardless of the highlighted area.
                // Draw the custom text
                g.DrawString(text, f, Brushes.Black, location);
            }

            ChangeValue?.Invoke(this, e);
        }
예제 #15
0
 virtual public void calulateOptionPriceAndGreeks(long numberOfSimulations, Double intersRate, int steps, bool antitheticReduction, bool controlVariateReduction, bool multithreading, Double del = 0, ChangeValue change = ChangeValue.NONE, MainWindow form = null, GraphPlotting plot = null)
 {
 }
예제 #16
0
 virtual public Double calculateOptionPrice(long numberOfSimulations, int numberOfDays, Double daysToExpiry, Double del = 0, ChangeValue change = ChangeValue.NONE, Boolean controlVariateReduction = false, Boolean multithreading = false)
 {
     return(0);
 }
예제 #17
0
 public VideoController()
 {
     ViewBag.liShow = "video";
     log.Module     = "视频检索";
     ChangeValue.AddOpLog(log);
 }
예제 #18
0
        /// <summary>
        /// 日志列表
        /// </summary>
        /// <param name="dic"></param>
        /// <returns></returns>
        public PagedList <OPLog> GetList(Dictionary <string, string> dic)
        {
            string sql = "";

            try
            {
                int pageIndex = Convert.ToInt32(dic["pageIndex"]);
                int pageSize  = Convert.ToInt32(dic["pageSize"]);

                string txtName = dic["txtName"];
                string selName = dic["selName"].ToString();

                string txtIP = dic["txtAdderss"];
                string selIP = dic["selAdderss"].ToString();

                string beginTime = dic["CreateTime"];
                string endTime   = dic["EndTime"];

                string what = dic["txtWhat"];

                List <SqlParameter> listParam = new List <SqlParameter>();

                string whereSql = " WHERE 1=1 ";

                if (selName == "1" && !string.IsNullOrEmpty(txtName))
                {
                    whereSql += " AND u.UserName LIKE '%" + txtName + "%'";
                }
                else if (selName == "2" && !string.IsNullOrEmpty(txtName))
                {
                    whereSql += " AND u.UserName =@UserName";
                    listParam.Add(new SqlParameter("@UserName", txtName));
                }

                if (selIP == "1" && !string.IsNullOrEmpty(txtIP))
                {
                    whereSql += " AND l.IpAddress LIKE '%" + txtIP + "%'";
                }
                else if (selIP == "2" && !string.IsNullOrEmpty(txtIP))
                {
                    whereSql += " AND l.IpAddress =@IpAddress";
                    listParam.Add(new SqlParameter("@IpAddress", txtIP));
                }

                if (!string.IsNullOrEmpty(beginTime) && !string.IsNullOrEmpty(endTime))
                {
                    whereSql += " AND l.CreateTime BETWEEN '" + beginTime + "' AND '" + endTime + "' ";
                }
                else
                {
                    if (!string.IsNullOrEmpty(beginTime))
                    {
                        whereSql += " AND l.CreateTime > '" + beginTime + "'";
                    }
                    if (!string.IsNullOrEmpty(endTime))
                    {
                        whereSql += " AND l.CreateTime < '" + endTime + "'";
                    }
                }


                if (!string.IsNullOrEmpty(what))
                {
                    whereSql += " AND l.What LIKE '%" + ChangeValue.Base64Str(1, what) + "%'";
                    listParam.Add(new SqlParameter("@What", ChangeValue.Base64Str(1, what)));
                }

                SqlParameter[] param = listParam.ToArray();

                sql = "SELECT * FROM ( SELECT ROW_NUMBER () OVER (ORDER BY l.ID DESC) PageNum ,l.*,u.UserName,l.What ShowWhat FROM OPLog l with(nolock) LEFT JOIN UserInfo u ON u.ID = l.UID " + whereSql + " ) temp WHERE temp.PageNum BETWEEN " + ((pageIndex - 1) * pageSize + 1) + " AND " + pageIndex * pageSize;

                sql += " SELECT COUNT(0) FROM  OPLog l LEFT JOIN UserInfo u ON u.ID = l.UID " + whereSql;

                DataSet        ds      = SqlHelper.ExecuteDataset(SqlHelper.DBConnStr, CommandType.Text, sql, param);
                DataSetConvert convert = new DataSetConvert(ds);
                List <OPLog>   list    = convert.Get_ListModel <OPLog>();
                return(new PagedList <OPLog>(list, pageIndex, pageSize, Convert.ToInt32(ds.Tables[1].Rows[0][0])));
            }
            catch (Exception ex)
            {
                Logger.ErrorLog(ex, new Dictionary <string, string>()
                {
                    { "Function", "OPLogDAL.GetList(Dictionary<string,string> dic)" },
                    { "SQL", sql }
                });
                throw ex;
            }
        }
예제 #19
0
 public WarningController()
 {
     ViewBag.lishow = "Audit";
     log.Module     = "审计管理";
     ChangeValue.AddOpLog(log);
 }
예제 #20
0
        public ActionResult VideoList(int?Id, string txtAPName, string txtMac, string txtNETBAR_WACODE, string txtLName, string txtBeginTime, string txtEndTime)
        {
            try
            {
                ViewBag.location = "所在位置: <a href=\"" + Url.Content("~/Video/VideoList/1") + "\">视频检索</a> >> 视频数据列表";
                ViewBag.lishow   = lishow;
                ViewBag.ashow    = "video";
                ViewBag.LfetShow = LfetShow;
                ViewBag.ashow    = "video";

                string display = "";

                if (txtMac == null && txtAPName == null && txtNETBAR_WACODE == null && txtLName == null && txtBeginTime == null && txtEndTime == null)
                {
                    display = "display:none";
                }

                int[] userType = ChangeValue.GetUserType();
                Dictionary <string, string> dic = new Dictionary <string, string>()
                {
                    { "pageIndex", (Id ?? 1).ToString() }, { "pageSize", "10" }, { "txtMac", txtMac }, { "txtAPName", txtAPName }, { "txtNETBAR_WACODE", txtNETBAR_WACODE }, { "txtLName", txtLName == ","?"":txtLName }, { "txtBeginTime", txtBeginTime }, { "txtEndTime", txtEndTime }, { "UserType", userType[0].ToString() }, { "AreaId", userType[1].ToString() }
                };
                if (string.IsNullOrEmpty(display))
                {
                    ViewBag.pl = new Video3CDAL().GetVideo3CList(dic);
                }
                else
                {
                    ViewBag.pl = null;
                }
                ViewBag.dic     = dic;
                ViewBag.display = display;
                if (!string.IsNullOrEmpty(txtLName))
                {
                    log.What = "场所名称:" + txtLName;
                }
                if (!string.IsNullOrEmpty(txtAPName))
                {
                    log.What += "AP名称:" + txtAPName;
                }
                if (!string.IsNullOrEmpty(txtMac))
                {
                    log.What += "审计终端MAC地址:" + txtMac;
                }
                if (!string.IsNullOrEmpty(txtBeginTime))
                {
                    log.What += "开始时间:" + txtBeginTime;
                }
                if (!string.IsNullOrEmpty(txtEndTime))
                {
                    log.What += "结束时间:" + txtEndTime;
                }
                if (!string.IsNullOrEmpty(log.What))
                {
                    log.What = "视频数据列表导出Excel" + log.What; new OPLogDAL().InsertLog(log);
                }
            }
            catch (System.Data.SqlClient.SqlException sql)
            {
                ViewBag.errscript = "alert('检索数据遇到错误,请联系管理员')";
                Logger.ErrorLog(sql, new Dictionary <string, string>()
                {
                    { "Function", this.GetType().Name + ".VideoList[HttpGet]" }
                });
            }
            catch (Exception ex)
            {
                Logger.ErrorLog(ex, new Dictionary <string, string>()
                {
                    { "Function", this.GetType().Name + "VideoList[HttpGet]" }
                });
                ViewBag.errscript = "alert('未知错误,请联系管理员')";
            }
            return(View());
        }
예제 #21
0
        /// <summary>
        /// 查询布控任务列表(导出)
        /// </summary>
        /// <param name="dic"> 查询条件</param>
        /// <param name="Type">查询类型</param>
        /// <returns></returns>
        public DataTable ExportAuditDT(Dictionary <string, string> dic)
        {
            string TaskName               = dic.ContainsKey("TaskName") ? dic["TaskName"] : "";
            string Mobile                 = dic.ContainsKey("Mobile") ? dic["Mobile"] : "";
            string Mac                    = dic.ContainsKey("Mac") ? dic["Mac"] : "";
            string IMEI                   = dic.ContainsKey("IMEI") ? dic["IMEI"] : "";
            string CaseType               = dic.ContainsKey("CaseType") ? dic["CaseType"] : "";
            string NETWORK_APP            = dic.ContainsKey("NETWORK_APP") ? dic["NETWORK_APP"] : "";
            string IM                     = dic.ContainsKey("IM") ? dic["IM"] : "";
            string HeadName               = dic.ContainsKey("HeadName") ? dic["HeadName"] : "";
            string StartCreateTime        = dic.ContainsKey("StartCreateTime") ? dic["StartCreateTime"] : "";
            string EndCreateTime          = dic.ContainsKey("EndCreateTime") ? dic["EndCreateTime"] : "";
            string StartEndTime           = dic.ContainsKey("StartEndTime") ? dic["StartEndTime"] : "";
            string EndEndTime             = dic.ContainsKey("EndEndTime") ? dic["EndEndTime"] : "";
            string wheresql               = " WHERE  1=1";
            List <SqlParameter> paramlist = new List <SqlParameter>();

            if (!string.IsNullOrEmpty(dic["Uid"]) && dic["Uid"] != "0")
            {
                wheresql += " AND ci.Uid=@uid";
                paramlist.Add(new SqlParameter("@uid", dic["Uid"]));
            }
            if (!string.IsNullOrEmpty(TaskName))
            {
                if (dic["selTaskName"] == "1") //为1则为模糊,否则为精确,下同
                {
                    wheresql += " AND ci.TaskName LIKE @TaskName";
                    paramlist.Add(new SqlParameter("@TaskName", "%" + TaskName + "%"));
                }
                else
                {
                    wheresql += " AND ci.TaskName = @TaskName";
                    paramlist.Add(new SqlParameter("@TaskName", TaskName));
                }
            }
            if (!string.IsNullOrEmpty(Mobile))
            {
                if (dic["selMobile"] == "1") //为1则为模糊,否则为精确,下同
                {
                    wheresql += " AND ci.CaseValue LIKE @Mobile AND ci.CaseItem=1";
                    paramlist.Add(new SqlParameter("@Mobile", "%" + Mobile + "%"));
                }
                else
                {
                    wheresql += " AND ci.CaseValue = @Mobile AND ci.CaseItem=1";
                    paramlist.Add(new SqlParameter("@Mobile", Mobile));
                }
            }
            if (!string.IsNullOrEmpty(Mac))
            {
                if (dic["selMac"] == "1") //为1则为模糊,否则为精确,下同
                {
                    wheresql += " AND ci.CaseValue LIKE @Mac AND ci.CaseItem=2";
                    paramlist.Add(new SqlParameter("@Mac", "%" + Mac + "%"));
                }
                else
                {
                    wheresql += " AND ci.CaseValue = @Mac AND ci.CaseItem=2";
                    paramlist.Add(new SqlParameter("@Mac", Mac));
                }
            }
            if (!string.IsNullOrEmpty(IMEI))
            {
                if (dic["selIMEI"] == "1") //为1则为模糊,否则为精确,下同
                {
                    wheresql += " AND ci.CaseValue LIKE @IMEI AND ci.CaseItem=3";
                    paramlist.Add(new SqlParameter("@IMEI", "%" + IMEI + "%"));
                }
                else
                {
                    wheresql += " AND ci.CaseValue = @IMEI AND ci.CaseItem=3";
                    paramlist.Add(new SqlParameter("@IMEI", IMEI));
                }
            }
            if (!string.IsNullOrEmpty(dic["keyWord"]))
            {
                if (dic["selkeyWord"] == "1")
                {
                    wheresql += " AND ci.CaseValue LIKE @keyWord ";
                    paramlist.Add(new SqlParameter("@keyWord", "%" + dic["keyWord"] + "%"));
                }
                else
                {
                    wheresql += " AND ci.CaseValue = @keyWord ";
                    paramlist.Add(new SqlParameter("@keyWord", dic["keyWord"]));
                }
            }
            if (!string.IsNullOrEmpty(HeadName))
            {
                if (dic["selHeadName"] == "1") //为1则为模糊,否则为精确,下同
                {
                    wheresql += " AND ci.HeadName LIKE @HeadName";
                    paramlist.Add(new SqlParameter("@HeadName", "%" + HeadName + "%"));
                }
                else
                {
                    wheresql += " AND ci.HeadName = @HeadName";
                    paramlist.Add(new SqlParameter("@HeadName", HeadName));
                }
            }
            if (!string.IsNullOrEmpty(IM))
            {
                if (dic["selIM"] == "1") //为1则为模糊,否则为精确,下同
                {
                    wheresql += " AND ci.CaseValue LIKE @IM AND ci.CaseItem=3";
                    paramlist.Add(new SqlParameter("@IM", "%" + IM + "%"));
                }
                else
                {
                    wheresql += " AND ci.CaseValue = @IM AND ci.CaseItem=3";
                    paramlist.Add(new SqlParameter("@IM", IM));
                }
            }
            if (!string.IsNullOrEmpty(StartCreateTime))
            {
                wheresql += " AND ci.CreateTime > @StartCreateTime";
                paramlist.Add(new SqlParameter("@StartCreateTime", StartCreateTime));
            }
            if (!string.IsNullOrEmpty(EndCreateTime))
            {
                wheresql += " AND ci.CreateTime<@EndCreateTime";
                paramlist.Add(new SqlParameter("@EndCreateTime", EndCreateTime));
            }
            if (!string.IsNullOrEmpty(StartEndTime))
            {
                wheresql += " AND ci.EndTime > @StartEndTime";
                paramlist.Add(new SqlParameter("@StartEndTime", StartEndTime));
            }
            if (!string.IsNullOrEmpty(EndEndTime))
            {
                wheresql += " AND ci.EndTime<@EndEndTime";
                paramlist.Add(new SqlParameter("@EndEndTime", EndEndTime));
            }
            if (!string.IsNullOrEmpty(CaseType))
            {
                wheresql += " AND ci.CaseType=@casetype";
                paramlist.Add(new SqlParameter("@casetype", CaseType));
            }
            if (!string.IsNullOrEmpty(NETWORK_APP))
            {
                wheresql += " AND ci.NETWORK_APP=@network_app";
                paramlist.Add(new SqlParameter("@network_app", NETWORK_APP));
            }
            string sql = "";

            if (CaseType == "1")
            {
                sql = "SELECT  ROW_NUMBER () OVER (ORDER BY ci.ID DESC) ID,ci.TaskName,CASE WHEN ci.CaseItem=1 THEN ci.CaseValue ELSE '' END Mobile,CASE WHEN ci.CaseItem=2 THEN ci.CaseValue ELSE '' END MAC,CASE WHEN ci.CaseItem=3 THEN ci.CaseValue ELSE '' END IMEI,ci.CaseItem,ci.HeadName,ci.CreateTime,ci.EndTime,CASE WHEN ci.IsEnabled=1 THEN '禁用' ELSE '启用' END IsEnabled,ci.CaseValue FROM CasesInfo ci " + wheresql + "  ";
            }
            else
            {
                sql = "SELECT  ROW_NUMBER () OVER (ORDER BY ci.ID DESC) ID,ci.NETWORK_APP,ci.TaskName,ci.CaseValue,ci.CaseItem,ci.HeadName,ci.CreateTime,ci.EndTime,CASE WHEN ci.IsEnabled=1 THEN '禁用' ELSE '启用' END IsEnabled FROM CasesInfo ci " + wheresql + " ORDER BY ci.ID";
            }
            DataSet   ds = SqlHelper.ExecuteDataset(SqlHelper.DBConnStr, CommandType.Text, sql, paramlist.ToArray());
            DataTable dt = ds.Tables[0];

            if (CaseType == "3")
            {
                dt.Columns.Add("ST_NETWORK_APP", typeof(string));
                foreach (DataRow row in dt.Rows)
                {
                    row["ST_NETWORK_APP"] = row["NETWORK_APP"].ToString() == "0" ? "所有" : ChangeValue.VidContentType(row["NETWORK_APP"].ToString());
                }
            }
            return(dt);
        }
예제 #22
0
 public SearchController()
 {
     log.Module = "一键查询";
     ChangeValue.AddOpLog(log);
 }
        // This function has the logic which calculates price of the option.
        public override Double calculateOptionPrice(long numberOfSimulations, int numberOfDays, Double daysToExpiry, Double del = 0, ChangeValue change = ChangeValue.NONE, Boolean controlVariateReduction = false, Boolean multithreading = false)
        {
            Double[] priceAtEnd = Simulator.getPath(this, numberOfSimulations, numberOfDays, del, change, controlVariateReduction, multithreading);
            Double daysToExpirey = Convert.ToDouble((this.ExpiryDate - DateTime.Today).Days);
            Double sum = 0;
            for (int i = 0; i < priceAtEnd.Length; i++)
            {
                if (this.type == OptionType.CALL)
                {
                    sum = controlVariateReduction ? (sum + (priceAtEnd[i] >= this.strikePrice ? this.rebate : 0) - Simulator.controlVariateList[i]) : (sum + (priceAtEnd[i] >= this.strikePrice ? this.rebate : 0));
                }
                else if (this.type == OptionType.PUT)
                {
                    sum = controlVariateReduction ? (sum + (priceAtEnd[i] < this.strikePrice ? this.rebate : 0) - Simulator.controlVariateList[i]) : (sum + (priceAtEnd[i] < this.strikePrice ? this.rebate : 0));
                }
            }

            Double optionPrice = (sum / numberOfSimulations) * Math.Exp(-Simulator.yieldCurve[0].Rate * daysToExpirey / 365.0);
            if (change == ChangeValue.RATE || change == ChangeValue.TIME) { Simulator.changeValues(this, -1 * del, change); }
            return optionPrice;
        }
예제 #24
0
        private async Task <int> ChangeValueAndGetConcurrentAsync(string key, Func <Task <int> > source, int seconds, ChangeValue changeValue)
        {
            var cacheSemaphore = _semaphores.GetOrAdd(key, new SemaphoreSlim(1, 1));
            await cacheSemaphore.WaitAsync();

            int result;

            try
            {
                if (_cache.TryGetValue(key, out result))
                {
                    result = result + (int)changeValue;
                    Set(key, result, 60);
                }
                else
                {
                    result = await source();

                    Set(key, result, seconds);
                }
            }
            finally
            {
                cacheSemaphore.Release();
            }
            return(result);
        }
 // This function is a kind of a dummy finction that uses other 2 function calculate standarddevation and calculate option price to calculate value of greek and option price.
 public override void calulateOptionPriceAndGreeks(long numberOfSimulations, Double interstRate, int numberOfDays, bool antitheticReduction, bool controlVariateReduction, bool multithreading, Double del = 0, ChangeValue change = ChangeValue.NONE, MainWindow form = null, GraphPlotting plot = null)
 {
     Simulator.initializeYieldCurve();
     Simulator.createRandomNumbers(this, numberOfSimulations, numberOfDays, antitheticReduction);
     Double daysToExpiry = Convert.ToDouble((this.ExpiryDate - DateTime.Today).Days);
     Double[] priceAtEnd = Simulator.getPath(this, numberOfSimulations, numberOfDays, del, change, controlVariateReduction, multithreading, plot: plot);
     Double[] cv = new Double[priceAtEnd.Length];
     Simulator.controlVariateList.CopyTo(cv);
     this.price = calculateOptionPrice(numberOfSimulations, numberOfDays, daysToExpiry, controlVariateReduction: controlVariateReduction, multithreading: multithreading);
     if (controlVariateReduction)
     {
         calculateStandardErrorwithcv(numberOfSimulations, priceAtEnd, daysToExpiry, antitheticReduction, cv);
     }
     else
     {
         calculateStandardError(numberOfSimulations, priceAtEnd, daysToExpiry, antitheticReduction);
     }
     greeks.calculateGreeks(numberOfSimulations, numberOfDays, daysToExpiry, this, controlVariateReduction: controlVariateReduction, multithreading: multithreading, form: form);
     Simulator.randomNumbers.Clear();
 }
예제 #26
0
 /// <summary>
 /// 根据用户类型返回区域值并过滤区域值为0的情况
 /// </summary>
 /// <param name="val"></param>
 /// <returns></returns>
 public string RefFilterUserAreaValue0(int Type)
 {
     int[] userType = ChangeValue.GetUserType();
     return(((userType[0] == Type || userType[0] == 8) && userType[1] != 0) ? userType[1].ToString() : null);
 }
예제 #27
0
 private void Start()
 {
     resourcesImageUI.sprite = resourcesImage;
     ChangeUI();
     changeValue += ChangeUI;
 }
예제 #28
0
        public ActionResult VideoExprt(string txtMac, string txtAPName, string txtLName, string txtBeginTime, string txtEndTime, string txtNETBAR_WACODE)
        {
            try
            {
                UserInfo user = (UserInfo)Session["userInfo"];

                if (Convert.ToDateTime(txtBeginTime) > Convert.ToDateTime(txtEndTime))
                {
                    return(Content("<script>alert('开始时间不能大于结束时间');</script>"));
                }

                int[] userType = ChangeValue.GetUserType();
                Dictionary <string, string> dic = new Dictionary <string, string>()
                {
                    { "txtMac", txtMac }, { "txtNETBAR_WACODE", txtNETBAR_WACODE }, { "txtLName", txtLName }, { "txtAPName", txtAPName }, { "txtBeginTime", txtBeginTime }, { "txtEndTime", txtEndTime }, { "UserType", userType[0].ToString() }, { "AreaId", userType[1].ToString() }
                };

                if (!string.IsNullOrEmpty(txtLName))
                {
                    log.What = "场所名称:" + txtLName;
                }
                if (!string.IsNullOrEmpty(txtAPName))
                {
                    log.What += "AP名称:" + txtAPName;
                }
                if (!string.IsNullOrEmpty(txtMac))
                {
                    log.What += "AP设备MAC地址:" + txtMac;
                }
                if (!string.IsNullOrEmpty(txtNETBAR_WACODE))
                {
                    log.What += "上网服务场所编码:" + txtNETBAR_WACODE;
                }
                if (!string.IsNullOrEmpty(txtBeginTime))
                {
                    log.What += "开始时间:" + txtBeginTime;
                }
                if (!string.IsNullOrEmpty(txtEndTime))
                {
                    log.What += "结束时间:" + txtEndTime;
                }
                if (!string.IsNullOrEmpty(log.What))
                {
                    log.What = "视频数据列表导出Excel" + log.What; new OPLogDAL().InsertLog(log);
                }
                DataTable dt = new Video3CDAL().GetVideoToTable(dic);

                int rowCount = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["ExprotCout"]);
                if (dt == null || dt.Rows.Count == 0)
                {
                    return(Content("{\"err\":\"对不起,没有要导出的数据\"}"));
                }
                else if (dt.Rows.Count > rowCount)
                {
                    return(Content("{\"err\":\"为了保证导出数据的速度,数据源不能大于“" + rowCount + "”行\"}"));
                }
                else
                {
                    Dictionary <string, string> Head_Dic = new Dictionary <string, string>();
                    if (!string.IsNullOrEmpty(txtLName))
                    {
                        Head_Dic.Add("场所名称", txtLName);
                    }
                    if (!string.IsNullOrEmpty(txtAPName))
                    {
                        Head_Dic.Add("AP名称", txtAPName);
                    }
                    if (!string.IsNullOrEmpty(txtMac))
                    {
                        Head_Dic.Add("AP设备MAC地址", txtMac);
                    }
                    if (!string.IsNullOrEmpty(txtNETBAR_WACODE))
                    {
                        Head_Dic.Add("上网服务场所编码", txtNETBAR_WACODE);
                    }
                    if (!string.IsNullOrEmpty(txtBeginTime))
                    {
                        Head_Dic.Add("开始时间", txtBeginTime);
                    }
                    if (!string.IsNullOrEmpty(txtEndTime))
                    {
                        Head_Dic.Add("结束时间", txtEndTime);
                    }

                    Dictionary <string, string> Title_Dic = new Dictionary <string, string>()
                    {
                        { "序号", "PageNum" },
                        { "场所名称", "LName" },
                        { "AP名称", "APName" },
                        { "文件名", "FileName" },
                        { "文件大小", "FileSize" },
                        { "开始时间", "BeginTime" },
                        { "结束时间", "EndTime" },
                        { "创建时间", "CreateTime" }
                    };

                    NPOISheetModel sheet = new NPOISheetModel();
                    sheet.dt          = dt;
                    sheet.ExcelTitle  = "视频数据查询";
                    sheet.TableTitle  = Title_Dic;
                    sheet.TableSearch = Head_Dic;

                    string path = new ComNPOIExcel().Export(sheet, Server.MapPath("~/") + "UserData/EXP/Video/");
                    return(Content("{\"result\":\"" + path + "\"}"));
                }
            }
            catch (System.Data.SqlClient.SqlException)
            {
                return(Content("{\"err\":\"检索数据遇到错误,请联系管理员\"}"));
            }
            catch (Exception ex)
            {
                Logger.ErrorLog(ex, new Dictionary <string, string>()
                {
                    { "Function", this.GetType().Name + ".VideoExprt()[HttpGet]" }
                });
                return(Content("{\"err\":\"导出文件时出错,请联系管理员\"}"));
            }
        }
예제 #29
0
        public ActionResult Index(FormCollection form)
        {
            try
            {
                Response.Cache.SetCacheability(HttpCacheability.NoCache);
                Response.Cache.SetExpires(DateTime.Today.AddYears(-2));
                //调用Mac数据缓存
                WebCommon.GetCacheMac(false);
                //获取生产商信息缓存
                //WebCommon.GetCacheBusName();
                WebCommon.GetCacheLoca();
                WebCommon.GetCacheMacAllList();
                string userName = form["txtName"].ToString();
                string pwd      = StringFilter.getSHA1Code(form["txtPwd"].ToString());
                if (Session["ValidateStr"] == null)
                {
                    ViewBag.errscript = "alert('验证码过期!')";
                }
                else
                {
                    if (form["txtValidator"].ToString().ToLower() == Session["ValidateStr"].ToString().ToLower())
                    {
                        //string userName  = "******";
                        //string userName = form["txtName"].ToString().Trim();
                        //string pwd = StringFilter.getSHA1Code(form["txtPwd"].ToString().Trim());
                        //string pwd = StringFilter.getSHA1Code("123456").Trim();

                        UserInfoDAL udal = new UserInfoDAL();
                        UserInfo    user = udal.GetUserInfoDSByLogin(userName, pwd);
                        if (user != null)
                        {
                            Session["userInfo"] = user;
                            log.UID             = user.ID;
                            log.Module          = "登录管理";
                            log.What            = "登录成功,用户名:" + user.UserName + ";用户Id:" + user.ID;
                            udal.UpdateListtime(user.ID);
                            ChangeValue.AddOpLog(log);
                            new OPLogDAL().InsertLog(log);
                            user.PowerPathList = udal.GetUserPowerFSListToJid(user.JId);
                            IEnumerable <Sys_UserPowerInfo> IElist = user.PowerPathList.OrderBy(a => a.Indexs);
                            user.PowerPathList = IElist.ToList();
                            user.PowerList     = udal.GetUserShowPageByJid(user.JId);
                            List <Sys_UserPowerInfo> sys_list = user.PowerList.Where(a => a.FilePath.Equals("Home/Index")).ToList();
                            if (sys_list != null && sys_list.Count() > 0)
                            {
                                return(Redirect(Url.Content("~/Home/Index" + "")));
                            }
                            else
                            {
                                int    pid = user.PowerList.Where(A => A.Pid == 0).OrderBy(A => A.Indexs).First().SpId;;
                                string url = user.PowerList.Where(m => m.Pid == pid).OrderBy(m => m.Indexs).First().FilePath;
                                if (!string.IsNullOrEmpty(url))
                                {
                                    return(Redirect(Url.Content("~/" + url + "")));
                                }
                                else
                                {
                                    return(Content("<script>alert('抱歉,没有任何权限');window.location.href='" + Url.Content("~/Login/Index") + "';</script>"));
                                }
                            }
                        }
                        else
                        {
                            Session["ValidateStr"] = null;
                            //return Content("alert('登录失败')");
                            log.Module        = "登录管理";
                            log.What          = "登录失败,用户名:" + userName;
                            ViewBag.errscript = "alert('登录失败')";
                        }
                    }
                    else
                    {
                        Session["ValidateStr"] = null;
                        ViewBag.errscript      = "alert('验证码输入错误,请重新输入')";
                    }
                }
            }
            catch (SqlException sqlex)
            {
                Logger.ErrorLog(sqlex, null);
            }
            catch (Exception ex)
            {
                Logger.ErrorLog(ex, null);
            }
            return(View());
        }
예제 #30
0
        //This function creates an path of the stock which we assume for brownian geometric motion.
        #region Create Path for Underlying
        public static Double[] getPath(Options option, long noOfSimulations, int numberOfDays, Double del, ChangeValue change, bool controlVariateReduction, bool multithreading = true, GraphPlotting plot = null)
        {
            changeValues(option, del, change);
            Double[] priceAtEnd      = new Double[noOfSimulations];
            int      numberofThreads = multithreading ? Environment.ProcessorCount : 1;
            Double   dt = Convert.ToDouble((option.ExpiryDate - DateTime.Today).Days) / (365 * numberOfDays);

            if (controlVariateReduction)
            {
                controlVariateList.Clear();
            }
            int day = 0;

            Parallel.ForEach(randomNumbers, new ParallelOptions {
                MaxDegreeOfParallelism = numberofThreads
            }, randomList =>
            {
                Double[] simulatedPathForOneSimulation = new Double[numberOfDays + 1];
                simulatedPathForOneSimulation[0]       = option.Underlying.Price;
                double controlVariate = 0;
                for (int time = 1; time <= numberOfDays; time++)
                {
                    try
                    {
                        simulatedPathForOneSimulation[time] = simulatedPathForOneSimulation[time - 1] * Math.Exp(((yieldCurve[0].Rate - (Math.Pow(option.HistoricalVolatility, 2) / 2.0)) * (dt)) + option.HistoricalVolatility * Math.Sqrt(dt) * randomList[time - 1]);
                        if (controlVariateReduction)
                        {
                            Double delta = OptionDelta(simulatedPathForOneSimulation[time - 1], option.StrikePrice, yieldCurve[0].Rate, option.HistoricalVolatility, (numberOfDays - time) * dt);

                            if (option.Type == OptionType.PUT)
                            {
                                delta = delta - 1;
                            }

                            controlVariate += delta * (simulatedPathForOneSimulation[time] - (simulatedPathForOneSimulation[time - 1] * Math.Exp(yieldCurve[0].Rate * dt)));
                        }
                    }
                    catch (Exception e)
                    {
                        throw e;
                    }
                }
                lock (lck)
                {
                    if (plot != null && day <= 0)
                    {
                        plot.addNewSeries(simulatedPathForOneSimulation);
                    }
                    switch (option.OptionKind)
                    {
                    case OptionKind.ASIAN:
                        priceAtEnd[day++] = simulatedPathForOneSimulation.Average();
                        break;

                    case OptionKind.BARRIER:
                        switch (((BarrierOption)option).BarrierOptionType)
                        {
                        case BarrierOptionType.UPOUT:
                            if (simulatedPathForOneSimulation.Max() > ((BarrierOption)option).Barrier)
                            {
                                priceAtEnd[day++] = -1;
                            }
                            else
                            {
                                priceAtEnd[day++] = simulatedPathForOneSimulation[simulatedPathForOneSimulation.Length - 1];
                            }
                            break;

                        case BarrierOptionType.UPIN:
                            if (simulatedPathForOneSimulation.Max() <= ((BarrierOption)option).Barrier)
                            {
                                priceAtEnd[day++] = -1;
                            }
                            else
                            {
                                priceAtEnd[day++] = simulatedPathForOneSimulation[simulatedPathForOneSimulation.Length - 1];
                            }
                            break;

                        case BarrierOptionType.DOWNOUT:
                            if (simulatedPathForOneSimulation.Min() < ((BarrierOption)option).Barrier)
                            {
                                priceAtEnd[day++] = -1;
                            }
                            else
                            {
                                priceAtEnd[day++] = simulatedPathForOneSimulation[simulatedPathForOneSimulation.Length - 1];
                            }
                            break;

                        case BarrierOptionType.DOWNIN:
                            if (simulatedPathForOneSimulation.Min() >= ((BarrierOption)option).Barrier)
                            {
                                priceAtEnd[day++] = -1;
                            }
                            else
                            {
                                priceAtEnd[day++] = simulatedPathForOneSimulation[simulatedPathForOneSimulation.Length - 1];
                            }
                            break;

                        default:
                            break;
                        }
                        break;

                    case OptionKind.DIGITAL:
                        priceAtEnd[day++] = simulatedPathForOneSimulation[simulatedPathForOneSimulation.Length - 1];
                        break;

                    case OptionKind.EUROPEAN:
                        priceAtEnd[day++] = simulatedPathForOneSimulation[simulatedPathForOneSimulation.Length - 1];
                        break;

                    case OptionKind.LOOKBACK:
                        switch (option.Type)
                        {
                        case OptionType.CALL:
                            priceAtEnd[day++] = simulatedPathForOneSimulation.Max();
                            break;

                        case OptionType.PUT:
                            priceAtEnd[day++] = simulatedPathForOneSimulation.Min();
                            break;

                        default:
                            break;
                        }
                        break;

                    case OptionKind.RANGE:
                        priceAtEnd[day++] = simulatedPathForOneSimulation.Max() - simulatedPathForOneSimulation.Min();
                        break;

                    default:
                        priceAtEnd[day++] = simulatedPathForOneSimulation[simulatedPathForOneSimulation.Length - 1];
                        break;
                    }
                    if (controlVariateReduction)
                    {
                        controlVariateList.Add(controlVariate);
                    }
                }
            });

            if (change != ChangeValue.RATE && change != ChangeValue.TIME)
            {
                changeValues(option, -1 * del, change);
            }
            return(priceAtEnd);
        }
예제 #31
0
    /*
     * CreateYear: Creates the year gameobject and instantiates the planets
     * Parameters: int yearIndex - Passes in the index of the selected year to grab from List<Year>
     */
    public void CreateYear(int yearIndex)
    {
        //Checks if the year the user is traveling to is the Home Year. No JSON file for the home year
        if (yearIndex != -1)
        {
            //Gets the name of the year in the list of years
            string yearName = list_years[yearIndex].yr_name;

            //Get the year object from the List via Index
            Year year = list_years[yearIndex];

            //Open the JSON file with the name yr_name parameter passed in
            //string jsonString = File.ReadAllText("VRClubUniverseData/" + yearName + ".json");
            string jsonString;

#if UNITY_EDITOR
            if (isOculus)
            {
                jsonString = File.ReadAllText(Application.dataPath + "/../Website/data/VRClubUniverseData/Oculus/" + yearName + ".json");
            }
            else
            {
                jsonString = File.ReadAllText(Application.dataPath + "/../Website/data/VRClubUniverseData/Vive/" + yearName + ".json");
            }
#elif UNITY_STANDALONE
            if (isOculus)
            {
                jsonString = File.ReadAllText(Application.dataPath + "/../VRClubUniverseData/Oculus/" + yearName + ".json");
            }
            else
            {
                jsonString = File.ReadAllText(Application.dataPath + "/../VRClubUniverseData/Vive/" + yearName + ".json");
            }
#endif

            //TESTING
            Debug.Log("Jsonstring is: " + jsonString);

            //Create a JSONPlanet array and read the JSON file
            PlanetJSON[] universe = JsonHelper.FromJson <PlanetJSON>(jsonString);

            //For each object in the JSONPlanet array
            //foreach (PlanetJSON json_planet in universe)
            List <string>     imagePaths = new List <string>();
            List <PassSprite> callbacks  = new List <PassSprite>();
            for (int i = 0; i < universe.Length; i++)
            {
                PlanetJSON json_planet = universe[i];

                //Instantiate a Planet object with a Planet component on it
                GameObject planet = Instantiate(prefab_planet, planetPosition, Quaternion.identity);

                //Set the name of the planet game object in hierarchy
                planet.name = "Planet";

                //Add a Planet component on the new planet game object to declare it a planet object
                PlanetController currPlanet = planet.GetComponent <PlanetController>();

                //Set the parent of the new Planet object to be the Planets gameobject
                planet.transform.parent = year.planets.transform;

                //Set the planet's name
                currPlanet.data.title = json_planet.Name;

                //Set the planet's creator
                currPlanet.data.creator = json_planet.Creator;

                //Set the planet's description
                currPlanet.data.description = json_planet.Description;

                //Set the planet's year
                currPlanet.data.year = json_planet.Year.ToString();

                //Set the planet's executable path
                currPlanet.data.executable = json_planet.Executable;

                //Set the planet's tags by creating a string array of the same length
                currPlanet.data.des_tag = new string[json_planet.Tags.Length];

                //For each tag in the json planet
                for (int j = 0; j < json_planet.Tags.Length; j++)
                {
                    // Set the tag of the current planet equal to the json tag
                    currPlanet.data.des_tag[j] = json_planet.Tags[j];
                }

                //Get the planet's image with path
                currPlanet.data.image_name = json_planet.Image;

                //Turn the image from path URL into a Sprite to set
                imagePaths.Add(ExecutableSwitch.GetFullPath(currPlanet.data.image_name, currPlanet.data.executable, currPlanet.data.year));
                callbacks.Add(currPlanet.ReceiveSprite);

                currPlanet.data.image = null;

                //Adds the read planet into the year
                year.list_planets.Add(currPlanet);

                Renderer rend     = currPlanet.GetComponent <Renderer>();
                Material material = Instantiate(rend.material);
                rend.material = material;
                ChangeValue val = GetComponentInChildren <ChangeValue>();
                if (i > universe.Length / 2)
                {
                    val.change(rend, currPlanet.data.title, int.Parse(currPlanet.data.year), false);
                }
                else
                {
                    val.change(rend, currPlanet.data.title, int.Parse(currPlanet.data.year), true);
                }
            }

            ImageLoader.GetInstance().LoadImages(imagePaths, callbacks);

            OrbitManager orbitManager = OrbitManager.GetOrbitManager();
            if (orbitManager != null)
            {
                orbitManager.PopulateOrbit(year.list_planets.ToArray());
            }
            else
            {
                Debug.LogError("Could not find OrbitManager to populate planets. Waiting for OrbitManager...");
                StartCoroutine(WaitForOrbit(year));

                /*
                 * orbitManager = OrbitManager.GetOrbitManager();
                 * if (orbitManager != null)
                 * {
                 *  orbitManager.PopulateOrbit(year.list_planets.ToArray());
                 * } else
                 * {
                 *  Debug.LogError("Still could not find OrbitManager to populate planets.");
                 * }
                 */
            }
        }

        // Handles case if the year traveling to is the new year
        else
        {
            // There shouldn't be any planets in the Home year
        }
    }