Example #1
0
 public static DataTable XemDL(string viewer, string user, string password)
 {
     if (viewer == "*")
     {
         return(DangNhapDAL.XemDL(user, password));
     }
     else
     {
         return(DangNhapDAL.XemQuyen(user));
     }
 }
Example #2
0
 public string BLL_PhanQuyen(DangNhapPublic login)
 {
     try
     {
         DangNhapDAL clsDAL = new DangNhapDAL();
         string      txt    = clsDAL.DAL_DangNhap_Select(login).Rows[0][2].ToString();
         return(txt);
     }
     catch
     { }
     return("");
 }
Example #3
0
        public bool BLL_DangNhap_Select(DangNhapPublic login)
        {
            bool blKey = false;

            try
            {
                DangNhapDAL clsDAL = new DangNhapDAL();
                int         intRow = clsDAL.DAL_DangNhap_Select(login).Rows.Count;
                if (intRow != 0)
                {
                    blKey = true;
                }
            }
            catch
            {
            }
            return(blKey);
        }
Example #4
0
 public static DataTable GetThongTinNguoiDung(string tenDangNhap)
 {
     return(DangNhapDAL.GetThongTinNguoiDung(tenDangNhap));
 }
Example #5
0
 public DangNhap()
 {
     InitializeComponent();
     dangNhapDAL = new DangNhapDAL();
 }
        //public Version curVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
        //string curVersion = Application.ProductVersion;
        private bool Kiemtracapnhat()
        {
            bool   has_update = false;
            string newVersion = "";

            // in newVersion variable we will store the
            // version info from xml file
            //Version newVersion = null;
            // and in this variable we will put the url we
            // would like to open so that the user can
            // download the new version
            // it can be a homepage or a direct
            // link to zip/exe file
            //string url = "";
            //XmlTextReader reader = null;
            try
            {
                // provide the XmlTextReader with the URL of
                // our xml document
                //string xmlURL = "http://192.168.1.150/update_crm.xml";
                ////string xmlURL = "http://10.14.0.30/update_crm.xml";
                //reader = new XmlTextReader(xmlURL);
                //// simply (and easily) skip the junk at the beginning
                //reader.MoveToContent();
                //// internal - as the XmlTextReader moves only
                //// forward, we save current xml element name
                //// in elementName variable. When we parse a
                //// text node, we refer to elementName to check
                //// what was the node name
                //string elementName = "";
                //// we check if the xml starts with a proper
                //// "ourfancyapp" element node
                //if ((reader.NodeType == XmlNodeType.Element) &&
                //    (reader.Name == "bss"))
                //{
                //    while (reader.Read())
                //    {
                //        // when we find an element node,
                //        // we remember its name
                //        if (reader.NodeType == XmlNodeType.Element)
                //            elementName = reader.Name;
                //        else
                //        {
                //            // for text nodes...
                //            if ((reader.NodeType == XmlNodeType.Text) &&
                //                (reader.HasValue))
                //            {
                //                // we check what the name of the node was
                //                switch (elementName)
                //                {
                //                    case "version":
                //                        // thats why we keep the version info
                //                        // in xxx.xxx.xxx.xxx format
                //                        // the Version class does the
                //                        // parsing for us
                //                        newVersion = new Version(reader.Value);
                //                        break;
                //                    case "url":
                //                        url = reader.Value;
                //                        break;
                //                }
                //            }
                //        }
                //    }
                //}

                newVersion = DangNhapDAL.DV_GET_CURRENT_APP_VERSION(Application.ProductName);
                //newVersion = new Version(newV);
            }
            catch (Exception)
            {
                ErrorMessageDAL.DataAccessError();
            }
            //finally
            //{
            //    //if (reader != null) reader.Close();
            //}

            if (curVersion.CompareTo(newVersion) < 0)
            {
                // ask the user if he would like
                // to download the new version
                string title    = "Thông báo cập nhật";
                string question = "Phiên bản bạn đang dùng " + curVersion.ToString() + ". Đã có phiên bản mới " + newVersion.ToString() + ". Bạn có muốn tải về?";
                if (DialogResult.Yes ==
                    MessageBox.Show(this, question, title,
                                    MessageBoxButtons.YesNo,
                                    MessageBoxIcon.Question))
                {
                    // navigate the default web
                    // browser to our app
                    // homepage (the url
                    // comes from the xml content)

                    //System.Diagnostics.Process.Start(url);
                    Process.Start(Application.StartupPath.ToString() + @"\BSS_UPDATE.exe");
                    has_update = true;
                }
            }
            return(has_update);
        }