示例#1
0
        private void cboAuthenticationType_SelectionChangeCommitted(object sender, EventArgs e)
        {
            this.Cursor = Cursors.WaitCursor;
            if (cboAuthenticationType.SelectedIndex == 0)
            {
                clsDMCommon.ObjCon.ConnectionString = "Server=" + clsDMCommon.strServerName + ";Database=" + ClientDBName + ";uid=" + clsDMCommon.strUserID
                                                      + ";pwd= " + clsDMCommon.strUserPassword + ";" + "Max Pool Size = 5004;Pooling=True";

                clsConnection_DAL ObjDAL = new clsConnection_DAL();
                ObjDAL.SetConnectionString(clsDMCommon.ObjCon.ConnectionString);
                if (ObjDAL.IsDatabaseExist(ClientDBName))
                {
                    if (!System.IO.Directory.Exists("AppConfig"))
                    {
                        System.IO.Directory.CreateDirectory("AppConfig");
                        File.WriteAllText("AppConfig\\ServerConfig.sc", ObjUtil.Encrypt(clsDMCommon.ObjCon.ConnectionString, true));
                    }
                    clsUtility.ShowInfoMessage("Database is already exist.\n please select client", clsUtility.strProjectTitle);
                    IsConnect = false;
                }
                else
                {
                    grpDBRestore.Enabled = true;
                    txtDabasePath.Focus();
                }
            }
            else if (cboAuthenticationType.SelectedIndex == 1)
            {
                grpDBRestore.Enabled = false;
                ConnectToDB(clsDMCommon.strServerName, clsDMCommon.strUserID, clsDMCommon.strUserPassword, ClientDBName);

                String conn = "Server=" + clsDMCommon.strServerName + ";Database=" + ClientDBName + ";uid=" + clsDMCommon.strUserID
                              + ";pwd= " + clsDMCommon.strUserPassword + ";" + "Max Pool Size = 5004;Pooling=True";
                String EncrConn = ObjUtil.Encrypt(conn, true);
                if (!System.IO.Directory.Exists("AppConfig"))
                {
                    System.IO.Directory.CreateDirectory("AppConfig");
                    File.WriteAllText("AppConfig\\ServerConfig.sc", EncrConn);
                }

                ObjDAL = new clsConnection_DAL(true);
                //DataTable dt = ObjDAL.GetDataCol(ClientDBName + ".dbo.RegistrationDetails", "RegistrationID", "PcName = '"+ Environment.MachineName+"'", null);
                int a = ObjDAL.CountRecords(ClientDBName + ".dbo.RegistrationDetails", "PcName = '" + Environment.MachineName + "'");
                //if (dt == null || dt.Rows.Count == 0)
                if (a == 0)
                {
                    InsertClientRegistration();
                }
                else
                {
                    clsUtility.ShowInfoMessage("Client is already Registered.", clsUtility.strProjectTitle);
                    Application.Exit();
                }
            }
            this.Cursor = Cursors.Default;
        }
示例#2
0
        private void CustomerRegister_Load(object sender, EventArgs e)
        {
            //clsUtility._UserMessageType = clsUtility.MessageType.Office2010Blue;
            //clsUtility._UserMessageType = clsUtility.MessageType.SparklePurple;

            LoadTheme();

            dtpExpiryDate.MaxDate = DateTime.Now.AddYears(1);
            dtpExpiryDate.Value   = DateTime.Now.AddDays(7);
            if (ObjDAL.ConnectionObject.ConnectionString == String.Empty)
            {
                ObjDAL.SetConnectionString(clsDMCommon.ObjCon.ConnectionString);
            }
            //DBName = ObjDAL.GetCurrentDBName(true);
        }