Ejemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            XmlDocument doc = new XmlDocument();
            doc.Load("PathConfig.xml");
            XmlNode node = doc.SelectSingleNode("Config/Path");
            XmlNode node1 = doc.SelectSingleNode("Config/ServiceName");
            XmlNode node2 = doc.SelectSingleNode("Config/Format");
            XmlNode node3 = doc.SelectSingleNode("Config/ShopSource");
            XmlNode node4 = doc.SelectSingleNode("Config/PrintName");

            string serverPath = node.InnerText;
            //serviceName = node1.InnerText;
            //format = node2.InnerText;
             string address = serverPath;
            //shopSource = node3.InnerText;
            //printName = node4.InnerText;

            DeliveryPrintService.DeliveryPrintService MyService = new DeliveryPrintService.DeliveryPrintService();
            MyService.Credentials = System.Net.CredentialCache.DefaultCredentials;
            MyService.Url = "http://" + address + "/DeliveryPrintService.asmx";

            DeliveryPrintService.myheader myheader = new myheader();
            myheader.username = "******";

            MyService.myheaderValue = myheader;

            string strUserName = StringTools.EncodingForString(this.textBox_gly.Text.Trim());
            string strPassword = StringTools.EncodingForString(this.textBox_kl.Text.Trim());
            string fuser = StringTools.EncodingForString(this.textBox_user.Text.Trim());

            bool b = MyService.RUser(strUserName, strPassword, fuser);
            if(b)
            {
                MessageBox.Show("用户:"+this.textBox_user.Text+"  解锁成功!");
            }
            else
            {
                MessageBox.Show("解锁失败,请确认管理密码、口令和解锁用户代码正确!");
            }
        }
Ejemplo n.º 2
0
        private void Login()
        {
            try
            {
                //验证
                if (CheckLogin())
                {
                    //address = ReadConfig(); //获取地址
                    XmlDocument doc = new XmlDocument();
                    doc.Load("PathConfig.xml");
                    XmlNode node = doc.SelectSingleNode("Config/Path");
                    XmlNode node1 = doc.SelectSingleNode("Config/ServiceName");
                    XmlNode node2 = doc.SelectSingleNode("Config/Format");
                    XmlNode node3 = doc.SelectSingleNode("Config/ShopSource");
                    XmlNode node4 = doc.SelectSingleNode("Config/PrintName");

                    string serverPath = node.InnerText;
                    serviceName = node1.InnerText;
                    format = node2.InnerText;
                    address = serverPath;
                    shopSource = node3.InnerText;
                    printName = node4.InnerText;

                    DeliveryPrintService.DeliveryPrintService MyService = new DeliveryPrintService.DeliveryPrintService();
                    MyService.Credentials = System.Net.CredentialCache.DefaultCredentials;
                    MyService.Url = "http://" + address + "/DeliveryPrintService.asmx";

                    DeliveryPrintService.myheader myheader = new myheader();
                    myheader.username = "******";

                    MyService.myheaderValue = myheader;

                    ////使用cookie
                    //CookieContainer cookie=new CookieContainer();

                    //MyService.CookieContainer = cookie;

                    string strUserName = StringTools.EncodingForString(this.txtUserName.Text.Trim());
                    string strPassword = StringTools.EncodingForString(this.txtPassword.Text.Trim());
                    DataTable dt = MyService.LoginCheck(strUserName, strPassword);

                    if (dt != null)
                    {
                        if (dt.Rows.Count > 0)
                        {
                            string UserRole = dt.Rows[0]["UserRole"].ToString();
                            string Seller_ID = dt.Rows[0]["Seller_ID"].ToString();
                            string Seller_Iid = dt.Rows[0]["Seller_Iid"].ToString();
                            if(!UserRole.Equals("Q"))
                            {
                                DeliveryPrint dp = new DeliveryPrint();

                                foreach (DataRow dr in dt.Rows)
                                {
                                    dp.Account = dr["Account"].ToString();
                                    dp.CPersonCode = dr["cPersonCode"].ToString();
                                    //dp.CDepCode = dr["cDepCode"].ToString();
                                }
                                dp.Userrole = "打印";
                                dp.Address = address;
                                dp.Seller_ID = Seller_ID;
                                dp.Seller_Iid = Seller_Iid;
                                dp.ServiceName = serviceName;
                                // dp.Format = format;
                                dp.ShipSource = shopSource;
                                dp.PrintName = printName;
                                dp.Show();
                                this.Hide();
                            }
                            else
                            {
                                DeliveryPrint dp = new DeliveryPrint();

                                foreach (DataRow dr in dt.Rows)
                                {
                                    dp.Account = dr["Account"].ToString();
                                    dp.CPersonCode = dr["cPersonCode"].ToString();
                                    dp.CDepCode = dr["cDepCode"].ToString();
                                }
                                dp.Userrole = "查询";
                                dp.Address = address;
                                dp.Seller_ID = Seller_ID;
                                dp.Seller_Iid = Seller_Iid;
                                //dp.ServiceName = serviceName;
                                //// dp.Format = format;
                                //dp.ShipSource = shopSource;
                                //dp.PrintName = printName;
                                dp.Show();
                                dp.Show();
                                this.Hide();

                            }

                        }
                        else
                        {
                            MessageBox.Show("用户名和密码输入的不正确!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            ClearText();
                            this.txtUserName.Focus();

                        }
                    }
                    else
                    {
                        MessageBox.Show("用户名和密码输入的不正确,或该用户已经登录!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        ClearText();
                        this.txtUserName.Focus();

                    }
                }

            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.Message);
                //throw;
            }
        }