Пример #1
0
        /// <summary>
        /// 保存数据
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            SeatManage.ClassModel.StuLibSyncSetting stulibsync = SeatManage.Bll.T_SM_SystemSet.GetStuLibSync();
            stulibsync.SouIP       = txtsip.Text;
            stulibsync.SouDBName   = txtsDB.Text;
            stulibsync.SouUserName = txtsID.Text;
            stulibsync.SouPW       = txtsPW.Text;
            //stulibsync.TarIP = txttip.Text;
            //stulibsync.TarDBName = txttDB.Text;
            //stulibsync.TarUserName = txttID.Text;
            //stulibsync.TarPW = txttPW.Text;
            stulibsync.SyncMode = (SeatManage.EnumType.StudentSyncMode) int.Parse(ddlmode.SelectedValue);
            DateTime dt = new DateTime();

            if (DateTime.TryParse(time.Text, out dt))
            {
                stulibsync.SyncTime = time.Text;
            }
            else
            {
                FineUI.Alert.Show("日期格式错误!");
                return;
            }
            if (SeatManage.Bll.T_SM_SystemSet.UpdateStuLibSync(stulibsync))
            {
                FineUI.Alert.Show("设置成功!");
            }
            else
            {
                FineUI.Alert.Show("设置失败!");
            }
        }
        public static StuLibSyncSetting Convert(string strSet)
        {
            StuLibSyncSetting set = new StuLibSyncSetting();

            if (!string.IsNullOrEmpty(strSet))
            {
                XmlDocument doc = new XmlDocument();
                doc.LoadXml(strSet);
                //源读者库连接字符串
                XmlNode node = doc.SelectSingleNode("//rootNote/sourceConnectionString");
                set.SouIP       = node.Attributes["servierIP"].Value;
                set.SouDBName   = node.Attributes["dBName"].Value;
                set.SouPW       = node.Attributes["password"].Value;
                set.SouUserName = node.Attributes["uerName"].Value;


                //目标读者库连接字符串
                //node = doc.SelectSingleNode("//rootNote/targetConnectionString");
                //set.TarIP = node.Attributes["servierIP"].Value;
                //set.TarDBName = node.Attributes["dBName"].Value;
                //set.TarPW = node.Attributes["password"].Value;
                //set.TarUserName = node.Attributes["uerName"].Value;

                node         = doc.SelectSingleNode("//rootNote/syncModel");
                set.SyncMode = (StudentSyncMode)int.Parse(node.Attributes["syncModel"].Value);
                set.SyncTime = node.Attributes["syncTime"].Value;

                //node = doc.SelectSingleNode("//rootNote/showMessage");
                //set.RollNowsRRid = node.Attributes["rrID"].Value;
                //set.RollNows = node.InnerText;
            }
            return(set);
        }
Пример #3
0
 /// <summary>
 /// 设置绑定
 /// </summary>
 private void DataBind()
 {
     SeatManage.ClassModel.StuLibSyncSetting stulibsync = SeatManage.Bll.T_SM_SystemSet.GetStuLibSync();
     txtsip.Text           = stulibsync.SouIP;
     txtsDB.Text           = stulibsync.SouDBName;
     txtsID.Text           = stulibsync.SouUserName;
     txtsPW.Text           = stulibsync.SouPW;
     ddlmode.SelectedValue = ((int)stulibsync.SyncMode).ToString();
     time.Text             = stulibsync.SyncTime;
 }
        public static string Convert(StuLibSyncSetting set)
        {
            XmlDocument    doc = new XmlDocument();
            XmlDeclaration dec = doc.CreateXmlDeclaration("1.0", "utf-8", null);

            doc.AppendChild(dec);

            XmlElement rootElement = doc.CreateElement("rootNote");
            XmlElement children1   = doc.CreateElement("sourceConnectionString");

            children1.SetAttribute("servierIP", set.SouIP);
            children1.SetAttribute("dBName", set.SouDBName);
            children1.SetAttribute("password", set.SouPW);
            children1.SetAttribute("uerName", set.SouUserName);
            rootElement.AppendChild(children1);
            //目标读者库连接字符串
            //XmlElement children2 = doc.CreateElement("targetConnectionString");
            //children2.SetAttribute("servierIP", set.TarIP);
            //children2.SetAttribute("dBName", set.TarDBName);
            //children2.SetAttribute("password", set.TarPW);
            //children2.SetAttribute("uerName", set.TarUserName);
            //rootElement.AppendChild(children2);

            XmlElement children3 = doc.CreateElement("syncModel");

            children3.SetAttribute("syncModel", ((int)set.SyncMode).ToString());
            children3.SetAttribute("syncTime", set.SyncTime);
            rootElement.AppendChild(children3);

            //XmlElement children4 = doc.CreateElement("showMessage");
            //children4.SetAttribute("rrID", set.RollNowsRRid);
            //children4.InnerText = set.RollNows;
            //rootElement.AppendChild(children4);
            doc.AppendChild(rootElement);
            return(doc.OuterXml);
        }