Exemplo n.º 1
0
 private static void InsertData(Defaultlogin obj, string newDB)
 {
     if (CheckData(obj, newDB) == false)
     {
         CDefaultlogin.Insert(obj, new DAL());
     }
     ;
 }
Exemplo n.º 2
0
        private static bool CheckData(Defaultlogin obj, string newDB)
        {
            string q = "USE " + newDB + "; ";

            q += "SELECT * FROM " + DEFAULTLOGIN.DEFAULTLOGIN_TBL + " WHERE " + DEFAULTLOGIN.DEFAULTLOGIN_NAME + " = '" + obj.Defaultlogin_name + "'; ";

            using (IDataReader redr = new DAL().Listreader(q))
            {
                while (redr.Read() == true)
                {
                    obj.Defaultlogin_id = redr[DEFAULTLOGIN.DEFAULTLOGIN_ID].ToString();

                    CDefaultlogin.Update(obj, new DAL());

                    return(true);
                }
                return(false);
            }
        }
Exemplo n.º 3
0
        private void Login_checkBox_CheckedChanged(object sender, EventArgs e)
        {
            Defaultlogin obj = CDefaultlogin_exten.PKId("1", new DAL());

            if (login_checkBox.Checked == true)
            {
                if (obj.Defaultlogin_name != null)
                {
                    if ((txt_user_name.Text == obj.Defaultlogin_name) && (txt_user_password.Text == obj.Default_password))
                    {
                        return;
                    }
                    else
                    {
                        obj.Defaultlogin_id   = "1";
                        obj.Defaultlogin_name = txt_user_name.Text;
                        obj.Default_password  = txt_user_password.Text;
                        obj.Createon          = Current.Datetime;

                        CDefaultlogin.Update(obj, new DAL());
                    }
                }
                else
                {
                    if ((txt_user_name.Text != "") || (txt_user_password.Text != ""))
                    {
                        obj.Defaultlogin_id   = "1";
                        obj.Defaultlogin_name = txt_user_name.Text;
                        obj.Default_password  = txt_user_password.Text;
                        obj.Createon          = Current.Datetime;

                        CDefaultlogin.Insert(obj, new DAL());
                    }
                }
            }
            else if (login_checkBox.Checked == false)
            {
                CDefaultlogin.Delete("1", new DAL());
            }
        }