private void FillCallInfoList(IXLRows rows, ref CallInfoList listInfo)
        {
            try
            {
                foreach (IXLRow r in rows)
                {
                    if (r.RowNumber() == 1)
                    {
                        continue;
                    }

                    CallInfoSymptom symptom = new CallInfoSymptom();
                    CallInfoTime    time    = new CallInfoTime();
                    foreach (IXLCell cell in r.CellsUsed())
                    {
                        MatchCallInfoListName(cell, ref listInfo, ref symptom, ref time);
                    }
                    listInfo.SymptomInfo.Add(symptom);
                    listInfo.TimeInfo.Add(time);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
示例#2
0
        public void Run()
        {
            CSPCallInfoFromExcel csp      = new CSPCallInfoFromExcel();
            CallInfoList         listInfo = csp.GetCallList(CSPLoginSet.ExcelFile);
            CSPRandom            r        = new CSPRandom(listInfo.Count());

            for (int i = 0; i < listInfo.Count(); i++)
            {
                int j = r.Next();
                Console.WriteLine(listInfo.ContactPerson.ElementAt(j));
            }
        }
        private void MatchCallInfoListName(IXLCell cell, ref CallInfoList listInfo, ref CallInfoSymptom symptom, ref CallInfoTime time)
        {
            try
            {
                switch (cell.WorksheetColumn().FirstCell().GetString().Trim().ToLower())
                {
                case "contactperson":
                    listInfo.ContactPerson.Add(HttpUtility.UrlEncode(cell.GetString()));
                    break;

                case "location":
                    listInfo.Location.Add(HttpUtility.UrlEncode(cell.GetString()));
                    break;

                case "company":
                    listInfo.Company.Add(HttpUtility.UrlEncode(cell.GetString()));
                    break;

                case "requesttype":
                    symptom.RequestType = HttpUtility.UrlEncode(cell.GetString());
                    break;

                case "symptom":
                    symptom.Symptom = HttpUtility.UrlEncode(cell.GetString());
                    break;

                case "scheduletime":
                    time.ScheduleTime = HttpUtility.UrlEncode(cell.GetString());
                    break;

                case "servetime1":
                    time.ServeTime1 = HttpUtility.UrlEncode(cell.GetString());
                    break;

                case "servetime2":
                    time.ServeTime2 = HttpUtility.UrlEncode(cell.GetString());
                    break;

                case "servicedescription":
                    symptom.ServiceDescription = HttpUtility.UrlEncode(cell.GetString());
                    break;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
示例#4
0
        public void OnStart()
        {
            try
            {
                CSPLoginSet.CheckLoginSet();

                CSPCallLogin login  = new CSPCallLogin(CSPLoginSet.LoginId, CSPLoginSet.Password);
                string       cookie = login.Login();

                CSPCallInfoFromExcel excel       = new CSPCallInfoFromExcel();
                CallInfoList         addcalllist = excel.GetCallList(CSPLoginSet.ExcelFile);

                CSPCallPost post = new CSPCallPost()
                {
                    StartDate       = CSPLoginSet.StartDate,
                    EndDate         = CSPLoginSet.EndDate,
                    DayCalls        = CSPLoginSet.DayCalls,
                    AddCallInfoList = addcalllist
                };

                DelLogFile();

                post.AddCalls(cookie);
                CSPLogger.Output("\r\n= = = = = = = = = = = = =\r\n");


                CSPCallClose callclose = new CSPCallClose()
                {
                    CloseCallList    = post.CloseCallInfoList,
                    CallInfoTimeList = addcalllist.TimeInfo
                };

                callclose.CloseCall(cookie);
            }
            catch (Exception)
            {
                throw;
            }
        }
        public CallInfoList GetCallList(string excelPath)
        {
            CallInfoList listInfo = new CallInfoList();

            try
            {
                using (XLWorkbook workbook = new XLWorkbook(excelPath))
                {
                    using (IXLWorksheet sheet = workbook.Worksheet(1))
                    {
                        using (IXLRows rows = sheet.RowsUsed())
                        {
                            FillCallInfoList(rows, ref listInfo);
                        }
                    }
                }
                return(listInfo);
            }
            catch (Exception)
            {
                throw;
            }
        }