Пример #1
0
        // ----- ----- ----- Method ----- ----- -----
        public WorldMap(IList<Area> areas, BasicData.FieldMap map)
        {
            Contract.Requires(areas != null, "areas");
            Contract.Requires(map != null, "map");

            Areas = areas;
            _data = map;
        }
Пример #2
0
 private void DeleteCondition()
 {
     string id = hdfDelete.Value;
     string user_id = Session["UserID"].ToString();
     BasicData bd = new BasicData();
     string strReturn = bd.CancelImgConditions(id, user_id);
     if (strReturn == "")
     {
         hdfDelete.Value = "";
         GenTable();
     }
 }
Пример #3
0
        public void ExecuteSimpleNestedShouldNotBuffer()
        {
            var model = TypeModel.Create();
#if DEBUG
            model.ForwardsOnly = true;
#endif
            var obj = new BasicData {C = new C {Field1 = "abc", Field2 = "def"}};
            var clone = (BasicData)model.DeepClone(obj);
            Assert.AreEqual("abc", clone.C.Field1);
            Assert.AreEqual("def", clone.C.Field2);
            Assert.AreNotSame(obj, clone);
        }
Пример #4
0
    private void LoadData()
    {
        string type = Request.Params["type"];
        imgType.ImageUrl = "~/" + BasicData.GetImgConditionsType(type);

        BasicData bd = new BasicData();
        ArrayList arConditions = bd.GetConditons(type);

        for (int i = 0; i < arConditions.Count; i++)
        {
            string c = arConditions[i].ToString();
            ddlConditions.Items.Add(new ListItem(c, c));
        }
    }
Пример #5
0
    protected void btnOK_Click(object sender, EventArgs e)
    {
        string type = Request.Params["type"];
        string condition = ddlConditions.SelectedValue;
        string count = txtCount.Text.Trim();
        string add_id = Session["UserID"].ToString();

        BasicData bd = new BasicData();
        string strReturn = bd.InsertImgConditions(type, condition, count, add_id);
        if (strReturn == "")
        {
            Response.Redirect("ImageConfig.aspx");
        }
        else
        {
            lbAlert.Visible = true;
            lbAlert.Text = "Erro: " + strReturn;
        }
    }
Пример #6
0
    private void DeleteQCFactDept()
    {
        string id = Request.Params["id"];
        string[] arValue = id.Split('-');
        string user_id = arValue[0];
        string fact_no = arValue[1];
        string dept_no = arValue[2];
        string sec_no = arValue[3];

        BasicData bd = new BasicData();
        string errMsg = bd.DeleteQCFactDept(user_id, fact_no, dept_no, sec_no);
        string html = "";
        if (errMsg == "")
        {
            html = PccRow.GenOuterHtml(GenTableQC(user_id, fact_no, dept_no));
        }
        else
        {
            html = "Erro: " + errMsg;
        }

        ReturnServer(html);
    }
Пример #7
0
    private void GenTableQCData(ref Table dTable, string user_id, string fact_no, string dept_no)
    {
        string cssClass = "";
        BasicData bd = new BasicData();
        DataTable dtData = bd.GetQCFactDept(user_id, fact_no, dept_no, "");

        PccErrMsg myLabel = new PccErrMsg(Server.MapPath("~") + "/XmlDoc", Session["CodePage"].ToString(), "Label");

        int i = 0;
        foreach (DataRow dr in dtData.Rows)
        {
            if (i % 2 == 1) cssClass = "cssGridRowDetailsAlternating";
            else cssClass = "cssGridRow";

            i++;
            TableRow row = new TableRow();
            row.HorizontalAlign = HorizontalAlign.Center;
            TableCell cell = new TableCell();

            cell.Text = dr["fact_no"].ToString();// Xưởng
            cell.CssClass = cssClass;
            row.Cells.Add(cell);

            cell = new TableCell();
            cell.Text = dr["dept_name"].ToString();// Bộ Phận
            cell.CssClass = cssClass;
            row.Cells.Add(cell);

            cell = new TableCell();
            cell.Text = dr["sec_no"].ToString();// Mã Tổ
            cell.CssClass = cssClass;
            row.Cells.Add(cell);

            cell = new TableCell();
            cell.Text = dr["sec_name"].ToString();// Tên Tổ
            cell.CssClass = cssClass;
            row.Cells.Add(cell);

            #region type_check

            cell = new TableCell();
            cell.Text = BasicData.GetTypeName(dr["type_Check"].ToString(), myLabel);// Loại Tổ
            cell.Width = Unit.Pixel(200);
            cell.CssClass = cssClass;
            row.Cells.Add(cell);
            #endregion

            string id = user_id.Split('.')[0] + "-" + dr["fact_no"].ToString().Trim() + "-" + dr["dept_no"].ToString().Trim() + "-" + dr["sec_no"].ToString().Trim();

            Image imgDelete = new Image();
            imgDelete.ImageUrl = "~/Images/Icon/delete.gif";
            imgDelete.Style["cursor"] = "pointer";
            imgDelete.Attributes.Add("onclick", "DeleteQCFactDept('" + id + "');");

            cell = new TableCell();
            cell.Controls.Add(imgDelete);
            cell.CssClass = cssClass;

            row.Cells.Add(cell);

            dTable.Rows.Add(row);
        }
        if (dtData.Rows.Count == 0)
        {
            TableRow row = new TableRow();
            row.HorizontalAlign = HorizontalAlign.Center;
            TableCell cell = new TableCell();
            cell.Text = "No Data";
            cell.CssClass = "cssGridRow";
            cell.ColumnSpan = 6;
            row.Cells.Add(cell);
            dTable.Rows.Add(row);

        }
    }
Пример #8
0
 private void LoadUserInfo()
 {
     BasicData bd = new BasicData();
     DataTable dtInfo = bd.GetApUser(Request.Params["user_id"]);
     lbUserDesc.Text = dtInfo.Rows[0]["user_desc"].ToString();
     lbFact_no.Text = dtInfo.Rows[0]["fact_no"].ToString();
     lbEmail.Text = dtInfo.Rows[0]["email"].ToString();
     lbEmp_no.Text = dtInfo.Rows[0]["emp_no"].ToString();
 }
Пример #9
0
    private void LoadData()
    {
        string user_id = Request.Params["user_id"];
        string fact_no = BasicData.GetFactByUser(user_id);
        string dept_no = ddlDept.SelectedValue;
        string build_no = ddlBuild.SelectedValue;
        string floor = ddlFloor.SelectedValue;

        try
        {

            BasicData bd = new BasicData();
            DataTable dtData = bd.GetSecERP(fact_no, dept_no, build_no, floor);
            dtQCFactDept = bd.GetQCFactDept(user_id, fact_no);

            gvData.DataSource = dtData;
            gvData.DataBind();
        }
        catch { }
    }
        //we may have to think about loading information.
        //until i have some experience, not sure what to do (?)

        public GamePage(IGameInfo gameData, BasicData basicData, IStartUp start) : base(gameData, basicData, start)
        {
            //TODO:  may need to think about if we need load or update (?)
        }
Пример #11
0
 public string createEmployee(string[] data)
 {
     // create a new employee record
     BasicData bData = new BasicData();
     bData.token = Token;
     bData.output = OutPut;
     Request objrequest = new Request();
     objrequest.method = "CREATE";
     objrequest.module = "staff.employees";
     bData.request = objrequest;
     NameValueCollection RequestApi = new NameValueCollection();
     JavaScriptSerializer js = new JavaScriptSerializer();
     RequestApi.Add("data", js.Serialize(bData));
     return perform_request(RequestApi);
 }
Пример #12
0
    private string destroySession()
    {
        // destroy the currently active session
        BasicData bData = new BasicData();
        bData.token = Token;
        bData.output = OutPut;
        Request objrequest = new Request();
        objrequest.method = "GET";
        objrequest.module = "staff.logout";
        bData.request = objrequest;
        NameValueCollection RequestApi = new NameValueCollection();
        JavaScriptSerializer js = new JavaScriptSerializer();
        RequestApi.Add("data", js.Serialize(bData));
        string responseXml = perform_request(RequestApi);
        TextReader txtReader = new StringReader(responseXml);
        XmlReader reader = new XmlTextReader(txtReader);
        currentResponse = new DataSet();
        currentResponse.ReadXml(reader);
        reader.Close();
        txtReader.Close();

        if (currentResponse.Tables[0].Rows.Count > 0)
        {
            for (int i = 0; i < currentResponse.Tables[0].Rows.Count; i++)
            {
                if (currentResponse.Tables[0].Rows[i]["status"] != null)
                {
                    if (currentResponse.Tables[0].Rows[i]["status"].ToString() == "1")
                    {
                        System.Web.HttpContext.Current.Session["token"] = null;
                        System.Web.HttpContext.Current.Session["data"] = null;
                        break;
                    }

                }
            }
        }
        return responseXml;
    }
Пример #13
0
 public DominoGamesVM(CommandContainer commandContainer, IDominoDrawProcesses <D> mainGame, IDominoGamesData <D> viewModel, BasicData basicData, TestOptions test, IGamePackageResolver resolver) : base(commandContainer, mainGame, viewModel, basicData, test, resolver)
 {
     _model    = viewModel;
     _mainGame = mainGame;
     //do the delegates.
     _model.DrewDominoAsync = DrewDominoAsync;
     if (AlwaysEnableHand() == false)
     {
         _model.PlayerHand1.SendEnableProcesses(this, () =>
         {
             return(CanEnableHand());
         });
     }
     else
     {
         _model.PlayerHand1.SendAlwaysEnable(this);// will handle this part
     }
     _model.BoneYard.SendEnableProcesses(this, () =>
     {
         return(CanEnableBoneYard());
     });
     _model.HandClickedAsync        = HandClicked;
     _model.PlayerBoardClickedAsync = PlayerBoardClickedAsync;
 }
Пример #14
0
        public string ProcessRequest(string id)
        {
            string message               = "Sucussfully loaded data for ";
            string _nseUrlIo             = ConfigurationManager.AppSettings["NseUrlIO"].Replace("&amp;", "&");
            string _nseUrlBasic          = ConfigurationManager.AppSettings["NseUrlBasic"].Replace("&amp;", "&");
            string _nifty50              = ConfigurationManager.AppSettings["nifty50"].Replace("&amp;", "&");
            string _allFO                = ConfigurationManager.AppSettings["AllFO"].Replace("&amp;", "&");
            string _indexOnly            = ConfigurationManager.AppSettings["IndexOnly"].Replace("&amp;", "&");
            string _banknifty            = ConfigurationManager.AppSettings["Banknifty"].Replace("&amp;", "&");
            string _expiryDate           = ConfigurationManager.AppSettings["ExpiryDate"];
            string _masterDMAExcelSource = ConfigurationManager.AppSettings["MasterDMAExcelSource"];
            string _TodayCSVFile         = ConfigurationManager.AppSettings["TodayCSVFile"];
            string _masterDatapathOI     = ConfigurationManager.AppSettings["MasterDatapathOI"];
            string _masterDatapathBasic  = ConfigurationManager.AppSettings["MasterDatapathBasic"];
            string _masterDatapathDMA    = ConfigurationManager.AppSettings["MasterDatapathDMA"];



            BulkEntity objData  = new BulkEntity();
            Dma        objDma   = new Dma();
            OBJtoXML   xmltoObj = new OBJtoXML();

            try
            {
                string _list = "";

                if (id.Contains("IndexOnly"))
                {
                    _list   = _indexOnly;
                    message = message + " IndexOnly,";
                }
                else if (id.Contains("Banknifty"))
                {
                    _list   = _banknifty;
                    message = message + " Banknifty,";
                }
                else if (id.Contains("nifty50"))
                {
                    _list   = _nifty50;
                    message = message + " nifty50,";
                }
                else
                {
                    _list   = _allFO;
                    message = message + " All listed items.,";
                }

                foreach (string item in id.Split(','))
                {
                    if (item == "BasicData")
                    {
                        objData.BasicData = BasicData.ColletData(_nseUrlBasic, _list);
                        message           = message + " BasicData,";
                        xmltoObj.CreateXML(objData.BasicData, _masterDatapathBasic, "BasicData", false);


                        List <KeyValue> objLtpPrices = GenerateLastPrices(objData.BasicData);
                        objData.DMAData = objDma.GetDmaData(_masterDMAExcelSource, objLtpPrices, "");
                        message         = message + " DMA,";
                        xmltoObj.CreateXML(objData.DMAData, _masterDatapathDMA, "DMAData", false);
                    }
                    if (item == "DMA")
                    {
                        //DMA moved to Basic data refresh, when you click referesh request for the
                        //basic data then system refresh DMA data also
                        //So, no need to saparate request for the DMA.
                        //Presently signing off the DMA refresh option based on the data.csv file

                        objData.DMAData = objDma.GetDmaData(_masterDMAExcelSource, _TodayCSVFile, "");
                        message         = message + " DMA,";
                        xmltoObj.CreateXML(objData.DMAData, _masterDatapathDMA, "DMAData", false);
                    }
                    if (item == "OI")
                    {
                        IOData objOI = new IOData();
                        objData.OIData = objOI.LoadOIData(_nseUrlIo, _expiryDate, _list);
                        message        = message + " OI,";
                        xmltoObj.CreateXML(objData.OIData, _masterDatapathOI, "OIData", false);
                    }
                }
            }
            catch (Exception ex)
            {
                message = ex.Message;
            }

            return(message);
        }
Пример #15
0
 public async Task UpOrDownAsync(BasicData entity, string userId)
 {
     await UpdateAsync(entity, userId);
 }
Пример #16
0
        public static string LoadBasicData(string id)
        {
            string message               = "Sucussfully loaded data for ";
            string _nseUrlIo             = ConfigurationManager.AppSettings["NseUrlIO"].Replace("&amp;", "&");
            string _nseUrlBasic          = ConfigurationManager.AppSettings["NseUrlBasic"].Replace("&amp;", "&");
            string _nifty50              = ConfigurationManager.AppSettings["nifty50"].Replace("&amp;", "&");
            string _allFO                = ConfigurationManager.AppSettings["AllFO"].Replace("&amp;", "&");
            string _indexOnly            = ConfigurationManager.AppSettings["IndexOnly"].Replace("&amp;", "&");
            string _banknifty            = ConfigurationManager.AppSettings["Banknifty"].Replace("&amp;", "&");
            string _expiryDate           = ConfigurationManager.AppSettings["ExpiryDate"];
            string _masterDMAExcelSource = ConfigurationManager.AppSettings["MasterDMAExcelSource"];
            string _TodayCSVFile         = ConfigurationManager.AppSettings["TodayCSVFile"];
            string _masterDatapathOI     = ConfigurationManager.AppSettings["MasterDatapathOI"];
            string _masterDatapathBasic  = ConfigurationManager.AppSettings["MasterDatapathBasic"];
            string _masterDatapathDMA    = ConfigurationManager.AppSettings["MasterDatapathDMA"];



            BulkEntity objData  = new BulkEntity();
            Dma        objDma   = new Dma();
            OBJtoXML   xmltoObj = new OBJtoXML();

            try
            {
                string _list = "";

                if (id.Contains("IndexOnly"))
                {
                    _list   = _indexOnly;
                    message = message + " IndexOnly,";
                }
                else if (id.Contains("Banknifty"))
                {
                    _list   = _banknifty;
                    message = message + " Banknifty,";
                }
                else if (id.Contains("nifty50"))
                {
                    _list   = _nifty50;
                    message = message + " nifty50,";
                }
                else
                {
                    _list   = _allFO;
                    message = message + " All listed items.,";
                }

                foreach (string item in id.Split(','))
                {
                    if (item == "BasicData")
                    {
                        objData.BasicData = BasicData.ColletData(_nseUrlBasic, _list);
                        message           = message + " BasicData,";
                        xmltoObj.CreateXML(objData.BasicData, _masterDatapathBasic, "basicdata", true);

                        //Need to implement this one when master data been ready
                        //List<KeyValue> objLtpPrices = GenerateLastPrices(objData.BasicData);
                        //objData.DMAData = objDma.GetDmaData(_masterDMAExcelSource, objLtpPrices, "");
                        //message = message + " DMA,";
                        //xmltoObj.CreateXML(objData.DMAData, _masterDatapathDMA, "dmadata", true);
                    }
                    if (item == "OI")
                    {
                        IOData objOI = new IOData();
                        objData.OIData = objOI.LoadOIData(_nseUrlIo, _expiryDate, _list);
                        message        = message + " OI,";
                        xmltoObj.CreateXML(objData.OIData, _masterDatapathOI, "openinterest", true);
                    }
                }
            }
            catch (Exception ex)
            {
                message = ex.Message;
            }
            return(message);
        }
Пример #17
0
    public string Select_SingleCol(string colname, string keyname, string keyvalue, string tabname)
    {
        BasicData bd = new BasicData();

        return(bd.Select_SingleCol(colname, keyname, keyvalue, tabname));
    }
Пример #18
0
    public int Update_SingleCol(string colname, string colvalue, string keyname, string keyvalue, string tabname)
    {
        BasicData bd = new BasicData();

        return(bd.Update_SingleCol(colname, colvalue, keyname, keyvalue, tabname));
    }
 public SpinnerCP(BasicData thisdata)
 {
     _thisData = thisdata;
 }
Пример #20
0
 private void LoadDDLDept()
 {
     BasicData bd = new BasicData();
     ddlDept.DataSource = bd.GetDeptInQCFactDept(ddlFact.SelectedValue);
     ddlDept.DataTextField = "dept_name";
     ddlDept.DataValueField = "dept_no";
     ddlDept.DataBind();
     ddlDept.Items.Insert(0, new ListItem("--ALL--", ""));
 }
Пример #21
0
 public MultiplayerBasicShellView(IGameInfo gameData,
                                  BasicData basicData,
                                  IStartUp start
                                  ) : base(gameData, basicData, start)
 {
 }
Пример #22
0
 public string createVacationSchedule(string[] vacation_details)
 {
     // create a vacation schedule
     BasicData bData = new BasicData();
     bData.token = Token;
     bData.output = OutPut;
     Request objrequest = new Request();
     objrequest.method = "CREATE";
     objrequest.module = "schedule.vacations";
     bData.request = objrequest;
     NameValueCollection RequestApi = new NameValueCollection();
     JavaScriptSerializer js = new JavaScriptSerializer();
     RequestApi.Add("data", js.Serialize(bData));
     return perform_request(RequestApi);
 }
Пример #23
0
 public Show()
 {
     Type = new BasicData <ShowType>();
 }
Пример #24
0
 public string getVacationSchedules(string[] time_period)
 {
     // get schedule vacations, pass start and end params to get vacations within a certian time-period
     BasicData bData = new BasicData();
     bData.token = Token;
     bData.output = OutPut;
     Request objrequest = new Request();
     objrequest.method = "GET";
     objrequest.module = "schedule.vacations";
     bData.request = objrequest;
     NameValueCollection RequestApi = new NameValueCollection();
     JavaScriptSerializer js = new JavaScriptSerializer();
     RequestApi.Add("data", js.Serialize(bData));
     return perform_request(RequestApi);
 }
Пример #25
0
 public string createAdminFile(string[] file_details)
 {
     // create new admin file
     BasicData bData = new BasicData();
     bData.token = Token;
     bData.output = OutPut;
     Request objrequest = new Request();
     objrequest.method = "CREATE";
     objrequest.module = "admin.files";
     bData.request = objrequest;
     NameValueCollection RequestApi = new NameValueCollection();
     JavaScriptSerializer js = new JavaScriptSerializer();
     RequestApi.Add("data", js.Serialize(bData));
     return perform_request(RequestApi);
     //$file_details = array_merge( $file_details, $this->getFileData( $file_details['filename'] ) );
     //return $this->setRequest(
     //    array_merge(
     //        array(
     //            'module' => 'admin.file',
     //            'method' => 'CREATE'
     //        ),
     //        $file_details
     //    )
     //);
 }
Пример #26
0
        public static List <BasicData> ReadCsvByReader(string sid, string date, TextReader stream, decimal[] bigs, DateTime lastupdate)
        {
            int index = 0;

            //bigs = null;
            //bigs = new decimal[1];
            //bigs[0] = 1000M;
            List <BasicData> list = new List <BasicData>();

            BasicData[] array = new BasicData[bigs.Length];

            if (date.Length != 10)
            {
                throw new Exception("time format is wrong -" + date);
            }
            string   time = date;
            DateTime t    = new DateTime(Int32.Parse(time.Substring(0, 4)), Int32.Parse(time.Substring(5, 2)), Int32.Parse(time.Substring(8, 2)));

            //处理过了就忽略
            if (t < lastupdate.AddDays(1))
            {
                return(null);
            }

            Dictionary <decimal, string> temp = new Dictionary <decimal, string>();

            for (int j = 0; j < bigs.Length; j++)
            {
                array[j]        = new BasicData();
                array[j].big    = (int)bigs[j];
                array[j].time   = t;
                array[j].sid    = sid;
                array[j].c_type = "d";
                temp[bigs[j]]   = "";
            }

            // open the file "data.csv" which is a CSV file with headers
            using (CsvReader csv = new CsvReader(stream, true))
            {  //颠倒记录
                IEnumerable <string[]> hi = csv.Reverse <string[]>();

                decimal current;

                decimal open = 0, close = 0, high = 0, low = 0;
                string  extstring = "";


                foreach (String[] record in hi)
                {
                    string price_str  = record[1];
                    string change_str = record[2];
                    string share_str  = record[3];
                    string type_str   = record[5];
                    string time_str   = record[0];
                    try
                    {
                        Decimal price = Decimal.Parse(price_str.IndexOf("\0") > 0 ? price_str.Remove(price_str.IndexOf("\0")) : price_str);
                        Double  share = Double.Parse(share_str.IndexOf("\0") > 0 ? share_str.Remove(share_str.IndexOf("\0")) : share_str);

                        //count close,open,low,high
                        current = price;
                        if (index == 0)
                        {
                            open = current;
                            high = current;
                            low  = current;
                        }
                        if (high < current)
                        {
                            high = current;
                        }
                        if (low > current)
                        {
                            low = current;
                        }
                        close = current;
                        index++;

                        for (int k = 0; k < bigs.Length; k++)
                        {
                            int      fieldCount = csv.FieldCount;
                            string[] headers    = csv.GetFieldHeaders();

                            array[k].open        = open;
                            array[k].close       = close;
                            array[k].high        = high;
                            array[k].low         = low;
                            array[k].totalshare += share;
                            array[k].totalmoney += Decimal.Multiply(price, (Decimal)share);

                            if (Int32.Parse(share_str) >= bigs[k])
                            {
                                //15位编码编码,
                                //第1位买单1卖单0
                                //后3位股数(百手)
                                //后3位时间数(相对于9:25的分钟数)
                                //后4位位股价(1正0负,后三位是相对开盘的万分比
                                //后4位,股价变化(1正0负,后3位是万分比)
                                //Console.WriteLine(time_str + ": " + share + " " + type_str);

                                string code = "";
                                if (type_str == "S")
                                {
                                    //string code = "-" + MyBase64.CompressNumber(long.Parse(p(share) + p1(time_str) + p2(current, open)));
                                    if (bigs[k] > 0)
                                    {
                                        code           = p(share) + p1(time_str) + RateToOpen(current, open) + RateToBefore(decimal.Parse(change_str), current);
                                        code           = MyBase64.CompressNumber(long.Parse(code));
                                        code           = "-" + code;
                                        temp[bigs[k]] += code;
                                    }
                                    array[k].sellshare += share;
                                    array[k].sellmoney += Decimal.Multiply(price, (Decimal)share);
                                }
                                if (type_str == "B")
                                {
                                    if (bigs[k] > 0)
                                    {
                                        //string code = "-" + MyBase64.CompressNumber(long.Parse(p(share) + p1(time_str) + p2(current, open)));
                                        code = p(share) + p1(time_str) + RateToOpen(current, open) + RateToBefore(decimal.Parse(change_str), current);
                                        //Console.WriteLine(code);
                                        code           = MyBase64.CompressNumber(long.Parse(code));
                                        code           = "+" + code;
                                        temp[bigs[k]] += code;
                                    }
                                    array[k].buyshare += share;
                                    array[k].buymoney += Decimal.Multiply(price, (Decimal)share);
                                }

                                array[k].bigdetail = temp[bigs[k]];

                                //Console.WriteLine(array[k].bigdetail);
                            }
                        }
                    }
                    catch
                    {
                        StockLog.Log.Error(sid + " import fail");
                    }
                }
            }
            for (int j = 0; j < bigs.Length; j++)
            {
                list.Add(array[j]);
            }
            return(list);
        }
Пример #27
0
 public string createStaffSkill(string[] skill_details)
 {
     // create staff skill
     BasicData bData = new BasicData();
     bData.token = Token;
     bData.output = OutPut;
     Request objrequest = new Request();
     objrequest.method = "CREATE";
     objrequest.module = "staff.skills";
     bData.request = objrequest;
     NameValueCollection RequestApi = new NameValueCollection();
     JavaScriptSerializer js = new JavaScriptSerializer();
     RequestApi.Add("data", js.Serialize(bData));
     return perform_request(RequestApi);
 }
Пример #28
0
        public GameBoardProcesses(IAsyncDelayer delay,
                                  EventAggregator aggregator,
                                  BasicData basicData,
                                  TestOptions test,
                                  SnakesAndLaddersVMData model
                                  )
        {
            //_mainGame = mainGame;
            _delay      = delay;
            _aggregator = aggregator;
            _basicData  = basicData;
            _test       = test;
            _model      = model;
            _spaceList  = new Dictionary <int, SpaceInfo>();
            int x;

            for (x = 1; x <= 100; x++)
            {
                SpaceInfo thisSpace = new SpaceInfo();
                thisSpace.JumpTo = x;
                if (x == 4)
                {
                    thisSpace.JumpTo = 39;
                }
                else if (x == 30)
                {
                    thisSpace.JumpTo = 12;
                }
                else if (x == 33)
                {
                    thisSpace.JumpTo = 52;
                }
                else if (x == 36)
                {
                    thisSpace.JumpTo = 8;
                }
                else if (x == 59)
                {
                    thisSpace.JumpTo = 63;
                }
                else if (x == 70)
                {
                    thisSpace.JumpTo = 50;
                }
                else if (x == 26)
                {
                    thisSpace.JumpTo = 75;
                }
                else if (x == 73)
                {
                    thisSpace.JumpTo = 93;
                }
                else if (x == 86)
                {
                    thisSpace.JumpTo = 57;
                }
                else if (thisSpace.JumpTo == 99)
                {
                    thisSpace.JumpTo = 42;
                }
                _spaceList.Add(x, thisSpace);
            }
        }
Пример #29
0
    public string getScheduleConflicts(string[] time_period)
    {
        // get schedule conflicts
        BasicData bData = new BasicData();
        bData.token = Token;
        bData.output = OutPut;

        Request objrequest = new Request();
        objrequest.method = "GET";
        objrequest.module = "schedule.conflicts";
        bData.request = objrequest;
        NameValueCollection RequestApi = new NameValueCollection();
        JavaScriptSerializer js = new JavaScriptSerializer();
        RequestApi.Add("data", js.Serialize(bData));
        return perform_request(RequestApi);
    }
 void IStartUp.StartVariables(BasicData data)
 {
 }
Пример #31
0
    public string setRequest(NameValueCollection requests)
    {
        // set the request parameters
        // clear out previous request data
        this.requests = new NameValueCollection();

        // set the default response type of JSON
        this.request["output"] = this._outPut;

        this._init = 0;
        string item = null;
        if (currentResponse != null)
        {
            if (Token != null)
            {
                foreach (string item_loopVariable in new NameValueCollection(requests))
                {
                    item = item_loopVariable;
                    if (requests[item] == "key")
                    {
                        requests.Remove(item);
                        break;
                    }
                }
                return perform_request(requests);
            }
            else
            {
                BasicData bData = new BasicData();
                bData.key = Key;
                bData.output = OutPut;
                Request objrequest = new Request();
                objrequest.method = Method;
                objrequest.module = module;
                objrequest.password = Password;
                objrequest.username = Username;
                bData.request = objrequest;
                NameValueCollection RequestApi = new NameValueCollection();
                JavaScriptSerializer js = new JavaScriptSerializer();
                RequestApi.Add("data", js.Serialize(bData));

                return perform_request(RequestApi);
            }
        }
        else
        {
            BasicData bData = new BasicData();
            bData.key = Key;
            bData.output = OutPut;
            Request objrequest = new Request();
            objrequest.method = Method;
            objrequest.module = module;
            objrequest.password = Password;
            objrequest.username = Username;
            bData.request = objrequest;
            NameValueCollection RequestApi = new NameValueCollection();
            JavaScriptSerializer js = new JavaScriptSerializer();
            RequestApi.Add("data", js.Serialize(bData));

            return perform_request(RequestApi);
        }
    }
 void IStartUp.RegisterCustomClasses(GamePackageDIContainer container, bool multiplayer, BasicData data)
 {
     if (multiplayer == true)
     {
         throw new BasicBlankException("This can only be registered on single player classes");
     }
     //i think the only thing that needs to be registered is the autoresume classes alone.
     container.RegisterType <SinglePlayerProductionSave>();
 }
Пример #33
0
    private void GenTableData()
    {
        BasicData bd = new BasicData();
        DataTable dtData = bd.GetImgConditions();

        GenRowType("A", dtData.Select("img_type = 'A' "), "cssGridRow");
        GenRowType("B", dtData.Select("img_type = 'B' "), "cssGridRowAlternating");
        GenRowType("C", dtData.Select("img_type = 'C' "), "cssGridRow");
    }
        //not sure yet if we need the resolver.
        //public IGamePackageResolver? MainContainer { get; set; }

        public NewGameViewModel(CommandContainer command, IEventAggregator aggregator, BasicData basicData)
        {
            CommandContainer = command;
            _aggregator      = aggregator;
            _basicData       = basicData;
        }
Пример #35
0
    private void LoadDDL()
    {
        if (Request.Params["user_id"] != null)
        {
            string user_id = Request.Params["user_id"];
            string fact_no = BasicData.GetFactByUser(user_id);

            try
            {

                BasicData bd = new BasicData();

                DataTable dtDept = bd.GetDeptERP(fact_no);
                ddlDept.DataSource = dtDept;
                ddlDept.DataTextField = "dept_name";
                ddlDept.DataValueField = "dept_no";
                ddlDept.DataBind();
                ddlDept.Items.Insert(0, new ListItem("--All--", ""));

                DataTable dtBuild = bd.GetBuildERP(fact_no);
                ddlBuild.DataSource = dtBuild;
                ddlBuild.DataTextField = "BUILD_NO";
                ddlBuild.DataValueField = "BUILD_NO";
                ddlBuild.DataBind();
                ddlBuild.Items.Insert(0, new ListItem("--All--", ""));

                DataTable dtFloor = bd.GetFloorERP(fact_no);
                ddlFloor.DataSource = dtFloor;
                ddlFloor.DataTextField = "FLOOR";
                ddlFloor.DataValueField = "FLOOR";
                ddlFloor.DataBind();
                ddlFloor.Items.Insert(0, new ListItem("--All--", ""));
            }
            catch (Exception ex)
            {
                lbAlert.Visible = true;
                lbAlert.Text = "Fact_no: " + fact_no + "  <br /> " + ex.Message;
                divSearch.Visible = false;
            }

        }
    }
Пример #36
0
 public GamePage(IGameInfo gameData,
                 BasicData basicData,
                 IStartUp start) : base(gameData, basicData, start)
 {
 }
Пример #37
0
    private void CheckTypeQCFactDept()
    {
        string type_check = Request.Params["type"];
        string[] value = Request.Params["id"].Split('-');
        string user_id = value[0];
        string fact_no = value[1];
        string dept_no = value[2];
        string sec_no = value[3];
        string sec_name = Request.Params["sec_name"];
        string dept_name = Request.Params["dept_name"];

        string add_id = Session["UserID"].ToString();
        BasicData bd = new BasicData();
        string errMsg = bd.InsertQCFactDept(user_id, fact_no, dept_no, sec_no, sec_name, dept_name, type_check, add_id);

        ReturnServer(errMsg);
    }
 public YahtzeeShellView(IGameInfo gameData, BasicData basicData, IStartUp start, IEventAggregator aggregator) : base(gameData, basicData, start)
 {
     aggregator.Subscribe(this);
     _aggregator = aggregator;
 }
Пример #39
0
    private void GetDept()
    {
        string str_return = "";
        string fact_no = Request.Params["fact_no"];

        BasicData bd = new BasicData();
        DataTable dt = bd.GetDeptInQCFactDept(fact_no);

        foreach (DataRow row in dt.Rows)
        {
            string value = row["dept_no"].ToString().Trim();
            string text = row["dept_no"].ToString().Trim();

            str_return += value + ":" + text + ";";
        }

        if (str_return.Length > 0)
            str_return = str_return.Substring(0, str_return.Length - 1);

        ReturnServer(str_return);
    }
Пример #40
0
        /// <summary>
        /// 保存大单的具体情况
        /// </summary>
        /// <param name="sid"></param>
        /// <param name="date"></param>
        /// <param name="stream"></param>
        /// <param name="bigs"></param>
        /// <param name="lastupdate"></param>
        /// <returns></returns>
        public static List<BasicData> ReadCsvByReader(string sid, string date, TextReader stream, decimal[] bigs, DateTime lastupdate)
        {
            int index = 0;

            //bigs = null;
            //bigs = new decimal[1];
            //bigs[0] = 1000M;
            List<BasicData> list = new List<BasicData>();
            BasicData[] array = new BasicData[bigs.Length];

            if (date.Length != 10) throw new Exception("time format is wrong -" + date);
            string time = date;
            DateTime t = new DateTime(Int32.Parse(time.Substring(0, 4)), Int32.Parse(time.Substring(5, 2)), Int32.Parse(time.Substring(8, 2)));

            //处理过了就忽略
            if (t < lastupdate.AddDays(1)) return null;

            Dictionary<decimal, string> temp = new Dictionary<decimal, string>();

            for (int j = 0; j < bigs.Length; j++)
            {
                array[j] = new BasicData();
                array[j].big = (int)bigs[j];
                array[j].time = t;
                array[j].sid = sid;
                array[j].c_type = "d";
                temp[bigs[j]] = "";
            }

            // open the file "data.csv" which is a CSV file with headers
            using (CsvReader csv = new CsvReader(stream, true))
            {  //颠倒记录
                IEnumerable<string[]> hi = csv.Reverse<string[]>();

                decimal current;

                decimal open = 0, close = 0, high = 0, low = 0;

                foreach (String[] record in hi)
                {

                    string price_str = record[1];
                    string change_str = record[2];
                    string share_str = record[3];
                    string type_str = record[5];
                    string time_str = record[0];
                    try
                    {

                        Decimal price = Decimal.Parse(price_str.IndexOf("\0") > 0 ? price_str.Remove(price_str.IndexOf("\0")) : price_str);
                        Double share = Double.Parse(share_str.IndexOf("\0") > 0 ? share_str.Remove(share_str.IndexOf("\0")) : share_str);

                        //count close,open,low,high
                        current = price;
                        if (index == 0)
                        {
                            open = current;
                            high = current;
                            low = current;
                        }
                        if (high < current) high = current;
                        if (low > current) low = current;
                        close = current;
                        index++;

                        for (int k = 0; k < bigs.Length; k++)
                        {

                            int fieldCount = csv.FieldCount;
                            string[] headers = csv.GetFieldHeaders();

                            array[k].open = open;
                            array[k].close = close;
                            array[k].high = high;
                            array[k].low = low;
                            array[k].totalshare += share;
                            array[k].totalmoney += Decimal.Multiply(price, (Decimal)share);

                            if (Int32.Parse(share_str) >= bigs[k])
                            {
                                //15位编码编码,
                                //第1位买单1卖单0
                                //后3位股数(百手)
                                //后3位时间数(相对于9:25的分钟数)
                                //后4位位股价(1正0负,后三位是相对开盘的万分比
                                //后4位,股价变化(1正0负,后3位是万分比)
                                //Console.WriteLine(time_str + ": " + share + " " + type_str);

                                string code = "";
                                if (type_str == "S")
                                {
                                    //string code = "-" + MyBase64.CompressNumber(long.Parse(p(share) + p1(time_str) + p2(current, open)));
                                    if (Common.Constant.DETAIL) { if (bigs[k] > 0)
                                        {
                                            code = p(share) + p1(time_str) + RateToOpen(current, open) + RateToBefore(decimal.Parse(change_str), current);
                                            code = MyBase64.CompressNumber(long.Parse(code));
                                            code = "-" + code;
                                            temp[bigs[k]] += code;
                                        }
                                    }
                                    array[k].sellshare += share;
                                    array[k].sellmoney += Decimal.Multiply(price, (Decimal)share);
                                }
                                if (type_str == "B")
                                {
                                    if(Common.Constant.DETAIL) {
                                        if (bigs[k] > 0)
                                        {
                                            //string code = "-" + MyBase64.CompressNumber(long.Parse(p(share) + p1(time_str) + p2(current, open)));
                                            code = p(share) + p1(time_str) + RateToOpen(current, open) + RateToBefore(decimal.Parse(change_str), current);
                                            //Console.WriteLine(code);
                                            code = MyBase64.CompressNumber(long.Parse(code));
                                            code = "+" + code;
                                            temp[bigs[k]] += code;
                                        }
                                    }
                                    array[k].buyshare += share;
                                    array[k].buymoney += Decimal.Multiply(price, (Decimal)share);
                                }
                                if (Common.Constant.DETAIL)
                                {
                                    array[k].detail = temp[bigs[k]];
                                }

                                //Console.WriteLine(array[k].detail);
                            }
                        }
                    }
                    catch
                    {
                        StockLog.Log.Error(sid + " import fail");
                    }
                }
            }
            for (int j = 0; j < bigs.Length; j++)
            {
                list.Add(array[j]);
            }
            return list;
        }
Пример #41
0
    private void LoadDDLFact()
    {
        BasicData bd = new BasicData();
        ddlFact.DataSource = bd.GetFactQC();
        ddlFact.DataTextField = "fact_no";
        ddlFact.DataValueField = "fact_no";
        ddlFact.DataBind();

        ddlFact.Items.FindByValue("172 ").Selected = true;
    }
Пример #42
0
        public static List<BasicData> ReadCsvByReaderOld(string sid, string date, TextReader stream, decimal[] bigs, DateTime lastupdate)
        {
            int index = 0;

            List<BasicData> list = new List<BasicData>();
            BasicData[] array = new BasicData[bigs.Length];

            if (date.Length != 10) throw new Exception("time format is wrong -" + date);
            string time = date;
            DateTime t = new DateTime(Int32.Parse(time.Substring(0, 4)), Int32.Parse(time.Substring(5, 2)), Int32.Parse(time.Substring(8, 2)));

            //处理过了就忽略
            if (t < lastupdate.AddDays(1)) return null;

            for (int j = 0; j < bigs.Length; j++)
            {
                array[j] = new BasicData();
                array[j].big = (int)bigs[j];
                array[j].time = t;
                array[j].sid = sid;
                array[j].c_type = "d";
            }

            // open the file "data.csv" which is a CSV file with headers
            using (CsvReader csv = new CsvReader(stream, true))
            {  //颠倒记录
                IEnumerable<string[]> hi = csv.Reverse<string[]>();

                decimal current;

                decimal open = 0, close = 0, high = 0, low = 0;

                foreach (String[] record in hi)
                {
                    string price_str = record[1];
                    string share_str = record[3];
                    string type_str = record[5];
                    try
                    {

                        Decimal price = Decimal.Parse(price_str.IndexOf("\0") > 0 ? price_str.Remove(price_str.IndexOf("\0")) : price_str);
                        Double share = Double.Parse(share_str.IndexOf("\0") > 0 ? share_str.Remove(share_str.IndexOf("\0")) : share_str);

                        //count close,open,low,high
                        current = price;
                        if (index == 0)
                        {
                            open = current;
                            high = current;
                            low = current;
                        }
                        if (high < current) high = current;
                        if (low > current) low = current;
                        close = current;
                        index++;

                        for (int k = 0; k < bigs.Length; k++)
                        {

                            int fieldCount = csv.FieldCount;
                            string[] headers = csv.GetFieldHeaders();

                            array[k].open = open;
                            array[k].close = close;
                            array[k].high = high;
                            array[k].low = low;
                            array[k].totalshare += share;
                            array[k].totalmoney += Decimal.Multiply(price, (Decimal)share);

                            if (Int32.Parse(share_str) >= bigs[k])
                            {

                                if (type_str == "S")
                                {
                                    array[k].sellshare += share;
                                    array[k].sellmoney += Decimal.Multiply(price, (Decimal)share);
                                }
                                if (type_str == "B")
                                {
                                    array[k].buyshare += share;
                                    array[k].buymoney += Decimal.Multiply(price, (Decimal)share);
                                }
                            }
                        }
                    }
                    catch
                    {
                        StockLog.Log.Error(sid + "_" + date + " import fail");
                    }
                }
            }
            for (int j = 0; j < bigs.Length; j++)
            {
                list.Add(array[j]);
            }
            return list;
        }
Пример #43
0
    private void GenTableData()
    {
        BasicData bd = new BasicData();

        string totalRecord = "";

        DataTable dt = bd.GetApUser(txtUserDesc.Text, txtEmail.Text, ddlFact.SelectedValue, PageControl1.StartRecord.ToString(), PageControl1.PageSize.ToString(),ref totalRecord);

        SetPageControl(totalRecord, PageControl1.CurrentPage);

        string cssClass = "";

        int i = 0;
        foreach (DataRow dr in dt.Rows)
        {
            if (i % 2 == 1) cssClass = "cssGridRowAlternating";
            else cssClass = "cssGridRow";

            i++;

            TableRow row = new TableRow();
            row.HorizontalAlign = HorizontalAlign.Center;
            TableCell cell = new TableCell();

            cell.Text = i.ToString();
            cell.CssClass = cssClass;
            row.Cells.Add(cell);

            cell = new TableCell();
            cell.Text = dr["emp_no"].ToString();
            cell.CssClass = cssClass;
            row.Cells.Add(cell);

            cell = new TableCell();
            cell.Text = dr["email"].ToString();
            cell.CssClass = cssClass;
            row.Cells.Add(cell);

            cell = new TableCell();
            cell.Text = dr["user_desc"].ToString();
            cell.CssClass = cssClass;
            row.Cells.Add(cell);

            cell = new TableCell();
            cell.Text = dr["fact_no"].ToString();
            cell.CssClass = cssClass;
            row.Cells.Add(cell);

            string rowID = "R" + dr["user_id"].ToString().Split('.')[0];

            Image imgDetail = new Image();
            imgDetail.Style["cursor"] = "pointer";
            imgDetail.ImageUrl = "~/Images/arrow_down.gif";
            imgDetail.Attributes.Add("onclick", "ShowDetail('" + rowID + "','" + dr["user_id"].ToString() + "');");

            cell = new TableCell();
            cell.Controls.Add(imgDetail);
            cell.CssClass = cssClass;
            row.Cells.Add(cell);

            mTable.Rows.Add(row);

            #region Row Details
            row = new TableRow();
            row.ID = rowID;
            row.Style["display"] = "none";

            cell = new TableCell();
            cell.ColumnSpan = 6;
            cell.CssClass = cssClass;
            cell.HorizontalAlign = HorizontalAlign.Center;
            row.Cells.Add(cell);
            mTable.Rows.Add(row);
            #endregion
        }

        if (dt.Rows.Count == 0)
        {
            TableRow row = new TableRow();
            row.HorizontalAlign = HorizontalAlign.Center;
            TableCell cell = new TableCell();
            cell.Text = "No Data";
            cell.CssClass = "cssGridRow";
            cell.ColumnSpan = 6;
            row.Cells.Add(cell);
            mTable.Rows.Add(row);

        }
    }
Пример #44
0
 public void UpdateBasicData(BasicData entity)
 {
     dataAccessorBasicData.Update(entity);
 }