Example #1
0
        public void add(Sms item)
        {
            DataTable dt;

            using (FirebirdDBHelper db = new FirebirdDBHelper(util.GetFbDbStrConn()))
            {
                try
                {
                    db.SetParameters("@I_CUST_TEL", FbDbType.VarChar, item.Cust_Tel);
                    db.SetParameters("@I_MEMO", FbDbType.Text, item.Memo);
                    db.SetParameters("@I_RESULT", FbDbType.SmallInt, item.Result);

                    db.BeginTran();
                    dt = db.GetDataTableSP("INS_SMS_LIST");
                    db.Commit();

                    foreach (DataRow row in dt.Rows)
                    {
                        item.Idx = string.IsNullOrEmpty(row[0].ToString()) == false?int.Parse(row[0].ToString()) : -1;

                        item.Cust_Idx = string.IsNullOrEmpty(row[1].ToString()) == false?int.Parse(row[1].ToString()) : -1;
                    }

                    this.Insert(0, item);
                }
                catch (FbException e)
                {
                    util.WriteLog(e.ErrorCode, e.Message);
                    db.Rollback();
                }
            }
        }
Example #2
0
        public CBDutyLists()
        {
            DataTable dt = null;

            using (FirebirdDBHelper db = new FirebirdDBHelper(util.strDBConn))
            {
                try
                {
                    dt = db.GetDataTableSP("GET_DUTY_INFO");
                }
                catch (System.Data.SqlClient.SqlException e)
                {
                    throw e;
                }
            }

            CBDutyList gl = new CBDutyList()
            {
                Duty_Idx    = "0"
                , Duty_Name = util.LoadProjectResource("TEXT_CB_FIRSTFIELD", "COMMONRES", "").ToString()
            };

            this.Add(gl);

            foreach (DataRow myRow in dt.Rows)
            {
                gl = new CBDutyList()
                {
                    Duty_Idx    = myRow["o_duty_idx"].ToString()
                    , Duty_Name = myRow["o_duty_name"].ToString()
                };

                this.Add(gl);
            }
        }
Example #3
0
        public void add(CallList item)
        {
            DataTable dt;

            using (FirebirdDBHelper db = new FirebirdDBHelper(util.GetFbDbStrConn()))
            {
                try
                {
                    db.SetParameters("@I_DIRECTION", FbDbType.Integer, item.Direction);
                    db.SetParameters("@I_CUST_TEL", FbDbType.VarChar, item.Cust_Tel);
                    db.SetParameters("@I_STARTDATE", FbDbType.TimeStamp, item.Startdate);

                    db.BeginTran();
                    dt = db.GetDataTableSP("INS_CALL_LIST");
                    db.Commit();

                    foreach (DataRow row in dt.Rows)
                    {
                        item.Idx = string.IsNullOrEmpty(row[0].ToString()) == false?int.Parse(row[0].ToString()) : 0;

                        item.Cust_Idx = string.IsNullOrEmpty(row[1].ToString()) == false?int.Parse(row[1].ToString()) : 0;
                    }

                    this.Insert(0, item);
                }
                catch (FbException e)
                {
                    util.WriteLog(e.ErrorCode, e.Message);
                    db.Rollback();
                }
            }
        }
Example #4
0
        public RoomRs(string floor)
        {
            DataTable dt = null;

            using (FirebirdDBHelper db = new FirebirdDBHelper(util.strDBConn))
            {
                DataTable _input = util.CreateDT2SP();
                _input.Rows.Add("@I_ROOM", floor);

                try
                {
                    dt = db.GetDataTableSP("GET_ROOM_BY_FLOOR", _input);

                    foreach (DataRow row in dt.Rows)
                    {
                        this.Add(new RoomR()
                        {
                            txtRoom = row[0].ToString()
                        });
                    }
                }
                catch (FirebirdSql.Data.FirebirdClient.FbException ex)
                {
                    util.WriteLog(string.Format("DB Error ({0}) : {1}", this.GetType(), ex.Message));
                }
            }
        }
Example #5
0
        public AlarmAttentions()
        {
            using (FirebirdDBHelper db = new FirebirdDBHelper(util.strDBConn))
            {
                DataTable dt = util.MakeDataTable2Proc();

                DataRow dr = dt.NewRow();
                dr["DataName"]  = "@i_com_idx";
                dr["DataValue"] = util.Userinfo.COM_IDX;
                dt.Rows.Add(dr);

                try
                {
                    dt = db.GetDataTableSP("GET_ALARM_ATTENTION", dt);
                }
                catch (FirebirdSql.Data.FirebirdClient.FbException fe)
                {
                    throw fe;
                }

                _obslist = new ObservableCollection <AlarmAttention>(
                    (from myRow in dt.AsEnumerable()
                     select new AlarmAttention()
                {
                    Ch_Idx = myRow["o_ch_idx"].ToString()
                    , Ch_Name = myRow["o_ch_name"].ToString()
                    , Evt_Title = myRow["o_evt_title"].ToString()
                    , Evt_Memo = myRow["o_evt_memo"].ToString()
                    , Evt_Sdate = myRow["o_evt_sdate"].ToString()
                }).ToList <AlarmAttention>());
            }
        }
Example #6
0
        public Absences()
        {
            DataTable dt = null;

            using (FirebirdDBHelper db = new FirebirdDBHelper(util.strDBConn))
            {
                try
                {
                    dt = db.GetDataTableSP("GET_ABSENCECALL");
                }
                catch (FirebirdSql.Data.FirebirdClient.FbException ex)
                {
                    util.WriteLog(string.Format("DB Error ({0}) : {1}", this.GetType(), ex.Message));
                }
            }

            foreach (DataRow row in dt.Rows)
            {
                Absence item = new Absence()
                {
                    TELNUM = row[0].ToString(),
                    DETAIL = row[1].ToString(),
                    STATES = row[2].ToString()
                };

                this.Add(item);
            }
        }
Example #7
0
        public Smses(SearchCondition1 val)
        {
            DataTable dt;

            using (FirebirdDBHelper db = new FirebirdDBHelper(util.GetFbDbStrConn()))
            {
                try
                {
                    db.SetParameters("@I_SDATE", FbDbType.TimeStamp, val.StartDate);
                    db.SetParameters("@I_EDATE", FbDbType.TimeStamp, val.EndDate);
                    db.SetParameters("@I_NUMBER", FbDbType.VarChar, val.Number);

                    dt = db.GetDataTableSP("GET_SMS_LIST");

                    foreach (DataRow row in dt.Rows)
                    {
                        this.Add(new Sms()
                        {
                            Idx       = string.IsNullOrEmpty(row[0].ToString()) == false ? int.Parse(row[0].ToString()) : -1,
                            Cust_Idx  = string.IsNullOrEmpty(row[1].ToString()) == false ? int.Parse(row[1].ToString()) : -1,
                            Cust_Name = row[2].ToString(),
                            Cust_Tel  = row[3].ToString(),
                            Regdate   = string.IsNullOrEmpty(row[4].ToString()) == false ? DateTime.Parse(row[4].ToString()) : new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Local),
                            Memo      = row[5].ToString(),
                            Result    = string.IsNullOrEmpty(row[6].ToString()) == false ? int.Parse(row[6].ToString()) : -1
                        });
                    }
                }
                catch (FbException e)
                {
                    util.WriteLog(e.ErrorCode, e.Message);
                }
            }
        }
Example #8
0
        public AlarmBirths()
        {
            using (FirebirdDBHelper db = new FirebirdDBHelper(util.strDBConn))
            {
                DataTable dt = util.MakeDataTable2Proc();

                DataRow dr = dt.NewRow();
                dr["DataName"]  = "@i_com_idx";
                dr["DataValue"] = util.Userinfo.COM_IDX;
                dt.Rows.Add(dr);

                try
                {
                    dt = db.GetDataTableSP("GET_ALARM_BIRTH", dt);
                }
                catch (FirebirdSql.Data.FirebirdClient.FbException fe)
                {
                    throw fe;
                }

                _obslist = new ObservableCollection <AlarmBirth>(
                    (from myRow in dt.AsEnumerable()
                     select new AlarmBirth()
                {
                    Idx = myRow["o_idx"].ToString()
                    , Name = myRow["o_name"].ToString()
                    , Birth = myRow["o_birth"].ToString()
                    , Birth_Luna = myRow["o_birth_luna"].ToString()
                    , Cstg_Name = myRow["o_cstg_name"].ToString()
                    , Remain_Birth = myRow["o_remain_birth"].ToString()
                }).ToList <AlarmBirth>());
            }
        }
Example #9
0
        public Interviewes(int _id, string _sdate, string _edate, string _txt2, string _txt3)
        {
            DataTable dt = util.CreateDT2SP();

            dt.Rows.Add("@iseq", _id);
            dt.Rows.Add("@isdate", _sdate);
            dt.Rows.Add("@iedate", _edate);
            dt.Rows.Add("@itxt2", _txt2);
            dt.Rows.Add("@itxt3", _txt3);

            using (FirebirdDBHelper db = new FirebirdDBHelper(util.strFBDBConn2))
            {
                try
                {
                    dt = db.GetDataTableSP("GET_INTERVIEWS", dt);
                }
                catch (FirebirdSql.Data.FirebirdClient.FbException fe)
                {
                    //throw fe;
                }
            }

            _list = new ObservableCollection <Interview>(
                (from __row in dt.AsEnumerable()
                 select new Interview()
            {
                seq = long.Parse(__row[0].ToString())
                ,
                fseq = int.Parse(string.IsNullOrEmpty(__row[1].ToString()) ? "0" : __row[1].ToString())
                ,
                forward = __row[2].ToString()
                ,
                extention = __row[3].ToString()
                ,
                peernum = __row[4].ToString()
                ,
                recfile = __row[5].ToString()
                ,
                regdate = DateTime.Parse(__row[6].ToString())
                ,
                regyymmdd = __row[7].ToString()
                ,
                reghhmmss = __row[8].ToString()
                ,
                fnlen = double.Parse(__row[9].ToString())
                ,
                tellername = __row[10].ToString()
            }).ToList <Interview>()
                );
        }
Example #10
0
        public Consultants(string _chk, string _sdate, string _edate, string _teller)
        {
            DataTable dt = util.CreateDT2SP();

            dt.Rows.Add("@I_CHK", _chk);
            dt.Rows.Add("@I_SDATE", _sdate);
            dt.Rows.Add("@I_EDATE", _edate);
            dt.Rows.Add("@I_TELLER", _teller);

            using (FirebirdDBHelper db = new FirebirdDBHelper(util.strFBDBConn2))
            {
                try
                {
                    dt = db.GetDataTableSP("GET_LIST_BY_TELNUM", dt);
                }
                catch (FirebirdSql.Data.FirebirdClient.FbException fe)
                {
                    //throw fe;
                }
            }

            _list = new ObservableCollection <Consultant>(
                (from _row in dt.AsEnumerable()
                 select new Consultant()
            {
                telnum = _row["O_TELNUM"].ToString()
                ,
                tellername = _row["O_TELLERNAME"].ToString()
                ,
                calledsec = int.Parse(_row["O_CALLEDSEC"].ToString())
                ,
                callednum = int.Parse(_row["O_CALLEDNUM"].ToString())
                ,
                succeed = int.Parse(_row["O_SUCCEED"].ToString())
                ,
                absence = int.Parse(_row["O_ABSENCE"].ToString())
                ,
                failed = int.Parse(_row["O_FAILED"].ToString())
                ,
                avgcalledsec = int.Parse(_row["O_AVGCALLEDSEC"].ToString())
            }).ToList <Consultant>()
                );
        }
Example #11
0
        public GroupLists()
        {
            DataTable dt = util.MakeDataTable2Proc();
            DataRow   dr = dt.NewRow();

            dr["DataName"]  = "@i_com_idx";
            dr["DataValue"] = util.Userinfo.COM_IDX;
            dt.Rows.Add(dr);

            using (FirebirdDBHelper db = new FirebirdDBHelper(util.strDBConn))
            {
                try
                {
                    dt = db.GetDataTableSP("GET_CUSTGROUP_LIST", dt);
                }
                catch (System.Data.SqlClient.SqlException e)
                {
                    throw e;
                }
            }

            GroupList gl = new GroupList()
            {
                Cstg_Idx     = "0"
                , Cstg_Name  = util.LoadProjectResource("TEXT_CB_FIRSTFIELD", "COMMONRES", "").ToString()
                , Cstg_Depth = "1"
            };

            this.Add(gl);

            foreach (DataRow myRow in dt.Rows)
            {
                gl = new GroupList()
                {
                    Cstg_Idx     = myRow["cstg_idx"].ToString()
                    , Cstg_Name  = myRow["cstg_name"].ToString()
                    , Cstg_Depth = myRow["cstg_depth"].ToString()
                };

                this.Add(gl);
            }
        }
Example #12
0
        public InnerTels()
        {
            DataTable dt = null;

            try
            {
                using (FirebirdDBHelper db = new FirebirdDBHelper(util.strFBDBConn2))
                {
                    try
                    {
                        dt = db.GetDataTableSP("GET_INNERTELS");
                    }
                    catch (FirebirdSql.Data.FirebirdClient.FbException fe1)
                    {
                        //throw fe;
                        MessageBox.Show("test");
                    }
                }

                _list = new ObservableCollection<InnerTel>(
                        (from __row in dt.AsEnumerable()
                         select new InnerTel()
                         {
                             Seq = int.Parse(__row[0].ToString())
                             ,
                             Telnum = "   " + __row[1].ToString()
                             ,
                             TellerName = __row[2].ToString()
                         }
                        ).ToList<InnerTel>()
                    );

                //InnerTel _tmptel = new InnerTel() { Seq = 0, Telnum = "전체" };
                //_list.Insert(0, _tmptel);
            }
            catch (FirebirdSql.Data.FirebirdClient.FbException fe0)
            {
                _list = new ObservableCollection<InnerTel>();
                MessageBox.Show("Database 접속에 문제가 발생하였습니다.\r\n \"도구 → 환경설정 → 서버주소\"을 확인 후 다시 실행해 주세요.");
            }

        }
Example #13
0
        public FamilyRoles()
        {
            DataTable dt = null;

            using (FirebirdDBHelper db = new FirebirdDBHelper(util.strDBConn))
            {
                try
                {
                    dt = db.GetDataTableSP("GET_FAMILY_ROLE");
                }
                catch (System.Data.SqlClient.SqlException e)
                {
                    throw e;
                }
            }

            FamilyRole fr = new FamilyRole()
            {
                Fr_Idx    = "0"
                , Fr_Name = util.LoadProjectResource("TEXT_CB_FIRSTFIELD", "COMMONRES", "").ToString()
                , Fr_Sort = "0"
                , Fr_Use  = "1"
            };

            _roles.Add(fr);

            foreach (DataRow myRow in dt.Rows)
            {
                fr = new FamilyRole()
                {
                    Fr_Idx = myRow["o_fr_idx"].ToString()
                    ,
                    Fr_Name = myRow["o_fr_name"].ToString()
                    ,
                    Fr_Sort = myRow["o_fr_sort"].ToString()
                    ,
                    Fr_Use = myRow["o_fr_use"].ToString()
                };

                _roles.Add(fr);
            }
        }
Example #14
0
        public Customers(int idx)
        {
            DataTable dt;


            using (FirebirdDBHelper db = new FirebirdDBHelper(util.GetFbDbStrConn()))
            {
                try
                {
                    db.SetParameters("@I_GROUP_IDX", FbDbType.Integer, idx);

                    dt = db.GetDataTableSP("GET_CUSTOMER");

                    foreach (DataRow row in dt.Rows)
                    {
                        this.Add(new Customer()
                        {
                            IsChecked  = false,
                            IsSelected = false,
                            Idx        = string.IsNullOrEmpty(row[0].ToString()) == false ? int.Parse(row[0].ToString()) : -1,
                            Group_Idx  = string.IsNullOrEmpty(row[1].ToString()) == false ? int.Parse(row[1].ToString()) : -1,
                            Group_Name = row[2].ToString(),
                            Name       = row[3].ToString(),
                            Company    = row[4].ToString(),
                            Title      = row[5].ToString(),
                            Tel        = row[6].ToString(),
                            Cellular   = row[7].ToString(),
                            Extension  = row[8].ToString(),
                            Email      = row[9].ToString(),
                            Addr       = row[10].ToString(),
                            Etc        = row[11].ToString()
                        });
                    }
                }
                catch (FbException e)
                {
                    util.WriteLog(e.ErrorCode, e.Message);
                }
            }
        }
Example #15
0
        public CDRLists(string _sdate, string _edate, string _gubun, string _teller)
        {
            DataTable dt = util.CreateDT2SP();

            dt.Rows.Add("@i_sdate", _sdate);
            dt.Rows.Add("@i_edate", _edate);
            dt.Rows.Add("@i_gubun", _gubun);
            dt.Rows.Add("@i_teller", _teller);

            using (FirebirdDBHelper db = new FirebirdDBHelper(util.strFBDBConn2))
            {
                try
                {
                    dt = db.GetDataTableSP("GET_CDR_LIST_BY_DATE2", dt);
                }
                catch (FirebirdSql.Data.FirebirdClient.FbException fe)
                {
                    //throw fe;
                }
            }

            _list = new ObservableCollection <CDRs>(
                (from _row in dt.AsEnumerable()
                 select new CDRs()
            {
                startdate = _row[2].ToString()
                ,
                enddate = _row[3].ToString()
                ,
                callernum = _row[5].ToString()
                ,
                callername = _row[9].ToString()
                ,
                calleenum = _row[10].ToString()
            }).ToList <CDRs>()
                );
        }
Example #16
0
        public Accounts()
        {
            DataTable dt = util.CreateDT2SP();

            dt.Rows.Add("@I_ID", util.userid);

            try
            {
                using (FirebirdDBHelper db = new FirebirdDBHelper(util.strFBDBConn2))
                {
                    try
                    {
                        DataTable _dt = db.GetDataTableSP("GET_USRS", dt);

                        _list = new ObservableCollection <Account>(
                            (from _row in _dt.AsEnumerable()
                             select new Account()
                        {
                            ID = _row[0].ToString()
                            ,
                            NAME = _row[1].ToString()
                        }
                            ).ToList <Account>()
                            );
                    }
                    catch (FirebirdSql.Data.FirebirdClient.FbException fe1)
                    {
                        //throw fe;
                    }
                }
            }
            catch (FirebirdSql.Data.FirebirdClient.FbException fe0)
            {
                _list = new ObservableCollection <Account>();
                MessageBox.Show("Database 접속에 문제가 발생하였습니다.\r\n \"도구 → 환경설정 → 서버주소\"을 확인 후 다시 실행해 주세요.");
            }
        }
Example #17
0
        public RealStatusList(int _chk, string _sdate, string _edate)
        {
            DataTable dt = util.CreateDT2SP();

            dt.Rows.Add("@i_chk", _chk);
            dt.Rows.Add("@i_sdate", _sdate);
            dt.Rows.Add("@i_edate", _edate);

            try
            {
                using (FirebirdDBHelper db = new FirebirdDBHelper(util.strFBDBConn2))
                {
                    try
                    {
                        dt = db.GetDataTableSP("GET_REALTIME_STATUS", dt);
                    }
                    catch (FirebirdSql.Data.FirebirdClient.FbException fe1)
                    {
                        //throw fe;
                    }
                }

                Items = new List <StatisticRealStatus>(
                    (from _row in dt.AsEnumerable()
                     select new StatisticRealStatus()
                {
                    Label = _row[0].ToString()
                    ,
                    Value1 = int.Parse(_row[1].ToString())
                }
                    )
                    );
            }
            catch (FirebirdSql.Data.FirebirdClient.FbException fe0)
            {
            }
        }
Example #18
0
        public GroupLists()
        {
            DataTable dt = null;

            using (FirebirdDBHelper db = new FirebirdDBHelper(util.GetFbDbStrConn()))
            {
                try
                {
                    dt = db.GetDataTableSP("GET_GROUPLIST");
                }
                catch (FirebirdSql.Data.FirebirdClient.FbException e)
                {
                    util.WriteLog(e.ErrorCode, e.Message);
                }
            }

            GroupList gltop = new GroupList()
            {
                Idx      = 0,
                Name     = Application.Current.FindResource("GROUPLIST_FIRST").ToString(),
                Children = new ObservableCollection <GroupList>()
            };

            foreach (DataRow myRow in dt.Rows)
            {
                GroupList glsub = new GroupList()
                {
                    Idx                               = string.IsNullOrEmpty(myRow["O_IDX"].ToString()) == false?int.Parse(myRow["O_IDX"].ToString()) : 0,
                                             Name     = myRow["O_NAME"].ToString(),
                                             Children = new ObservableCollection <GroupList>()
                };

                gltop.Children.Add(glsub);
            }

            this.Add(gltop);
        }
Example #19
0
        public FloorRs()
        {
            DataTable dt = null;

            using (FirebirdDBHelper db = new FirebirdDBHelper(util.strDBConn))
            {
                try
                {
                    dt = db.GetDataTableSP("GET_FLOOR");
                }
                catch (FirebirdSql.Data.FirebirdClient.FbException ex)
                {
                    util.WriteLog(string.Format("DB Error ({0}) : {1}", this.GetType(), ex.Message));
                }
            }

            foreach (DataRow row in dt.Rows)
            {
                this.Add(new FloorR()
                {
                    txtFloor = row[0].ToString()
                });
            }
        }
Example #20
0
        public Calltimes(string _chk, string _sdate, string _edate, string _teller)
        {
            DataTable dt = util.CreateDT2SP();

            dt.Rows.Add("@I_CHK", _chk);
            dt.Rows.Add("@I_SDATE", _sdate);
            dt.Rows.Add("@I_EDATE", _edate);
            dt.Rows.Add("@I_TELLER", _teller);

            using (FirebirdDBHelper db = new FirebirdDBHelper(util.strFBDBConn2))
            {
                try
                {
                    dt = db.GetDataTableSP("GET_LIST_BY_HOURS_BAK3", dt);
                }
                catch (FirebirdSql.Data.FirebirdClient.FbException fe)
                {
                    //throw fe;
                }
            }

            List <Calltime> _oblist = new List <Calltime>(
                (from _row in dt.AsEnumerable()
                 select new Calltime()
            {
                total = int.Parse(_row["O_TOTAL"].ToString())
                ,
                txt0 = _row["O_TXT0"].ToString()
                ,
                calledsec = int.Parse(_row["O_CALLED"].ToString())
                ,
                txt1 = _row["O_TXT1"].ToString()
                ,
                avgcalledsec = int.Parse(_row["O_AVGCALLED"].ToString())
            }).ToList <Calltime>()
                );

            int _counterm = 8;
            int _avgcount = _oblist.Count() / _counterm;

            _list = new ObservableCollection <CalltimePivot>();
            for (int i = 0; i < _oblist.Count(); i += _counterm)
            {
                int           k          = 0;
                CalltimePivot _callpivot = new CalltimePivot();
                for (int j = i; j < i + _counterm; j++)
                {
                    _callpivot.timerange = _oblist[j].txt1;
                    _callpivot.totalnum  = _oblist[j].total;
                    _callpivot.colavg    = _oblist[j].avgcalledsec;
                    switch (k)
                    {
                    case 0:
                        _callpivot.col30 = _oblist[j].calledsec;
                        break;

                    case 1:
                        _callpivot.col60 = _oblist[j].calledsec;
                        break;

                    case 2:
                        _callpivot.col180 = _oblist[j].calledsec;
                        break;

                    case 3:
                        _callpivot.col300 = _oblist[j].calledsec;
                        break;

                    case 4:
                        _callpivot.col600 = _oblist[j].calledsec;
                        break;

                    case 5:
                        _callpivot.col1800 = _oblist[j].calledsec;
                        break;

                    case 6:
                        _callpivot.col3600 = _oblist[j].calledsec;
                        break;

                    case 7:
                        _callpivot.colall = _oblist[j].calledsec;
                        break;
                    }
                    k++;
                }
                _list.Add(_callpivot);
            }
        }
Example #21
0
        public Calltimes(string _chk, string _sdate, string _edate, string _teller)
        {
            DataTable dt_worktime = null;

            using (FirebirdDBHelper db = new FirebirdDBHelper(util.strFBDBConn2))
            {
                try
                {
                    dt_worktime = db.GetDataTableSP("GET_LIST_WORKTIME");
                }
                catch (FirebirdSql.Data.FirebirdClient.FbException fe)
                {
                    //throw fe;
                }
            }

            DataTable dt_cdrs = util.CreateDT2SP();

            dt_cdrs.Rows.Add("@I_SDATE", _sdate);
            dt_cdrs.Rows.Add("@I_EDATE", _edate);
            dt_cdrs.Rows.Add("@I_TELLER", _teller);

            using (FirebirdDBHelper db = new FirebirdDBHelper(util.strFBDBConn2))
            {
                try
                {
                    dt_cdrs = db.GetDataTableSP("GET_CDR_LIST_BY_DATE", dt_cdrs);
                }
                catch (FirebirdSql.Data.FirebirdClient.FbException fe)
                {
                    //throw fe;
                }
            }

            var _cdrs = dt_cdrs.AsEnumerable().ToList();

#if true // foreach 사용
            _list = new List <CalltimePivot>();
            foreach (var wtime in dt_worktime.AsEnumerable())
            {
                var _lcdrs = _cdrs.Where(p => ((DateTime)p[3]).Hour == int.Parse(wtime[0].ToString()));
                //((DateTime)x[3]).Hour == int.Parse(wtime[0].ToString())

                CalltimePivot _pivot = new CalltimePivot()
                {
                    timerange = wtime[1].ToString()
                    ,
                    totalnum = _lcdrs.Count(x => ((DateTime)x[4] - (DateTime)x[3]).TotalSeconds > 0)
                    ,
                    col30 = _lcdrs.Count(x => (((DateTime)x[4]) - ((DateTime)x[3])).TotalSeconds > 0 && (((DateTime)x[4]) - ((DateTime)x[3])).TotalSeconds <= 30)
                    ,
                    col60 = _lcdrs.Count(x => (((DateTime)x[4]) - ((DateTime)x[3])).TotalSeconds > 30 && (((DateTime)x[4]) - ((DateTime)x[3])).TotalSeconds <= 60)
                    ,
                    col180 = _lcdrs.Count(x => (((DateTime)x[4]) - ((DateTime)x[3])).TotalSeconds > 60 && (((DateTime)x[4]) - ((DateTime)x[3])).TotalSeconds <= 180)
                    ,
                    col300 = _lcdrs.Count(x => (((DateTime)x[4]) - ((DateTime)x[3])).TotalSeconds > 180 && (((DateTime)x[4]) - ((DateTime)x[3])).TotalSeconds <= 300)
                    ,
                    col600 = _lcdrs.Count(x => (((DateTime)x[4]) - ((DateTime)x[3])).TotalSeconds > 300 && (((DateTime)x[4]) - ((DateTime)x[3])).TotalSeconds <= 600)
                    ,
                    col1800 = _lcdrs.Count(x => (((DateTime)x[4]) - ((DateTime)x[3])).TotalSeconds > 600 && (((DateTime)x[4]) - ((DateTime)x[3])).TotalSeconds <= 1800)
                    ,
                    col3600 = _lcdrs.Count(x => (((DateTime)x[4]) - ((DateTime)x[3])).TotalSeconds > 1800 && (((DateTime)x[4]) - ((DateTime)x[3])).TotalSeconds <= 3600)
                    ,
                    colall = _lcdrs.Count(x => (((DateTime)x[4]) - ((DateTime)x[3])).TotalSeconds > 3600)
                    ,
                    colavg = _lcdrs.Count(x => ((DateTime)x[4] - (DateTime)x[3]).TotalSeconds > 0) == 0 ? 0 : (int)_lcdrs.Sum(x => ((DateTime)x[4] - (DateTime)x[3]).TotalSeconds) / _lcdrs.Count(x => ((DateTime)x[4] - (DateTime)x[3]).TotalSeconds > 0)
                };

                _list.Add(_pivot);
            }
#endif

#if false // lamda 사용
            _list = new List <CalltimePivot>(
                (from wtime in dt_worktime.AsEnumerable()
                 select new CalltimePivot()
            {
                timerange = wtime[1].ToString()
                ,
                totalnum = _cdrs.Count(x => ((DateTime)x[3]).Hour == int.Parse(wtime[0].ToString()) && ((DateTime)x[4] - (DateTime)x[3]).TotalSeconds > 0)
                ,
                col30 = _cdrs.Count(x => ((DateTime)x[3]).Hour == int.Parse(wtime[0].ToString()) && (((DateTime)x[4]) - ((DateTime)x[3])).TotalSeconds > 0 && (((DateTime)x[4]) - ((DateTime)x[3])).TotalSeconds <= 30)
                ,
                col60 = _cdrs.Count(x => ((DateTime)x[3]).Hour == int.Parse(wtime[0].ToString()) && (((DateTime)x[4]) - ((DateTime)x[3])).TotalSeconds > 30 && (((DateTime)x[4]) - ((DateTime)x[3])).TotalSeconds <= 60)
                ,
                col180 = _cdrs.Count(x => ((DateTime)x[3]).Hour == int.Parse(wtime[0].ToString()) && (((DateTime)x[4]) - ((DateTime)x[3])).TotalSeconds > 60 && (((DateTime)x[4]) - ((DateTime)x[3])).TotalSeconds <= 180)
                ,
                col300 = _cdrs.Count(x => ((DateTime)x[3]).Hour == int.Parse(wtime[0].ToString()) && (((DateTime)x[4]) - ((DateTime)x[3])).TotalSeconds > 180 && (((DateTime)x[4]) - ((DateTime)x[3])).TotalSeconds <= 300)
                ,
                col600 = _cdrs.Count(x => ((DateTime)x[3]).Hour == int.Parse(wtime[0].ToString()) && (((DateTime)x[4]) - ((DateTime)x[3])).TotalSeconds > 300 && (((DateTime)x[4]) - ((DateTime)x[3])).TotalSeconds <= 600)
                ,
                col1800 = _cdrs.Count(x => ((DateTime)x[3]).Hour == int.Parse(wtime[0].ToString()) && (((DateTime)x[4]) - ((DateTime)x[3])).TotalSeconds > 600 && (((DateTime)x[4]) - ((DateTime)x[3])).TotalSeconds <= 1800)
                ,
                col3600 = _cdrs.Count(x => ((DateTime)x[3]).Hour == int.Parse(wtime[0].ToString()) && (((DateTime)x[4]) - ((DateTime)x[3])).TotalSeconds > 1800 && (((DateTime)x[4]) - ((DateTime)x[3])).TotalSeconds <= 3600)
                ,
                colall = _cdrs.Count(x => ((DateTime)x[3]).Hour == int.Parse(wtime[0].ToString()) && (((DateTime)x[4]) - ((DateTime)x[3])).TotalSeconds > 3600)
                ,
                colavg = _cdrs.Count(x => ((DateTime)x[3]).Hour == int.Parse(wtime[0].ToString()) && ((DateTime)x[4] - (DateTime)x[3]).TotalSeconds > 0) == 0 ? 0 : (int)_cdrs.Where(x => ((DateTime)x[3]).Hour == int.Parse(wtime[0].ToString())).Sum(x => (((DateTime)x[4]) - ((DateTime)x[3])).TotalSeconds) / _cdrs.Count(x => ((DateTime)x[3]).Hour == int.Parse(wtime[0].ToString()) && ((DateTime)x[4] - (DateTime)x[3]).TotalSeconds > 0)
            }).ToList <CalltimePivot>()
                );
#endif

/*
 *          List<CDR> _cdrs = new List<CDR>(
 *              (from cdrRow in dt_cdrs.AsEnumerable()
 *               select new CDR() {
 *                   index = string.IsNullOrEmpty(cdrRow["IDX"].ToString()) ? 0 : int.Parse(cdrRow["IDX"].ToString())
 *                   ,
 *                   inner_fseq = string.IsNullOrEmpty(cdrRow["INNER_FSEQ"].ToString()) ? 0 : int.Parse(cdrRow["INNER_FSEQ"].ToString())
 *                   ,
 *                   office_name = cdrRow["OFFICE_NAME"].ToString()
 *                   ,
 *                   startdate = DateTime.Parse(cdrRow["STARTDATE"].ToString())
 *                   ,
 *                   enddate = DateTime.Parse(cdrRow["ENDDATE"].ToString())
 *                   ,
 *                   caller_type = string.IsNullOrEmpty(cdrRow["CALLER_TYPE"].ToString()) ? 0 : int.Parse(cdrRow["CALLER_TYPE"].ToString())
 *                   ,
 *                   caller = cdrRow["CALLER"].ToString()
 *                   ,
 *                   caller_ipn_number = cdrRow["CALLER_IPN_NUMBER"].ToString()
 *                   ,
 *                   caller_group_code = cdrRow["CALLER_GROUP_CODE"].ToString()
 *                   ,
 *                   caller_group_name = cdrRow["CALLER_GROUP_NAME"].ToString()
 *                   ,
 *                   caller_human_name = cdrRow["CALLER_HUMAN_NAME"].ToString()
 *                   ,
 *                   callee = cdrRow["CALLEE"].ToString()
 *                   ,
 *                   callee_type = string.IsNullOrEmpty(cdrRow["CALLEE_TYPE"].ToString()) ? 0 : int.Parse(cdrRow["CALLEE_TYPE"].ToString())
 *                   ,
 *                   callee_ipn_number = cdrRow["CALLEE_IPN_NUMBER"].ToString()
 *                   ,
 *                   callee_group_code = cdrRow["CALLEE_GROUP_CODE"].ToString()
 *                   ,
 *                   callee_group_name = cdrRow["CALLEE_GROUP_NAME"].ToString()
 *                   ,
 *                   callee_human_name = cdrRow["CALLEE_HUMAN_NAME"].ToString()
 *                   ,
 *                   result = string.IsNullOrEmpty(cdrRow["RESULT"].ToString()) ? -1 : int.Parse(cdrRow["RESULT"].ToString())
 *                   ,
 *                   seq = string.IsNullOrEmpty(cdrRow["SEQ"].ToString()) ? 0 : int.Parse(cdrRow["SEQ"].ToString())
 *               }).ToList()
 *              );
 *
 *          _list = new List<CalltimePivot>(
 *                  (from wtime in dt_worktime.AsEnumerable()
 *                   select new CalltimePivot()
 *                   {
 *                       timerange = wtime[1].ToString()
 *                       ,
 *                       totalnum = _cdrs.Count(x => x == int.Parse(wtime[0].ToString()) && (x.enddate - x.startdate).TotalSeconds > 0)
 *                       ,
 *                       col30 = _cdrs.Count(x => x.startdate.Hour == int.Parse(wtime[0].ToString()) && (x.enddate - x.startdate).TotalSeconds > 0 && (x.enddate - x.startdate).TotalSeconds <= 30)
 *                       ,
 *                       col60 = _cdrs.Count(x => x.startdate.Hour == int.Parse(wtime[0].ToString()) && (x.enddate - x.startdate).TotalSeconds > 30 && (x.enddate - x.startdate).TotalSeconds <= 60)
 *                       ,
 *                       col180 = _cdrs.Count(x => x.startdate.Hour == int.Parse(wtime[0].ToString()) && (x.enddate - x.startdate).TotalSeconds > 60 && (x.enddate - x.startdate).TotalSeconds <= 180)
 *                       ,
 *                       col300 = _cdrs.Count(x => x.startdate.Hour == int.Parse(wtime[0].ToString()) && (x.enddate - x.startdate).TotalSeconds > 180 && (x.enddate - x.startdate).TotalSeconds <= 300)
 *                       ,
 *                       col600 = _cdrs.Count(x => x.startdate.Hour == int.Parse(wtime[0].ToString()) && (x.enddate - x.startdate).TotalSeconds > 300 && (x.enddate - x.startdate).TotalSeconds <= 600)
 *                       ,
 *                       col1800 = _cdrs.Count(x => x.startdate.Hour == int.Parse(wtime[0].ToString()) && (x.enddate - x.startdate).TotalSeconds > 600 && (x.enddate - x.startdate).TotalSeconds <= 1800)
 *                       ,
 *                       col3600 = _cdrs.Count(x => x.startdate.Hour == int.Parse(wtime[0].ToString()) && (x.enddate - x.startdate).TotalSeconds > 1800 && (x.enddate - x.startdate).TotalSeconds <= 3600)
 *                       ,
 *                       colall = _cdrs.Count(x => x.startdate.Hour == int.Parse(wtime[0].ToString()) && (x.enddate - x.startdate).TotalSeconds > 3600)
 *                       ,
 *                       colavg = (int)_cdrs.Where(x => x.startdate.Hour == int.Parse(wtime[0].ToString())).Sum(x => (x.enddate - x.startdate).TotalSeconds)
 *                   }).ToList<CalltimePivot>()
 *              );
 */
        }
Example #22
0
        public Floors()
        {
            DataTable dt = null;

            using (FirebirdDBHelper db = new FirebirdDBHelper(util.strDBConn))
            {
                try
                {
                    dt = db.GetDataTableSP("GET_FLOOR");
                }
                catch (FirebirdSql.Data.FirebirdClient.FbException ex)
                {
                    util.WriteLog(string.Format("DB Error ({0}) : {1}", this.GetType(), ex.Message));
                }
            }

            foreach (DataRow row in dt.Rows)
            {
                DataTable dt1 = null;
                using (FirebirdDBHelper db = new FirebirdDBHelper(util.strDBConn))
                {
                    DataTable _input = util.CreateDT2SP();
                    _input.Rows.Add("@I_ROOM", row[0].ToString());

                    try
                    {
                        dt1 = db.GetDataTableSP("GET_ROOM_BY_FLOOR", _input);
                    }
                    catch (FirebirdSql.Data.FirebirdClient.FbException ex)
                    {
                        util.WriteLog(string.Format("DB Error ({0}) : {1}", this.GetType(), ex.Message));
                    }
                }

                ObservableCollection <RoomItem> _list = new ObservableCollection <RoomItem>();
                foreach (DataRow _row in dt1.Rows)
                {
                    int      err_count = 0;
                    RoomItem txtroom   = new RoomItem()
                    {
                        RoomNum         = _row[0].ToString(),
                        States          = string.IsNullOrEmpty(_row[1].ToString()) == true || _row[1].ToString().Equals("0") ? "0" : "1",
                        States_Clean    = _row[4].ToString(),
                        States_Laundary = _row[5].ToString(),
                        States_Parcel   = _row[6].ToString(),
                        IsChecked       = false,
                        Height          = 130,
                        Width           = 130,
                        CWidth          = 70,
                        CHeight         = 70,
                        Margin          = new Thickness(10, 10, 10, 10),
                        HAlignment      = System.Windows.HorizontalAlignment.Left,
                        VAlignment      = System.Windows.VerticalAlignment.Top
                    };

                    _cgi_pms_data_type pms_data_type;
                    using (HotelHelper hh = new HotelHelper(util.PBXIP))
                    {
                        pms_data_type = hh.GetPolicy(_row[2].ToString());
                        if (pms_data_type.status == STRUCTS.ERR_SOCKET_TIMEOUT)
                        {
                            _list.Add(txtroom);
                            continue;
                        }
                    }
                    txtroom.Hour    = pms_data_type.hour;
                    txtroom.Minutes = pms_data_type.minutes;
                    if (txtroom.States.Equals("0"))
                    {
                        pms_data_type.language = 0;
                    }
                    txtroom.Languages = pms_data_type.language.ToString();
                    txtroom.PMSDATA   = pms_data_type;

                    _list.Add(txtroom);
                }

                var lastitem = _list.Where(x => x.PMSDATA.status == STRUCTS.ERR_SOCKET_TIMEOUT);
                if (lastitem.Count() > 1)
                {
                    break;
                }
                this.Add(new Floor()
                {
                    txtFloor = string.Format("{0}F", row[0].ToString()), list = _list
                });
            }
        }
Example #23
0
        public MonthFees()
        {
            /*
             * _monthfees.Add(new MonthFee() {
             *  CH_Idx = "6"
             *  , CH_Name = "어린이6"
             *  , FEE_DelayMonth = "1"
             *  , P_Idx = "19"
             *  , P_Name = "부모19"
             *  , P_Tel = "070-4694-6730"
             * });
             *
             * _monthfees.Add(new MonthFee()
             * {
             *  CH_Idx = "7"
             *  ,
             *  CH_Name = "어린이7"
             *  ,
             *  FEE_DelayMonth = "1"
             *  ,
             *  P_Idx = "19"
             *  ,
             *  P_Name = "부모19"
             *  ,
             *  P_Tel = "070-4694-6730"
             * });
             */

            using (FirebirdDBHelper db = new FirebirdDBHelper(util.strDBConn))
            {
                DataTable dt = util.MakeDataTable2Proc();

                DataRow dr = dt.NewRow();
                dr["DataName"]  = "@i_com_idx";
                dr["DataValue"] = util.Userinfo.COM_IDX;
                dt.Rows.Add(dr);

                dr              = dt.NewRow();
                dr["DataName"]  = "@i_day";
                dr["DataValue"] = util.i_day;
                dt.Rows.Add(dr);

                try
                {
                    dt = db.GetDataTableSP("GET_MONTHFEE_LIST", dt);
                }
                catch (FirebirdSql.Data.FirebirdClient.FbException fe)
                {
                    throw fe;
                }

                _monthfees = new ObservableCollection <MonthFee>(
                    (from myRow in dt.AsEnumerable()
                     select new MonthFee()
                {
                    P_Idx = myRow["o_p_idx"].ToString()
                    , P_Name = myRow["o_p_name"].ToString()
                    , P_Tel = myRow["o_p_tel"].ToString()
                    , CH_Idx = myRow["o_ch_idx"].ToString()
                    , CH_Name = myRow["o_ch_name"].ToString()
                    , FEE_DelayMonth = myRow["o_fee_delay"].ToString()
                    , FEE_STATUS = myRow["o_curstatus"].ToString()
                }).ToList <MonthFee>());
            }
        }