public string ExportCSVTranscationsReport(ViewTransactionCBE transaction)
        {
            Int16    IsDataFound = 0;
            var      filename    = "TransactionDetails_" + DateTime.Now.ToString(Constants.dateTimeFormat24HForFileName) + ".csv";
            FileInfo file        = new FileInfo(Server.MapPath("~/Attachment/ExportFiles/" + filename));

            try
            {
                string strstarttime = Convert.ToDateTime(transaction.StartDate).ToString("dd/MM/yyyy HH:mm:ss");
                string strendtime   = Convert.ToDateTime(transaction.EndDate).ToString("dd/MM/yyyy HH:mm:ss");

                IsDataFound = CSVUtility.CreateCsv(file.FullName, TransactionBLL.TransDeatilsReport(strstarttime, strendtime));
                if (IsDataFound == 0)
                {
                    filename = "No Data to Export.";
                }
            }
            catch (Exception ex)
            {
                HelperClass.LogMessage("Failed Export Transaction Details_ CSV " + ex);
            }
            string Det = JsonConvert.SerializeObject(filename, Formatting.Indented);

            return(Det.Replace("\r", "").Replace("\n", ""));
        }
    public object ConfigProcess(string[] row)

    {
        if (row.Length < 7)

        {
            return(null);
        }



        RowHelper rh = new RowHelper(row);

        DisassemblygirlDungeonConfig rec = new DisassemblygirlDungeonConfig();



        rec.id = CSVUtility.ToInt(rh.Read());         //id

        rec.name = rh.Read();                         //名字

        rec.iconID = rh.Read();                       //图标ID

        rec.directorID = CSVUtility.ToInt(rh.Read()); //脚本ID

        rec.resourceID = rh.Read();                   //资源ID

        rec.audioID = rh.Read();                      //音乐资源ID

        rec.monsterGroups = rh.Read();                //怪物组

        return(rec);
    }
Beispiel #3
0
        /// <summary>
        /// 将csv文件导入数据库(不推荐使用)
        /// </summary>
        /// <param name="code">证券代码</param>
        /// <param name="name">证券名称</param>
        /// <param name="csvPath">csv文件路径</param>
        /// <returns>受影响行数</returns>
        public int ImportFromCSVAsDB(string code, string name, string csvPath)
        {
            DataTable dt = CSVUtility.ReadCSVAsDB(csvPath);

            if (dt == null)
            {
                return(0);
            }
            else
            {
                int insertedLinesCount = 0;
                foreach (DataRow row in dt.Rows)
                {
                    StockDayPrice stock1 = new StockDayPrice();
                    stock1.Code     = code;
                    stock1.Name     = name;
                    stock1.Date     = (DateTime)row["Date"];
                    stock1.Open     = (double)row["Open"];
                    stock1.High     = (double)row["High"];
                    stock1.Low      = (double)row["Low"];
                    stock1.Close    = (double)row["Close"];
                    stock1.Volume   = Convert.ToDouble(row["Volume"]);//(double)会报错Specified cast is not valid.奇怪!!!超过int范围时row["Volume"]为DBNull
                    stock1.AdjClose = (double)row["Adj Close"];
                    int j = this.AddNew(stock1);
                    insertedLinesCount += j;
                }
                return(insertedLinesCount);
            }
        }
    public object ConfigProcess(string[] row)

    {
        if (row.Length < 6)

        {
            return(null);
        }



        RowHelper rh = new RowHelper(row);

        DisassemblygirlTrophyConfig rec = new DisassemblygirlTrophyConfig();



        rec.id = CSVUtility.ToInt(rh.Read());        //id

        rec.name = rh.Read();                        //名字

        rec.type = rh.Read();                        //类型

        rec.conditionType = rh.Read();               //判断类型

        rec.threshold = CSVUtility.ToInt(rh.Read()); //数值

        rec.iconID = rh.Read();                      //图标ID

        return(rec);
    }
Beispiel #5
0
    public void ParseCSV(string[] itemDatas)
    {
        CSVUtility uti = new CSVUtility(itemDatas);

        Question = uti.GetString;
        for (int i = 0; i < 5; i++)
        {
            if (Options == null)
            {
                Options = new List <string>();
            }
            Options.Add(uti.GetString);
        }

        for (int i = 0; i < 5; i++)
        {
            if (Answers == null)
            {
                Answers = new List <string>();
            }
            Answers.Add(uti.GetString);
        }

        for (int i = 0; i < 2; i++)
        {
            if (Notes == null)
            {
                Notes = new List <string>();
            }
            Notes.Add(uti.GetString);
        }
    }
    public object ConfigProcess(string[] row)

    {
        if (row.Length < 3)

        {
            return(null);
        }



        RowHelper rh = new RowHelper(row);

        MsgErrcodeConfig rec = new MsgErrcodeConfig();



        rec.errcode = CSVUtility.ToInt(rh.Read()); //错误码

        rec.en = rh.Read();                        //英文名称

        rec.ch = rh.Read();                        //中文说明

        return(rec);
    }
Beispiel #7
0
    public object ConfigProcess(string[] row)

    {
        if (row.Length < 19)

        {
            return(null);
        }



        RowHelper rh = new RowHelper(row);

        DisassemblygirlWeaponConfig rec = new DisassemblygirlWeaponConfig();



        rec.id = CSVUtility.ToInt(rh.Read());          //id

        rec.level = CSVUtility.ToInt(rh.Read());       //级别

        rec.name = rh.Read();                          //名字

        rec.iconID = rh.Read();                        //武器图标

        rec.ATK = CSVUtility.ToFloat(rh.Read());       //拆解力

        rec.CRT = CSVUtility.ToFloat(rh.Read());       //爆破力

        rec.SPD = CSVUtility.ToFloat(rh.Read());       //速度

        rec.WOE = CSVUtility.ToFloat(rh.Read());       //半径

        rec.CD = CSVUtility.ToFloat(rh.Read());        //间隔

        rec.RP = CSVUtility.ToInt(rh.Read());          //价格

        rec.GP = CSVUtility.ToInt(rh.Read());          //金钱

        rec.resourceID = rh.Read();                    //资源ID

        rec.hitEffectID = rh.Read();                   //击中效果资源ID

        rec.audioID = rh.Read();                       //音效资源ID

        rec.offsetX = CSVUtility.ToFloat(rh.Read());   //武器偏移X

        rec.offsetY = CSVUtility.ToFloat(rh.Read());   //武器偏移Y

        rec.skillID = CSVUtility.ToInt(rh.Read());     //技能ID

        rec.physicsType = CSVUtility.ToInt(rh.Read()); //物理类型0:无 | 1:穿透 | 2: 单次弹射|3: 多重弹射

        rec.effectors = rh.Read();                     //效果器

        return(rec);
    }
Beispiel #8
0
    public object ConfigProcess(string[] row)

    {
        if (row.Length < 14)

        {
            return(null);
        }



        RowHelper rh = new RowHelper(row);

        MsgMsgConfig rec = new MsgMsgConfig();



        rec.id = CSVUtility.ToInt(rh.Read()); //id

        rec.title = rh.Read();                //标题

        rec.content = rh.Read();              //内容

        rec.sell = new MsgMsgSellConfig[3];

        for (int i = 0; i < 3; i++)
        {
            rec.sell[i] = new MsgMsgSellConfig();
        }

        rec.sell[0].id = CSVUtility.ToInt(rh.Read());           //出售获得物品1

        rec.sell[0].num = CSVUtility.ToInt(rh.Read());          //出售获得物品数量1

        rec.sell[1].id = CSVUtility.ToInt(rh.Read());           //出售获得物品2

        rec.sell[1].num = CSVUtility.ToInt(rh.Read());          //出售获得物品数量2

        rec.sell[2].id = CSVUtility.ToInt(rh.Read());           //出售获得物品3

        rec.sell[2].num = CSVUtility.ToInt(rh.Read());          //出售获得物品数量3

        rec.instance = new int[4];

        rec.instance[0] = CSVUtility.ToInt(rh.Read()); //副本1

        rec.instance[1] = CSVUtility.ToInt(rh.Read()); //副本1

        rec.instance[2] = CSVUtility.ToInt(rh.Read()); //副本1

        rec.instance[3] = CSVUtility.ToInt(rh.Read()); //副本1

        rec.remark = rh.Read();                        //备注

        return(rec);
    }
        public string ExportCustomerAccountFilter(CustomerVehicleModel objCustomerVehicleModel)
        {
            var      filename    = "Customer_" + DateTime.Now.ToString(Constants.dateTimeFormat24HForFileName) + ".csv";
            FileInfo file        = new FileInfo(Server.MapPath("~/Attachment/ExportFiles/" + filename));
            Int16    IsDataFound = 0;

            try
            {
                string strQuery = " WHERE 1=1";
                if (objCustomerVehicleModel.SearchEnable)
                {
                    #region Filter Query
                    if (objCustomerVehicleModel.AccountId > 0)
                    {
                        strQuery += " AND CA.ACCOUNT_ID LIKE '%" + objCustomerVehicleModel.AccountId + "%'";
                    }
                    if (!string.IsNullOrEmpty(objCustomerVehicleModel.ResidentId))
                    {
                        strQuery += " AND CA.RESIDENT_ID LIKE '%" + objCustomerVehicleModel.ResidentId + "%'";
                    }
                    if (!string.IsNullOrEmpty(objCustomerVehicleModel.MobileNo))
                    {
                        strQuery += " AND CA.MOB_NUMBER LIKE '%" + objCustomerVehicleModel.MobileNo + "%' ";
                    }
                    if (!string.IsNullOrEmpty(objCustomerVehicleModel.EmailId))
                    {
                        strQuery += " AND LOWER(CA.EMAIL_ID) LIKE '%" + objCustomerVehicleModel.EmailId.ToLower() + "%' ";
                    }
                    if (!string.IsNullOrEmpty(objCustomerVehicleModel.FirstName))
                    {
                        strQuery += " AND LOWER(CA.FIRST_NAME) LIKE '%" + objCustomerVehicleModel.FirstName.ToLower() + "%' ";
                    }
                    if (!string.IsNullOrEmpty(objCustomerVehicleModel.VehRegNo))
                    {
                        strQuery += " AND LOWER(CV.VEH_REG_NO) LIKE '%" + objCustomerVehicleModel.VehRegNo.ToLower() + "%'";
                    }
                    IsDataFound = CSVUtility.CreateCsvWithTitleFilter(file.FullName, CustomerAccountBLL.GetFilterCSV(strQuery), "Customer", objCustomerVehicleModel);
                    #endregion
                }
                else
                {
                    IsDataFound = CSVUtility.CreateCsvWithTitle(file.FullName, CustomerAccountBLL.GetFilterCSV(strQuery), "Customer");
                }
                if (IsDataFound == 0)
                {
                    filename = "No Data to Export.";
                }
            }
            catch (Exception ex)
            {
                HelperClass.LogMessage("Failed Export Customer CSV " + ex);
            }
            string Det = JsonConvert.SerializeObject(filename, Formatting.Indented);
            return(Det.Replace("\r", "").Replace("\n", ""));
        }
Beispiel #10
0
    public object ConfigProcess(string[] row)

    {
        if (row.Length < 17)

        {
            return(null);
        }



        RowHelper rh = new RowHelper(row);

        DisassemblygirlMonsterConfig rec = new DisassemblygirlMonsterConfig();



        rec.id = CSVUtility.ToInt(rh.Read());              //id

        rec.level = CSVUtility.ToInt(rh.Read());           //级别

        rec.name = rh.Read();                              //名字

        rec.resourceID = rh.Read();                        //资源ID

        rec.explosionID = rh.Read();                       //爆炸资源ID

        rec.missileResourceID = rh.Read();                 //投射物资源ID

        rec.type = CSVUtility.ToInt(rh.Read());            //类型

        rec.DEF = CSVUtility.ToFloat(rh.Read());           //防御力

        rec.ANTI = CSVUtility.ToFloat(rh.Read());          //抵抗力

        rec.SPD = CSVUtility.ToFloat(rh.Read());           //速度

        rec.HP = CSVUtility.ToInt(rh.Read());              //生命值

        rec.components = rh.Read();                        //部件吊掉落配置

        rec.groundDamping = CSVUtility.ToFloat(rh.Read()); //地面阻力

        rec.airDamping = CSVUtility.ToFloat(rh.Read());    //空中阻力

        rec.immunityEffectors = rh.Read();                 //效果器免疫

        rec.RP = CSVUtility.ToInt(rh.Read());              //RP

        rec.GP = CSVUtility.ToInt(rh.Read());              //GP

        return(rec);
    }
    public object ConfigProcess(string[] row)

    {
        if (row.Length < 16)

        {
            return(null);
        }



        RowHelper rh = new RowHelper(row);

        DisassemblygirlPetConfig rec = new DisassemblygirlPetConfig();



        rec.id = CSVUtility.ToInt(rh.Read());          //id

        rec.level = CSVUtility.ToInt(rh.Read());       //级别

        rec.name = rh.Read();                          //名字

        rec.iconID = rh.Read();                        //图标ID

        rec.resourceID = rh.Read();                    //资源ID

        rec.missileResourceID = rh.Read();             //投射物资源ID

        rec.missileHitEffectID = rh.Read();            //投射物击中资源ID

        rec.ATK = CSVUtility.ToFloat(rh.Read());       //拆解力

        rec.CRT = CSVUtility.ToFloat(rh.Read());       //爆破力

        rec.SPD = CSVUtility.ToFloat(rh.Read());       //速度

        rec.WOE = CSVUtility.ToFloat(rh.Read());       //半径

        rec.RP = CSVUtility.ToInt(rh.Read());          //价格

        rec.GP = CSVUtility.ToInt(rh.Read());          //金钱

        rec.missileAudioID = rh.Read();                //投射物音效资源ID

        rec.physicsType = CSVUtility.ToInt(rh.Read()); //物理类型0:无 | 1:穿透 | 2: 单次弹射|3: 多重弹射

        rec.effectors = rh.Read();                     //效果器

        return(rec);
    }
        private List <List <string> > ReadCSVMinusBlankLastLine(string filename)
        {
            if (!File.Exists(filename))
            {
                Debug.LogError("Love/Hate: File not found: " + filename);
                return(new List <List <string> >());
            }
            var csv = CSVUtility.ReadCSVFile(filename, prefs.encoding);

            if (string.IsNullOrEmpty(csv[csv.Count - 1][0]))
            {
                csv.RemoveAt(csv.Count - 1);
            }
            return(csv);
        }
Beispiel #13
0
        /* protected & private - Field declaration  */

        // ========================================================================== //

        /* public - [Do~Something] Function             */

        public void DoInsert(string strCSV)
        {
            Type        pType        = typeof(T);
            TableConfig pTableConfig = SODB_Setting.instance.GetTableConfig(pType.Name);
            Dictionary <string, ColumnInfo> mapColumnInfo = Generate_ColumnInfo(pTableConfig, pType);
            List <T> listInsert = CSVUtility.FromCSVText_List <T>(strCSV, Debug.LogError);

            ProcessInsert(mapColumnInfo, listInsert, out bool bIsSuccess);
            if (bIsSuccess)
            {
                OnInsert(listInsert);
                rows.AddRange(listInsert);
            }

            Debug.Log($"ProcessInsert {strCSV}");
        }
Beispiel #14
0
	public object ConfigProcess(string[] row)
	{
		if (row.Length < 4)
		{
			return null;
		}

		RowHelper rh = new RowHelper(row);
		DisassemblygirlGoldConfig rec = new DisassemblygirlGoldConfig();

		rec.id = CSVUtility.ToInt(rh.Read());	//id
		rec.name = rh.Read();	//名字
		rec.iconID = rh.Read();	//图标ID
		rec.value = CSVUtility.ToInt(rh.Read());	//数值
		return rec;
	}
    public object ConfigProcess(string[] row)

    {
        if (row.Length < 14)

        {
            return(null);
        }



        RowHelper rh = new RowHelper(row);

        DisassemblygirlGirlConfig rec = new DisassemblygirlGirlConfig();



        rec.id = CSVUtility.ToInt(rh.Read());      //id

        rec.level = CSVUtility.ToInt(rh.Read());   //级别

        rec.name = rh.Read();                      //名字

        rec.resourceID = rh.Read();                //角色资源

        rec.STR = CSVUtility.ToInt(rh.Read());     //力量

        rec.VIT = CSVUtility.ToInt(rh.Read());     //体力

        rec.DEX = CSVUtility.ToInt(rh.Read());     //灵巧

        rec.SPD = CSVUtility.ToInt(rh.Read());     //速度

        rec.weaponA = CSVUtility.ToInt(rh.Read()); //武器A

        rec.weaponB = CSVUtility.ToInt(rh.Read()); //武器B

        rec.weaponC = CSVUtility.ToInt(rh.Read()); //武器C

        rec.skillA = CSVUtility.ToInt(rh.Read());  //技能A

        rec.skillB = CSVUtility.ToInt(rh.Read());  //技能B

        rec.skillC = CSVUtility.ToInt(rh.Read());  //技能C

        return(rec);
    }
    public object ConfigProcess(string[] row)

    {
        if (row.Length < 14)

        {
            return(null);
        }



        RowHelper rh = new RowHelper(row);

        DisassemblygirlSkillConfig rec = new DisassemblygirlSkillConfig();



        rec.id = CSVUtility.ToInt(rh.Read());          //id

        rec.name = rh.Read();                          //名字

        rec.iconID = rh.Read();                        //技能图标

        rec.ATK = CSVUtility.ToFloat(rh.Read());       //拆解力

        rec.CRT = CSVUtility.ToFloat(rh.Read());       //爆破力

        rec.SPD = CSVUtility.ToFloat(rh.Read());       //速度

        rec.WOE = CSVUtility.ToFloat(rh.Read());       //半径

        rec.CD = CSVUtility.ToFloat(rh.Read());        //冷却

        rec.type = CSVUtility.ToInt(rh.Read());        //技能类型

        rec.vibrateType = CSVUtility.ToInt(rh.Read()); //震动类型 0:无 | 1:命中 | 2:释放

        rec.resourceID = rh.Read();                    //技能动画ID

        rec.hitEffectID = rh.Read();                   //击中动画ID

        rec.physicsType = CSVUtility.ToInt(rh.Read()); //物理类型0:无 | 1:穿透 | 2: 单次弹射 3:多重弹射

        rec.effectors = rh.Read();                     //效果器

        return(rec);
    }
        public string ExportCSVCustomer()
        {
            var filename = "Customer_" + DateTime.Now.ToString(Constants.dateTimeFormat24HForFileName) + ".csv";

            try
            {
                FileInfo file        = new FileInfo(Server.MapPath("~/Attachment/ExportFiles/" + filename));
                Int16    IsDataFound = CSVUtility.CreateCsvWithTitle(file.FullName, CustomerAccountBLL.GetAllAsCSV(), "Customer");
                if (IsDataFound == 0)
                {
                    filename = "No Data to Export.";
                }
            }
            catch (Exception ex)
            {
                HelperClass.LogMessage("Failed Export Customer CSV " + ex);
            }
            string Det = JsonConvert.SerializeObject(filename, Formatting.Indented);

            return(Det.Replace("\r", "").Replace("\n", ""));
        }
Beispiel #18
0
    public object ConfigProcess(string[] row)

    {
        if (row.Length < 10)

        {
            return(null);
        }



        RowHelper rh = new RowHelper(row);

        DisassemblygirlMonstergroupConfig rec = new DisassemblygirlMonstergroupConfig();



        rec.id = CSVUtility.ToInt(rh.Read());             //id

        rec.monstersA = rh.Read();                        //怪物组A

        rec.monstersB = rh.Read();                        //怪物组B

        rec.monstersC = rh.Read();                        //怪物组C

        rec.monstersD = rh.Read();                        //怪物组D

        rec.monstersE = rh.Read();                        //怪物组E

        rec.boss = CSVUtility.ToInt(rh.Read());           //bossID

        rec.joinCount = CSVUtility.ToInt(rh.Read());      //每次加入战场单位数量

        rec.joinInterval = CSVUtility.ToFloat(rh.Read()); //加入间隔(秒)

        rec.isBoss = CSVUtility.ToInt(rh.Read());         //是否是BOSS组

        return(rec);
    }
    public object ConfigProcess(string[] row)

    {
        if (row.Length < 9)

        {
            return(null);
        }



        RowHelper rh = new RowHelper(row);

        DisassemblygirlEffectorConfig rec = new DisassemblygirlEffectorConfig();



        rec.id = CSVUtility.ToInt(rh.Read());           //id

        rec.name = rh.Read();                           //名字

        rec.iconID = rh.Read();                         //图标ID

        rec.resourceID = rh.Read();                     //资源ID

        rec.parameter1 = CSVUtility.ToFloat(rh.Read()); //参数1

        rec.parameter2 = CSVUtility.ToFloat(rh.Read()); //参数2

        rec.parameter3 = CSVUtility.ToFloat(rh.Read()); //参数3

        rec.parameter4 = CSVUtility.ToFloat(rh.Read()); //参数4

        rec.parameter5 = CSVUtility.ToFloat(rh.Read()); //参数5

        return(rec);
    }
Beispiel #20
0
        private void SearchEventH()
        {
            string path = @"\\192.168.145.7\nstvnoise$\FCT_NOISE\" + cmbModelH.Text + "\\";

            foreach (History cell in flpnlYeildShowH.Controls.OfType <History>())
            {
                //cell.input = 0;
                //cell.output = 0;
                cell.dataH = new DataTable();
                cell.dataH.Columns.Add("Date");
                cell.dataH.Columns.Add("Input");
                cell.dataH.Columns.Add("Output");
                cell.dataH.Columns.Add("Yield");
                double inputH = 0, outputH = 0;
                string yieldH = string.Empty;
                string nopath = path + cell.Name + "\\";
                for (int i = dtpFromH.Value.Year; i <= dtpToH.Value.Year; i++)
                {
                    string yearpath = nopath + i + "\\";
                    if (!Directory.Exists(yearpath))
                    {
                        return;
                    }
                    for (int j = dtpFromH.Value.Month; j <= dtpToH.Value.Month; j++)
                    {
                        string monthpath = yearpath + j.ToString("00") + "\\";
                        if (!Directory.Exists(monthpath))
                        {
                            return;
                        }
                        for (int k = dtpFromH.Value.Day; k <= dtpToH.Value.Day; k++)
                        {
                            string   date  = i + "-" + j.ToString("00") + "-" + k.ToString("00");
                            string[] files = Directory.GetFiles(monthpath);
                            foreach (string f in files)
                            {
                                if (f.Contains(date))
                                {
                                    DataTable dt = new DataTable();
                                    dt     = CSVUtility.ConvertCSVtoDataTable(f);
                                    inputH = dt.Rows.Count;
                                    foreach (DataRow dr in dt.Rows)
                                    {
                                        if (dr["Judge"].ToString().Contains("OK"))
                                        {
                                            outputH++;
                                        }
                                    }
                                    yieldH = ((outputH / inputH) * 100).ToString("00.00") + "%";
                                    cell.dataH.Rows.Add(date, inputH, outputH, yieldH);
                                    cell.Refresh();
                                    dt.Clear();
                                    inputH  = 0;
                                    outputH = 0;
                                }
                            }
                        }
                    }
                }
                //if (cell.input > 0 && cell.output > 0)
                //    cell.yeild = cell.output / cell.input;
                //else
                //    cell.yeild = 0;
                //if (cell.yeild >= 0.85)
                //    cell.color = Color.LimeGreen;
                //else if (cell.yeild >= 0.5 && cell.yeild < 0.85)
                //    cell.color = Color.Yellow;
                //else if (cell.yeild < 0.5 && cell.input > 0)
                //    cell.color = Color.Red;
                //else
                //    cell.color = Color.Silver;
                //cell.lbYeild.Text = (cell.yeild * 100).ToString("0.##") + "%";
            }
        }
Beispiel #21
0
        private void SearchEvent()
        {
            string path = @"\\192.168.145.7\nstvnoise$\FCT_NOISE\" + cmbModel.Text + "\\";

            foreach (InspectCell cell in flpnlYeildShow.Controls.OfType <InspectCell>())
            {
                cell.input  = 0;
                cell.output = 0;
                string nopath = path + cell.Name + "\\";
                for (int i = dtpDateFrom.Value.Year; i <= dtpDateTo.Value.Year; i++)
                {
                    string yearpath = nopath + i + "\\";
                    if (!Directory.Exists(yearpath))
                    {
                        return;
                    }
                    for (int j = dtpDateFrom.Value.Month; j <= dtpDateTo.Value.Month; j++)
                    {
                        string monthpath = yearpath + j.ToString("00") + "\\";
                        if (!Directory.Exists(monthpath))
                        {
                            return;
                        }
                        for (int k = dtpDateFrom.Value.Day; k <= dtpDateTo.Value.Day; k++)
                        {
                            string   date  = i + "-" + j.ToString("00") + "-" + k.ToString("00");
                            string[] files = Directory.GetFiles(monthpath);
                            foreach (string f in files)
                            {
                                if (f.Contains(date))
                                {
                                    DataTable dt = new DataTable();
                                    dt          = CSVUtility.ConvertCSVtoDataTable(f);
                                    cell.input += dt.Rows.Count;
                                    foreach (DataRow dr in dt.Rows)
                                    {
                                        if (dr["Judge"].ToString().Contains("OK"))
                                        {
                                            cell.output++;
                                        }
                                    }
                                    dt.Clear();
                                }
                            }
                        }
                    }
                }
                if (cell.input > 0 && cell.output > 0)
                {
                    cell.yeild = cell.output / cell.input;
                }
                else
                {
                    cell.yeild = 0;
                }
                if (cell.yeild >= 0.85)
                {
                    cell.color = Color.LimeGreen;
                }
                else if (cell.yeild >= 0.5 && cell.yeild < 0.85)
                {
                    cell.color = Color.Yellow;
                }
                else if (cell.yeild < 0.5 && cell.input > 0)
                {
                    cell.color = Color.Red;
                }
                else
                {
                    cell.color = Color.Silver;
                }
                cell.lbYeild.Text = (cell.yeild * 100).ToString("0.##") + "%";
            }
        }
Beispiel #22
0
 private void btnExport_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(noname))
     {
         MessageBox.Show("Please select the machine number!!!", "Information", MessageBoxButtons.OK);
         return;
     }
     try
     {
         string          path = @"\\192.168.145.7\nstvnoise$\FCT_NOISE\" + cmbModel.Text + "\\";
         SaveFileDialog  sf   = new SaveFileDialog();
         List <string[]> fr   = new List <string[]>();
         sf.Filter = "Excel Files (*.xlsx)|*.xlsx|All File (*.*)|*.*";
         //sf.FileName = "Select Folder";
         if (sf.ShowDialog() == DialogResult.OK)
         {
             //cell.input = 0;
             //cell.output = 0;
             string nopath = path + noname + "\\";
             for (int i = dtpDateFrom.Value.Year; i <= dtpDateTo.Value.Year; i++)
             {
                 string yearpath = nopath + i + "\\";
                 if (!Directory.Exists(yearpath))
                 {
                     return;
                 }
                 for (int j = dtpDateFrom.Value.Month; j <= dtpDateTo.Value.Month; j++)
                 {
                     string monthpath = yearpath + j.ToString("00") + "\\";
                     if (!Directory.Exists(monthpath))
                     {
                         return;
                     }
                     for (int k = dtpDateFrom.Value.Day; k <= dtpDateTo.Value.Day; k++)
                     {
                         string   date  = i + "-" + j.ToString("00") + "-" + k.ToString("00");
                         string[] files = Directory.GetFiles(monthpath);
                         foreach (string f in files)
                         {
                             if (f.Contains(date))
                             // File.Copy(f, Path.GetDirectoryName(sf.FileName) + "\\" + Path.GetFileName(f));
                             {
                                 ExcelClass2019.OpenExcelWorkBook(@"\\192.168.145.7\nstvnoise$\Excel Form\Histogram FCT.xlsx", 2);
                                 Cursor.Current = Cursors.WaitCursor;
                                 CSVUtility.ConvertCSVtoDataTable(f).DatasetToExcel();
                                 if (MessageBox.Show("Export Successfully." + Environment.NewLine + "Do you want open this?", "Notice", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
                                 {
                                     sf.FileName.SaveAndExit(true);
                                 }
                                 else
                                 {
                                     sf.FileName.SaveAndExit(false);
                                 }
                                 Cursor.Current = Cursors.Default;
                             }
                         }
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
        private void Export()
        {
            try
            {
                // PersonalityTraits.csv:
                EditorUtility.DisplayProgressBar("Exporting Faction Database To CSV", "Exporting personality trait definitions...", 0);
                var csv = new List <List <string> >();
                csv.Add(new List <string>(new string[] { "Name", "Description" }));
                for (int i = 0; i < db.personalityTraitDefinitions.Length; i++)
                {
                    var def = db.personalityTraitDefinitions[i];
                    csv.Add(new List <string>(new string[] { def.name, def.description }));
                }
                CSVUtility.WriteCSVFile(csv, prefs.folder + "/PersonalityTraits.csv", prefs.encoding);

                // RelationshipTraits.csv:
                EditorUtility.DisplayProgressBar("Exporting Faction Database To CSV", "Exporting relationship trait definitions...", 40);
                csv = new List <List <string> >();
                csv.Add(new List <string>(new string[] { "Name", "Description" }));
                for (int i = 0; i < db.relationshipTraitDefinitions.Length; i++)
                {
                    var def = db.relationshipTraitDefinitions[i];
                    csv.Add(new List <string>(new string[] { def.name, def.description }));
                }
                CSVUtility.WriteCSVFile(csv, prefs.folder + "/RelationshipTraits.csv", prefs.encoding);

                // Factions.csv:
                EditorUtility.DisplayProgressBar("Exporting Faction Database To CSV", "Exporting factions...", 60);
                csv = new List <List <string> >();
                var row = new List <string>(new string[] { "ID", "Name", "Description", "Preset", "Color", "%Judge Parents" });
                for (int i = 0; i < db.personalityTraitDefinitions.Length; i++)
                {
                    row.Add(db.personalityTraitDefinitions[i].name);
                }
                row.Add("Parents");
                csv.Add(row);
                for (int i = 0; i < db.presets.Length; i++)
                {
                    var preset = db.presets[i];
                    row = new List <string>(new string[] { "-1", preset.name, preset.description, "1", "0", "0" });
                    for (int j = 0; j < db.personalityTraitDefinitions.Length; j++)
                    {
                        row.Add(preset.traits[j].ToString());
                    }
                    csv.Add(row);
                }
                for (int i = 0; i < db.factions.Length; i++)
                {
                    var faction = db.factions[i];
                    row = new List <string>(new string[] { faction.id.ToString(), faction.name, faction.description, "0", faction.color.ToString(), faction.percentJudgeParents.ToString() });
                    for (int j = 0; j < db.personalityTraitDefinitions.Length; j++)
                    {
                        row.Add(faction.traits[j].ToString());
                    }
                    for (int j = 0; j < faction.parents.Length; j++)
                    {
                        row.Add(db.factions[faction.parents[j]].name);
                    }
                    csv.Add(row);
                }
                CSVUtility.WriteCSVFile(csv, prefs.folder + "/Factions.csv", prefs.encoding);

                // Relationships.csv:
                EditorUtility.DisplayProgressBar("Exporting Faction Database To CSV", "Exporting relationships...", 80);
                for (int i = 0; i < db.relationshipTraitDefinitions.Length; i++)
                {
                    csv = new List <List <string> >();
                    row = new List <string>(new string[] { db.relationshipTraitDefinitions[i].name });
                    for (int j = 0; j < db.factions.Length; j++)
                    {
                        row.Add(db.factions[j].name);
                    }
                    csv.Add(row);
                    for (int j = 0; j < db.factions.Length; j++)
                    {
                        var judge = db.factions[j];
                        row = new List <string>(new string[] { judge.name });
                        for (int k = 0; k < db.factions.Length; k++)
                        {
                            var          subject = db.factions[k];
                            Relationship relationship;
                            if (db.FindPersonalRelationship(judge.id, subject.id, out relationship))
                            {
                                row.Add(relationship.traits[i].ToString());
                            }
                            else
                            {
                                row.Add("none");
                            }
                        }
                        csv.Add(row);
                    }
                    CSVUtility.WriteCSVFile(csv, prefs.folder + "/Relationships_" + GetValidFilespec(db.relationshipTraitDefinitions[i].name) + ".csv", prefs.encoding);
                }
            }
            finally
            {
                EditorUtility.ClearProgressBar();
            }
            Debug.Log("Exported " + db.name + " to CSV files in " + prefs.folder + ".", db);
        }
Beispiel #24
0
 private void btnPush_Click(object sender, EventArgs e)
 {
     try
     {
         string        tempfolder  = @"\\192.168.145.7\nstvnoise$\TEMP";
         string        errorfolder = @"\\192.168.145.7\nstvnoise$\ERROR";
         List <string> errorlist   = new List <string>();
         site    = "NSTV";
         factory = "2B";
         line    = "L01";
         process = "FCT";
         multiinspect.Clear();
         mutliprocess.Clear();
         foreach (string item in lsbAllFileCSV.Items)
         {
             DataTable dt = new DataTable();
             model = Path.GetFileName(item).Split('_')[1];
             model = model.Replace('-', '_');
             date  = Path.GetFileName(item).Split('_')[2].Split('-')[0]
                     + Path.GetFileName(item).Split('_')[2].Split('-')[1];
             table = model + date;
             gData.CreateTable(table);
             gData.CreateTableData(table);
             CSVUtility.ConvertCSVtoDataTable(dt, item);
             foreach (DataRow dr in dt.Rows)
             {
                 inspectdate = DateTime.Parse(dr["Date"].ToString());
                 serno       = inspectdate.ToString("HHmmss") + dr["Number"].ToString();
                 lot         = inspectdate.ToString("yyyyMMdd");
                 judge       = dr["Judge"].ToString() == "OK" ? "0" : "1";
                 mutliprocess.Append("('").Append(serno).Append("','").Append(lot).Append("','");
                 mutliprocess.Append(model).Append("','").Append(site).Append("','").Append(factory).Append("','");
                 mutliprocess.Append(line).Append("','").Append(process).Append("','");
                 mutliprocess.Append(inspectdate.ToString("yyyy-MM-dd HH:mm:ss")).Append("','").Append(judge);
                 mutliprocess.Append("','INITAL',''), ");
                 //gData.InsertTable(table, serno, lot, model, site, factory, line, process, inspectdate.ToString("yyyy-MM-dd HH:mm:ss"), judge, "INITAL", "");
                 foreach (DataColumn dc in dt.Columns)
                 {
                     inspect = dc.ColumnName.Replace(" ", string.Empty);
                     if (gData.CheckInspect(inspect))
                     {
                         inspectdata = dr[dc.ColumnName].ToString();
                         if (inspectdata == "-" || !isDouble(inspectdata))
                         {
                             continue;
                         }
                         multiinspect.Append("('").Append(serno).Append("','").Append(lot).Append("','");
                         multiinspect.Append(inspectdate.ToString("yyyy-MM-dd HH:mm:ss")).Append("','");
                         multiinspect.Append(inspect).Append("','").Append(inspectdata).Append("','");
                         multiinspect.Append(judge).Append("'), ");
                         //gData.InsertTableData(table, serno, lot, inspectdate.ToString("yyyy-MM-dd HH:mm:ss"), inspect, inspectdata, judge);
                     }
                 }
             }
             multiinspect.Remove(multiinspect.Length - 2, 1);
             mutliprocess.Remove(mutliprocess.Length - 2, 1);
             if (!gData.InsertTableData(table, multiinspect.ToString()) && !gData.InsertTable(table, mutliprocess.ToString()))
             {
                 if (!Directory.Exists(errorfolder))
                 {
                     Directory.CreateDirectory(errorfolder);
                 }
                 File.WriteAllLines(errorfolder + "\\" + Path.GetFileName(item), errorlist);
             }
             if (!Directory.Exists(tempfolder))
             {
                 Directory.CreateDirectory(tempfolder);
             }
             File.Move(item, tempfolder + "\\" + Path.GetFileName(item));
         }
     }
     catch { }
 }
Beispiel #25
0
        private void ExportDetails()
        {
            try
            {
                DataRow dr;
                BuildTable();
                string filePath = "";
                string fromDate = dpFrom.Value.ToShortDateString();
                string toDate   = dpTo.Value.ToShortDateString();
                dtTeam = Teams();

                for (int i = 0; i <= dtTeam.Rows.Count - 1; i++)
                {
                    dr = dtResult.NewRow();
                    int teamId = Convert.ToInt32(dtTeam.Rows[i]["T_ID"]);

                    string teamName = dtTeam.Rows[i]["T_TeamName"].ToString();
                    dr["TeamName"] = teamName;



                    dr["DateRange"] = fromDate + " - " + toDate;

                    int totalWorkingDays = GetNumberOfWorkingDays(dpFrom.Value, dpTo.Value);

                    dt = new System.Data.DataTable();

                    dt = GetHours(teamId, fromDate, toDate);

                    if (dt.Rows.Count > 0)
                    {
                        dr["BillableHours"]  = dt.Rows[0]["Billable Hours"];
                        dr["PTOs"]           = dt.Rows[0]["PTO"];
                        dr["EEA"]            = dt.Rows[0]["EEA"];
                        dr["Meeting"]        = dt.Rows[0]["Meeting"];
                        dr["Nontask"]        = dt.Rows[0]["Nontask"];
                        dr["Others"]         = dt.Rows[0]["Others"];
                        dr["Available Time"] = dt.Rows[0]["Available Time"];
                    }

                    dr["WorkingHours"] = totalWorkingDays * 8;

                    dt = new System.Data.DataTable();

                    dt = GetUsersCount(teamId, fromDate, toDate);
                    if (dt.Rows.Count > 0)
                    {
                        dr["UserCount"] = dt.Rows[0]["UsersCount"];
                    }

                    dtResult.Rows.Add(dr);
                }

                if (rbWithMgr.Checked)
                {
                    filePath = "D:\\Util\\" + dpFrom.Value.ToString("MM-dd-yyyy") + "-" + dpTo.Value.ToString("MM-dd-yyyy") + ".csv";
                }
                else
                {
                    filePath = "D:\\Util\\" + dpFrom.Value.ToString("MM-dd-yyyy") + "-" + dpTo.Value.ToString("MM-dd-yyyy") + "(WithoutManager).csv";
                }

                CSVUtility.ToCSV(dtResult, filePath);

                MessageBox.Show("RU Report Generated");
            }
            catch (Exception ex)
            {
                lblStatus.Text = ex.Message;
            }
        }
Beispiel #26
0
    public object ConfigProcess(string[] row)

    {
        if (row.Length < 19)

        {
            return(null);
        }



        RowHelper rh = new RowHelper(row);

        ItemItemConfig rec = new ItemItemConfig();



        rec.id = CSVUtility.ToInt(rh.Read());      //id

        rec.name = rh.Read();                      //名称

        rec.desc = rh.Read();                      //描述

        rec.gain = rh.Read();                      //获取途径

        rec.type = CSVUtility.ToInt(rh.Read());    //类型

        rec.overlap = CSVUtility.ToInt(rh.Read()); //叠加上限

        rec.usetype = CSVUtility.ToInt(rh.Read()); //使用效果类型

        rec.usevalue = new int[2];

        rec.usevalue[0] = CSVUtility.ToInt(rh.Read());          //使用效果值1

        rec.usevalue[1] = CSVUtility.ToInt(rh.Read());          //使用效果值2

        rec.use_times = CSVUtility.ToInt(rh.Read());            //使用次数限制

        rec.cansell = CSVUtility.ToInt(rh.Read());              //是否可出售

        rec.sell = new ItemItemSellConfig[2];

        for (int i = 0; i < 2; i++)
        {
            rec.sell[i] = new ItemItemSellConfig();
        }

        rec.sell[0].id = CSVUtility.ToInt(rh.Read());  //出售获得物品1

        rec.sell[0].num = CSVUtility.ToInt(rh.Read()); //出售获得物品数量1

        rec.sell[1].id = CSVUtility.ToInt(rh.Read());  //出售获得物品2

        rec.sell[1].num = CSVUtility.ToInt(rh.Read()); //出售获得物品数量2

        rec.head = rh.Read();                          //小图标

        rec.model = rh.Read();                         //模型

        rec.star = CSVUtility.ToInt(rh.Read());        //星级

        rec.linkid = CSVUtility.ToInt(rh.Read());      //关联id

        return(rec);
    }
        public string ExportCSVTranscations(ViewTransactionCBE transaction)
        {
            Int16    IsDataFound = 0;
            var      filename    = "Transaction_Details_Registered_" + DateTime.Now.ToString(Constants.dateTimeFormat24HForFileName) + ".csv";
            var      filename1   = "Transaction_Details_UnRegistered_" + DateTime.Now.ToString(Constants.dateTimeFormat24HForFileName) + ".csv";
            FileInfo file        = new FileInfo(Server.MapPath("~/Attachment/ExportFiles/" + filename));
            FileInfo file1       = new FileInfo(Server.MapPath("~/Attachment/ExportFiles/" + filename1));

            try
            {
                string strstarttime = Convert.ToDateTime(transaction.StartDate).ToString("dd/MM/yyyy HH:mm:ss");
                string strendtime   = Convert.ToDateTime(transaction.EndDate).ToString("dd/MM/yyyy HH:mm:ss");
                string strQuery     = " WHERE 1=1 ";
                if (strstarttime != null && strendtime != null)
                {
                    strQuery += " AND  TRANSACTION_DATETIME BETWEEN TO_DATE('" + strstarttime + "','DD/MM/YYYY HH24:MI:SS') AND  TO_DATE('" + strendtime + "','DD/MM/YYYY HH24:MI:SS')";
                }
                else if (strstarttime != null)
                {
                    strQuery += " AND  TRANSACTION_DATETIME >= TO_DATE('" + strstarttime + "','DD/MM/YYYY HH24:MI:SS')";
                }
                else if (strendtime != null)
                {
                    strQuery += " AND  TRANSACTION_DATETIME <= TO_DATE('" + strendtime + "','DD/MM/YYYY HH24:MI:SS')";
                }
                DataTable dt      = TransactionBLL.TransDeatils(strQuery);
                DataView  dv      = new DataView(dt);
                DataTable Charged = dt.AsEnumerable()
                                    .Where(r => r.Field <decimal>("IS_REGISTERED") == 1)
                                    .CopyToDataTable();
                //DataTable Charged = (DataTable)(dv.RowFilter = "IS_BALANCE_UPDATED=1").;
                if (Charged.Rows.Count > 0)
                {
                    IsDataFound = CSVUtility.CreateCsv(file.FullName, Charged);
                    if (IsDataFound == 0)
                    {
                        filename = string.Empty;
                    }
                }
                DataTable UnCharged = dt.AsEnumerable()
                                      .Where(r => r.Field <decimal>("IS_REGISTERED") != 1)
                                      .CopyToDataTable();
                if (UnCharged.Rows.Count > 0)
                {
                    IsDataFound = CSVUtility.CreateCsv(file1.FullName, UnCharged);
                    if (IsDataFound == 0)
                    {
                        if (string.IsNullOrEmpty(filename))
                        {
                            filename = "No Data to Export.";
                        }
                    }
                    else
                    {
                        if (string.IsNullOrEmpty(filename))
                        {
                            filename = "No Data to Export.";
                        }
                        else
                        {
                            filename = filename + ";" + filename1;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                filename = "No Data to Export. :" + ex.Message;
                HelperClass.LogMessage("Failed Export Transaction Details_ CSV " + ex);
            }
            string Det = JsonConvert.SerializeObject(filename, Formatting.Indented);

            return(Det.Replace("\r", "").Replace("\n", ""));
        }