Example #1
0
        public void BKLawyersInfo(bool DownloadPhoto)
        {
            ShowActionInfo("����������ʦ���Ͽ�......");
            WebClient Weber = new WebClient();

            try
            {

                System.Collections.Generic.List<Lawyers> lawyers = einterface.GetLawyersInfo();

                //if (DS != null)
                if(lawyers!=null&&lawyers.Count>0)
                {
                    Access SKDB = new Access();

                    //DataTable DT = DS.Tables[0];

                    //int AllCnt = DT.Rows.Count;
                    int AllCnt = lawyers.Count;

                    SKDB.ExecuteSQL("delete from Lawyers");

                    StateBar.Visible = true;
                    StateBar.Step = 100;
                    StateBar.Maximum = AllCnt;

                    int Cnt = 0, PHCnt = 0;
                    //string PhotoBaseUrl = SKWS.GetPhotoBaseUrl();

                    //foreach (DataRow DR in DT.Rows)
                    foreach(Lawyers lawyer in lawyers)
                    {
                        StateBar.Value = ++Cnt;

                        //string PhotoPath = DR["LawyerPhoto"].ToString();
                        string PhotoPath=lawyer.Photo;

                        //string SQLStr = string.Format("insert into Lawyers(bh,xm,kh,SWSName,LawCreditNo,PhotoURL) values ({0},'{1}','{2}','{3}','{4}','{5}')",
                        //                             Cnt,
                        //                             DR["XM"],
                        //                             DR["KH"].ToString() != "" ? Convert.ToInt64(DR["KH"]).ToString() : "88888" + Cnt.ToString(),
                        //                             DR["SWSName"],
                        //                             DR["LawyerID"],
                        //                             PhotoPath);

                        string SQLStr = string.Format("insert into Lawyers(bh,xm,kh,SWSName,LawCreditNo,PhotoURL,mobile) values ({0},'{1}','{2}','{3}','{4}','{5}','{6}')",
                                       lawyer.Userid,
                                       lawyer.Username,
                                       //lawyer.Cardno != "" ? Convert.ToInt64(lawyer.Cardno).ToString() : "88888" + Cnt.ToString(),
                                       lawyer.Cardno != "" ? lawyer.Cardno : "888888" + Cnt.ToString(),
                                       lawyer.Officename,
                                       lawyer.Lawyerno,
                                       PhotoPath,lawyer.Systemno);
                        SKDB.ExecuteSQL(SQLStr);

                        if (DownloadPhoto && PhotoBaseUrl != "" && PhotoPath != ""&&!PhotoPath.Equals("")&&!PhotoPath.Equals("null"))
                        {
                            string DownPHFile = ChkPhDirectory() + PhotoPath.Replace("/", @"\");
                            string DownDir = DownPHFile.Substring(0, DownPHFile.LastIndexOf(@"\"));

                            //Logger.LogInfo("DownPHFile::" + DownPHFile + ",DownDir::" + DownDir);

                            if (!Directory.Exists(DownDir)) Directory.CreateDirectory(DownDir);

                            if (!PhotoBaseUrl.EndsWith("/"))
                            {
                                PhotoBaseUrl += "/";
                            }

                            if (File.Exists(DownPHFile))
                                File.Delete(DownPHFile);
                            try
                            {
                               // Logger.LogInfo("PhotoBaseUrl + PhotoPath:::" + PhotoBaseUrl + PhotoPath + "===" + DownPHFile);

                                    Weber.DownloadFile(PhotoBaseUrl + PhotoPath, DownPHFile);
                                    PHCnt++;
                            }
                            catch(Exception e)
                            {
                                Logger.LogInfo("������ʦ��Ƭʧ��:::"+e.Message+"\r\n"+e.StackTrace);
                            }
                        }

                        ShowActionInfo(string.Format("����{0}�� ������ʦ��¼[{1}]/��Ƭ[{2}]", AllCnt, Cnt, PHCnt));

                    }

                    StateBar.Visible = false;
                    StateBar.Value = 0;
                }
            }

            catch (System.Web.Services.Protocols.SoapException ex)
            {
                MessageBox.Show("Message:\n" + ex.Message + "\nDetail:\n" + ex.Detail.InnerText + "\nStackTrace:\n" + ex.StackTrace);
            }

            ShowActionInfo("");
        }
Example #2
0
        /// <summary>
        /// �õ��ֳ���ѵ�Ŀγ���Ϣ
        /// </summary>
        public void BKLessonsInfo()
        {
            ShowActionInfo("����������ѵ�γ̿�......");

            try
            {

                //DataSet DS = SKWS.GetLessonsInfo();
                System.Collections.Generic.List<Lessons> lessons = einterface.GetLessonsInfo();
                System.Collections.Generic.List<ClassReg> classregs = einterface.GetClassRegInfo();
                int lessonlen = lessons == null ? 0 : lessons.Count;
                int classreglen = classregs == null ? 0 : classregs.Count;
                //if (DS != null)
                if (lessonlen > 0)
                {

                    Access SKDB = new Access();

             //       SKDB.ExecuteSQL("delete from ClassReg");
                    SKDB.ExecuteSQL("delete from LessonInfo");

                    //DataTable LXLessonDT = DS.Tables["LX_Lesson"];
                    //DataTable LXBMDT = DS.Tables["LX_BMLawyers"];

                    //int AllCnt=LXLessonDT.Rows.Count+LXBMDT.Rows.Count;

                    int AllCnt = lessonlen + classreglen;

                    StateBar.Visible = true;
                    StateBar.Step = 1;
                    StateBar.Maximum = AllCnt;

                    ShowActionInfo(string.Format("��ѵ��ؼ�¼����{0}", AllCnt));

                    int Cnt = 0;
                    //foreach (DataRow DR in LXLessonDT.Rows)
                    foreach(Lessons lesson in lessons)
                    {
                        SKDB.ExecuteSQL(string.Format("insert into LessonInfo(LessonID,LessonName,LessonType,LessonSDT,ReqMinutes) values ('{0}','{1}','{2}','{3}',{4})",
                                                    //DR["LessonID"], DR["LessonName"], DR["LessonState"], DR["LessonDT"], DR["SKReqTime"]));
                                                    lesson.Lessonid,lesson.Title, lesson.Lessontype,lesson.Lessondate, lesson.Reqminute));

                        StateBar.Value = ++Cnt;
                    }

                    //foreach (DataRow DR in LXBMDT.Rows)
                    foreach (ClassReg classreg in classregs)
                    {
                        SKDB.ExecuteSQL(string.Format("insert into ClassReg(LessonID,LawyerID,RegDate,RegType) values('{0}','{1}','{2}','{3}')",
                                                      //DR["LessonID"], DR["LawyerID"], DR["DoDate"], DR["DoItem"]));
                                                      classreg.Lessonid, classreg.Lawyerno, classreg.Dotime, classreg.Regtype));
                        StateBar.Value = ++Cnt;
                    }

                    StateBar.Visible = false;
                    StateBar.Value = 0;
                }
            }
            catch (System.Web.Services.Protocols.SoapException ex)
            {
                MessageBox.Show("Message:\n" + ex.Message + "\nDetail:\n" + ex.Detail.InnerText +
                    "\nStackTrace:\n" + ex.StackTrace);
            }

            ShowActionInfo("");
        }
Example #3
0
        /// <summary>
        /// �ϴ��ɼ�
        /// </summary>
        /// <returns></returns>
        public int UploadSKRecs()
        {
            DataSet SKEptRecs = new DataSet();

            Access SKDB = new Access();
            //��ˢ�����ϴ�
            SKDB.AddTableInDataSet(SKEptRecs, "SKRecs", "select * from SKRecs where IsToRemote=false order by id");

            //if (SKWS.SetSKRecs(SKEptRecs))
            if (einterface.SetSKRecs(SKEptRecs))
            {
                int RecsNum = SKEptRecs.Tables["SKRecs"].Rows.Count;

                string UpdateRecIDs = "";

                StateBar.Visible = true;
                StateBar.Step = 1;
                StateBar.Maximum = RecsNum;

                ShowActionInfo(string.Format("�ϴ�ˢ����¼��{0}", RecsNum));

                for (int i = 0; i < RecsNum; i++)
                {
                    DataRow SKRec = SKEptRecs.Tables["SKRecs"].Rows[i];

                    UpdateRecIDs += (UpdateRecIDs == "" ? "" : ",") + SKRec["ID"].ToString();

                    StateBar.Value = i;

                }

                if (UpdateRecIDs != "")
                    SKDB.ExecuteSQL(string.Format("update  SKRecs set IsToRemote=true where ID in ({0})", UpdateRecIDs));

                StateBar.Visible = false;
                StateBar.Value = 0;
                ShowActionInfo("");

                return RecsNum;
            }
            else return 0;
        }
Example #4
0
        public void TestModeSK()
        {
            Access SKDB=new Access();

            OleDbDataReader TmpReader=SKDB.ExecuteQuery("select count(*) from lawyers");
            int LawyerCnt;

            while(true)
            {
                TmpReader.Read();
                LawyerCnt= Convert.ToInt32(TmpReader.GetValue(0).ToString());
                TmpReader.Close();
                Logger.LogInfo("SKProcess��ϵͳ������" + LawyerCnt + "����ʦ");
                if (LawyerCnt > 0)
                {

                    break;
                }

                Thread.Sleep(10000);
            }

            Random rm=new Random();

            while(true)
            {
                int TMBH=rm.Next(1,LawyerCnt);
                DateTime DT=DateTime.Now;

                DataSet RMRecs=new DataSet();
                Access AccessDB=new Access();
                AccessDB.AddTableInDataSet(RMRecs,"Recs",string.Format("select top {0} bh from lawyers order by bh",TMBH));
                string sql = string.Format("insert into yskq(bh,rq,sj,SKMode) values({0},'{1}','{2}','ģ��')",
                                RMRecs.Tables["Recs"].Rows[TMBH - 1][0].ToString(),
                                DT.ToString("yyyy-MM-dd"),
                                DT.ToString("HH-mm-ss"));
            //    System.Windows.Forms.MessageBox.Show(sql);
                SKDB.ExecuteSQL(sql);

                Thread.Sleep(2000);
            }

            /*			public void TestModeSK()
            {
                Access SKDB=new Access();

                OleDbDataReader TmpReader=SKDB.ExecuteQuery("select min(bh) ,max(bh) from lawyers");

                while (!TmpReader.HasRows)
                {
                    TmpReader=SKDB.ExecuteQuery("select min(bh) ,max(bh) from lawyers");

                }

                TmpReader.Read();

                int MinBH= Convert.ToInt32(TmpReader.GetValue(0).ToString()),MaxBH= Convert.ToInt32(TmpReader.GetValue(1).ToString());

                TmpReader.Close();

                Random rm=new Random();
                while(true)
                {

                    int TMBH=rm.Next(MinBH,MaxBH);
                    DateTime DT=DateTime.Now;

                    SKDB.ExecuteSQL(string.Format("insert into yskq(bh,rq,sj) values({0},'{1}','{2}')",TMBH,DT.ToString("yyyy-MM-dd"),DT.ToString("HH-mm-ss")));

                    Thread.Sleep(6000);
                }
            */
        }