Ejemplo n.º 1
0
        public override string InsertLocalFromMaster()
        {
            StringBuilder buffer = new StringBuilder();

            buffer.Append("<?xml version=\"1.0\" encoding=\"utf-8\" ?>");
            buffer.Append("<request>");
            buffer.Append("</request>");
            MisMasterDataServiceInterfaceService service = new MisMasterDataServiceInterfaceService();
            string Xmlstr = service.getUserInfo(buffer.ToString());

            XmlDocument xx = new XmlDocument();

            xx.LoadXml(Xmlstr);                                     //加载xml
            XmlNodeList xxList = xx.GetElementsByTagName(rootname); //取得节点名为DEPTINFO的XmlNode集合


            MSYS.DAL.DbOperator opt         = new MSYS.DAL.DbOperator();
            List <string>       commandlist = new List <string>();
            string temp;

            foreach (XmlNode xxNode in xxList)
            {
                XmlNodeList childList = xxNode.ChildNodes; //取得DEPTINFO下的子节点集合
                int         count     = childList.Count + 1;
                if (count == seg.Length)
                {
                    string[] segvalue = new string[count];
                    segvalue[0] = childList[2].InnerText;
                    segvalue[1] = childList[0].InnerText;
                    segvalue[2] = childList[1].InnerText;
                    segvalue[3] = childList[3].InnerText;
                    string dpno = opt.GetSegValue("select F_CODE  from Ht_Svr_Org_Group where F_KEY = '" + segvalue[3] + "'", "F_CODE");
                    if (dpno != "NoRecord")
                    {
                        segvalue[3] = dpno;
                    }
                    string psd = opt.GetSegValue("select Password from HT_SVR_USER where ID = '" + segvalue[0] + "'", "PassWord");
                    if (psd == "NoRecord" || psd == "")
                    {
                        segvalue[4] = "e10adc3949ba59abbe56e057f20f883e";
                    }
                    else
                    {
                        segvalue[4] = psd;
                    }
                    temp = opt.getMergeStr(seg, segvalue, 1, tablename);
                    commandlist.Add(temp);
                    if (opt.UpDateOra(temp) != "Success")
                    {
                        System.Diagnostics.Debug.Write(temp);
                    }
                }
                else
                {
                    return("字段与值个数不匹配");
                }
            }

            return(opt.TransactionCommand(commandlist));
        }
Ejemplo n.º 2
0
        protected override void InsertLocalFromMasterAsyn()
        {
            StringBuilder buffer = new StringBuilder();

            buffer.Append("<?xml version=\"1.0\" encoding=\"utf-8\" ?>");
            buffer.Append("<request>");
            buffer.Append("</request>");
            MisMasterDataServiceInterfaceService service = new MisMasterDataServiceInterfaceService();

            service.getDeptInfoCompleted += new getDeptInfoCompletedEventHandler(service_Completed);
            service.getDeptInfoAsync(buffer.ToString());
        }
Ejemplo n.º 3
0
        public override string InsertLocalFromMaster()
        {
            StringBuilder buffer = new StringBuilder();

            buffer.Append("<?xml version=\"1.0\" encoding=\"utf-8\" ?>");
            buffer.Append("<request>");
            buffer.Append("</request>");
            MisMasterDataServiceInterfaceService service = new MisMasterDataServiceInterfaceService();

            string      Xmlstr = service.getDeptInfo(buffer.ToString());
            XmlDocument xx     = new XmlDocument();

            xx.LoadXml(Xmlstr);                                     //加载xml
            XmlNodeList xxList = xx.GetElementsByTagName(rootname); //取得节点名为DEPTINFO的XmlNode集合

            MSYS.DAL.DbOperator opt         = new MSYS.DAL.DbOperator();
            List <string>       commandlist = new List <string>();

            foreach (XmlNode xxNode in xxList)
            {
                XmlNodeList childList = xxNode.ChildNodes; //取得DEPTINFO下的子节点集合
                int         count     = childList.Count + 1;
                if (count == seg.Length)
                {
                    string[] segvalue = new string[count];
                    for (int i = 0; i < count - 1; i++)
                    {
                        segvalue[i] = childList[i].InnerText;
                    }
                    segvalue[2] = "";
                    if (segvalue[1] == "江苏鑫源烟草薄片有限公司")
                    {
                        segvalue[count - 1] = "00700000";
                    }
                    else
                    {
                        segvalue[3] = opt.GetSegValue("select F_code from ht_svr_org_group where f_key = '" + segvalue[3] + "'", "F_CODE");
                        segvalue[4] = opt.GetSegValue("select F_code from ht_svr_org_group where f_key = '" + segvalue[0] + "'", "F_CODE");
                        if (segvalue[4] == "NoRecord")
                        {
                            string code;
                            if (segvalue[3] == "00700000")
                            {
                                code = "007" + opt.GetSegValue("select nvl(Max(substr(F_CODE,4,3))+1,1) as code from Ht_Svr_Org_Group where F_parentid = '00700000'", "CODE").PadLeft(3, '0') + "00";
                            }
                            else
                            {
                                code = segvalue[3].Substring(0, 6) + opt.GetSegValue("select nvl( Max(substr(F_CODE,7,2))+1,1) as code from Ht_Svr_Org_Group where F_parentid = '" + segvalue[3] + "'", "CODE").PadLeft(2, '0');
                            }
                            segvalue[4] = code;
                        }
                    }
                    string temp = opt.getMergeStr(seg, segvalue, 1, tablename);
                    commandlist.Add(temp);
                    if (opt.UpDateOra(temp) != "Success")
                    {
                        System.Diagnostics.Debug.Write(temp);
                    }
                }
            }
            return(opt.TransactionCommand(commandlist));
        }